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`.
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
describe('application is initialized as expected', () => {
|
|
it('loads title as expected', () => {
|
|
// act
|
|
cy.visit('/');
|
|
// assert
|
|
cy.contains('h1', 'privacy.sexy');
|
|
});
|
|
it('there are no console.error output', () => {
|
|
// act
|
|
// https://docs.cypress.io/faq/questions/using-cypress-faq#How-do-I-spy-on-console-log
|
|
cy.visit('/', {
|
|
onBeforeLoad(win) {
|
|
cy.stub(win.console, 'error').as('consoleError');
|
|
},
|
|
});
|
|
// assert
|
|
cy.get('@consoleError').should('have.not.been.called');
|
|
});
|
|
it('there are no console.warn output', () => {
|
|
// act
|
|
cy.visit('/', {
|
|
onBeforeLoad(win) {
|
|
cy.stub(win.console, 'warn').as('consoleWarn');
|
|
},
|
|
});
|
|
// assert
|
|
cy.get('@consoleWarn').should('have.not.been.called');
|
|
});
|
|
it('there are no console.log output', () => {
|
|
// act
|
|
cy.visit('/', {
|
|
onBeforeLoad(win) {
|
|
cy.stub(win.console, 'log').as('consoleLog');
|
|
},
|
|
});
|
|
// assert
|
|
cy.get('@consoleLog').should('have.not.been.called');
|
|
});
|
|
});
|