-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #164 from chromaui/todd/cypress-dl-dir
Use configured `downloadsFolder` for Cypress
- Loading branch information
Showing
10 changed files
with
51 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@chromatic-com/playwright': patch | ||
'@chromatic-com/cypress': patch | ||
--- | ||
|
||
- Use the configured `downloadsFolder` in Cypress as the output dir for archives | ||
- Move Playwright-related path logic out of the shared package into the Playwright package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
import { defineConfig } from 'cypress'; | ||
import { installPlugin } from '../dist'; | ||
import { existsSync } from 'node:fs'; | ||
|
||
export default defineConfig({ | ||
// `downloadsFolder` cannot be overridden in tests, so we're setting | ||
// this to a non-default value for asserting in the tests | ||
downloadsFolder: 'cypress/test-downloads', | ||
// needed since we use common mock images between Cypress and Playwright | ||
fixturesFolder: '../../../test-server/fixtures', | ||
screenshotOnRunFailure: false, | ||
e2e: { | ||
baseUrl: 'http://localhost:3000', | ||
setupNodeEvents(on, config) { | ||
installPlugin(on, config); | ||
on('task', { | ||
directoryExists(directoryName) { | ||
return existsSync(directoryName); | ||
}, | ||
}); | ||
}, | ||
}, | ||
}); |
13 changes: 13 additions & 0 deletions
13
packages/cypress/tests/cypress/e2e/custom-downloads-directory.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Snapshots are disabled because we're asserting on file system concerns, | ||
// not testing anything visual | ||
it( | ||
'downloads archives to the user-specified folder', | ||
{ env: { disableAutoSnapshot: true } }, | ||
() => { | ||
cy.visit('/asset-paths/query-params'); | ||
const chromaticArchivesDir = `${Cypress.config('downloadsFolder')}/chromatic-archives`; | ||
cy.task('directoryExists', chromaticArchivesDir).then((dirExists) => { | ||
expect(dirExists).to.be.true; | ||
}); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters