2023 Trialbee Internship - Cypress
[Internship] Cypress E2E Web Automation | How To Write & Run Tests in Cypress
olivia_yj
2023. 4. 5. 05:25
Writing & Executing Tests
describe('My First Test', () => {
it('Visits the Kitchen Sink', () => {
cy.visit('https://example.cypress.io')
})
})
We can also use just function()
describe('My First Test', () => {
it('finds the content "type"', () => {
cy.visit('https://example.cypress.io')
cy.contains('type')
})
})
describe('My First Test', () => {
it('clicks the link "type"', () => {
cy.visit('https://example.cypress.io')
cy.contains('type').click()
})
})
npx cypress run
npx cypress open
npx cypress run --headed
npx cypress run --spec --headed
npx cypress run --spec cypress/e2e/MyFirstTest.cy.js
npx cypress run --browser chrome
npx cypress run --browser chrome --headed
testSuite --> Test case --> test steps
spec file(cy.js) --> describe blocks(test suites) --> it blocks (test)