yarn add cypress --dev
"cypress:open": "cypress open"
npm run cypress:open
/// <reference types="Cypress" />
context('App test', () => {
beforeEach(() => {
cy.visit('http://localhost:4200');
});
it('should display welcome message', () => {
cy.get('app-root h1').contains('Welcome to app!')
});
npm start
yarn add @bahmutov/add-typescript-to-cypress --dev
const cypressTypeScriptPreprocessor = require('./cy-ts-preprocessor')
module.exports = on => {
on('file:preprocessor', cypressTypeScriptPreprocessor)
}
{
Intro
優勢
缺點
Using Cypress.io
安裝 Cypress
yarn add cypress --dev
執行 Cypress
"cypress:open": "cypress open"
npm run cypress:open
第一個測試案例
/// <reference types="Cypress" />
context('App test', () => {
beforeEach(() => {
cy.visit('http://localhost:4200');
});
it('should display welcome message', () => {
cy.get('app-root h1').contains('Welcome to app!')
});
});
npm start
語法支援 TypeScript
yarn add @bahmutov/add-typescript-to-cypress --dev
const cypressTypeScriptPreprocessor = require('./cy-ts-preprocessor')
module.exports = on => {
on('file:preprocessor', cypressTypeScriptPreprocessor)
}
{