-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate Cypress (E2E) tests to Vite and TypeScript
This commit progresses the migration from Vue CLI to Vite (#230). TypeScript migration: - Convert JavaScript Cypress tests and configurations to TypeScript. - Introduce `tsconfig.json` for Cypress, following official recommendation. Test execution: - Use Cypress CLI to run the tests. - Rename Cypress commands to reflect official naming conventions. - Start Vue server prior to Cypress execution, using `start-server-and-test` package based on official documentation. - Remove dependency on Vue CLI plugin ((`@vue/cli-plugin-e2e-cypress`). Configuration standardization (based on Cypress docs): - Delete unused `plugins/` directory. - Move test (spec) files to to the root directory. - Add official ESLint plugin (`eslint-plugin-cypress`). Changes for importing `vite.config.ts` into `cypress.config.ts`: - Add TypeScript import assertations to files importing JSON files. - Use ESM friendly way instead of `__dirname` to solve `ReferenceError: __dirname is not defined in ES module scrope`. Other changes: - Simplify comments in placeholder files. - Create Cypress specific `.gitignore` for enhanced maintainability, clarity and scalability. - Remove redundant `vue.config.cjs`.
- Loading branch information
1 parent
3305745
commit aa94981
Showing
21 changed files
with
1,214 additions
and
8,916 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 |
---|---|---|
|
@@ -23,4 +23,4 @@ jobs: | |
run: npm ci | ||
- | ||
name: Run e2e tests | ||
run: npm run test:e2e -- --headless | ||
run: npm run test:cy:run |
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,15 +1,15 @@ | ||
import { defineConfig } from 'cypress'; | ||
import setupPlugins from './tests/e2e/plugins/index'; | ||
import ViteConfig from './vite.config'; | ||
|
||
const CYPRESS_BASE_DIR = 'tests/e2e/'; | ||
|
||
export default defineConfig({ | ||
fixturesFolder: 'tests/e2e/fixtures', | ||
screenshotsFolder: 'tests/e2e/screenshots', | ||
videosFolder: 'tests/e2e/videos', | ||
fixturesFolder: `${CYPRESS_BASE_DIR}/fixtures`, | ||
screenshotsFolder: `${CYPRESS_BASE_DIR}/screenshots`, | ||
videosFolder: `${CYPRESS_BASE_DIR}/videos`, | ||
e2e: { | ||
setupNodeEvents(on, config) { | ||
return setupPlugins(on, config); | ||
}, | ||
specPattern: 'tests/e2e/specs/**/*.cy.{js,jsx,ts,tsx}', | ||
supportFile: 'tests/e2e/support/index.js', | ||
baseUrl: `http://localhost:${ViteConfig.server.port}/`, | ||
specPattern: `${CYPRESS_BASE_DIR}/**/*.cy.{js,jsx,ts,tsx}`, // Default: cypress/e2e/**/*.cy.{js,jsx,ts,tsx} | ||
supportFile: `${CYPRESS_BASE_DIR}/support/e2e.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
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
Oops, something went wrong.