Test Overview
This test mounts a simple Vue component using Cypress and verifies that the component renders the expected text content.
This test mounts a simple Vue component using Cypress and verifies that the component renders the expected text content.
import { mount } from 'cypress/vue' import { defineComponent } from 'vue' describe('Mounting Vue components', () => { it('renders the greeting message', () => { const HelloWorld = defineComponent({ template: `<div><h1>Hello, Cypress!</h1></div>` }) mount(HelloWorld) cy.get('h1').should('contain.text', 'Hello, Cypress!') }) })
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Cypress test runner initialized | - | PASS |
| 2 | Mount Vue component using mount(HelloWorld) | Browser renders <div><h1>Hello, Cypress!</h1></div> | - | PASS |
| 3 | Find element h1 with cy.get('h1') | h1 element with text 'Hello, Cypress!' is present in DOM | - | PASS |
| 4 | Assert h1 contains text 'Hello, Cypress!' with .should('contain.text', 'Hello, Cypress!') | Text content matches expected string | h1 text contains 'Hello, Cypress!' | PASS |