Skip to content

Commit

Permalink
Cypress skips test cases instead of removing test cases for all
Browse files Browse the repository at this point in the history
  • Loading branch information
skitterm committed Jan 3, 2024
1 parent 0da5788 commit e0a213b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
24 changes: 17 additions & 7 deletions tests/cypress/e2e/archiving-assets.cy.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
import { testCases } from './../../test-cases';

// TODO: Remove when Cypress support achieves parity with Playwright
const skippedTestCases = [
'asset doesnt prevent directory from being created',
'percents in URLs are handled',
];

describe('assets', () => {
// add more tests
testCases.forEach(({ title, path: urlPath }) => {
it(title, () => {
if (title === 'external asset is archived') {
// mock the external image (which we'll archive)
cy.intercept('https://some.external/domain/image.png', { fixture: 'pink.png' });
}
if (skippedTestCases.includes(title)) {
it.skip(title, () => {});
} else {
it(title, () => {
if (title === 'external asset is archived') {
// mock the external image (which we'll archive)
cy.intercept('https://some.external/domain/image.png', { fixture: 'pink.png' });
}

cy.visit(`http://localhost:3000/${urlPath}`);
});
cy.visit(`http://localhost:3000/${urlPath}`);
});
}
});
});
19 changes: 11 additions & 8 deletions tests/test-cases.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
// these are used by both Playwright and Cypress.
// They're stored here to make sure we test the same things with both frameworks
// and don't get out of alignment on what we support.
export const testCases = [
{
title: 'query params determine which asset is served',
path: 'asset-paths/query-params',
},
// {
// title: 'asset doesnt prevent directory from being created',
// path: 'asset-paths/asset-at-directory-name'
// },
{
title: 'asset doesnt prevent directory from being created',
path: 'asset-paths/asset-at-directory-name',
},
{
title: 'asset is found at relative path',
path: 'asset-paths/relative-path',
Expand All @@ -27,10 +30,10 @@ export const testCases = [
title: 'assets from css urls are archived',
path: 'asset-paths/css-urls',
},
// {
// title: 'percents in URLs are handled',
// path: 'asset-paths/percents'
// },
{
title: 'percents in URLs are handled',
path: 'asset-paths/percents',
},
{
title: 'srcset is used to determine image asset URL',
path: 'asset-paths/srcset',
Expand Down

0 comments on commit e0a213b

Please sign in to comment.