Complete the code to run Cypress tests automatically in CI.
describe('Login test', () => { it('should open login page', () => { cy.[1]('https://example.com/login') }) })
The visit command opens a URL in Cypress, which is essential to start a test in CI.
Complete the code to assert the login button is visible.
cy.get('button#login').[1]('be.visible')
The should command asserts that the element meets the condition, here 'be.visible'.
Fix the error in the CI script to run Cypress tests.
steps:
- name: Run tests
run: npm [1]The command npm test runs the test scripts defined in package.json, including Cypress tests in CI.
Fill both blanks to configure Cypress in GitHub Actions for continuous testing.
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: [1]
- name: Install dependencies
run: npm [2]Node.js version 16 is a modern stable version. npm install installs dependencies before running tests in CI.
Fill all three blanks to write a Cypress test that runs in CI and checks page title.
describe('Home page', () => { it('has correct title', () => { cy.[1]('https://example.com') cy.title().[2]('eq', [3]) }) })
visit opens the page, should asserts the title equals the expected string 'Example Domain'.