diff --git a/e2e/tests/theme-default/home.cy.ts b/e2e/tests/theme-default/home.cy.ts index ac76a6cf53..cd0f183829 100644 --- a/e2e/tests/theme-default/home.cy.ts +++ b/e2e/tests/theme-default/home.cy.ts @@ -7,30 +7,23 @@ describe('homepage', () => { const heroImage = 'https://v2.vuepress.vuejs.org/images/hero.png' cy.visit('/') - cy.get('.hero').then((el) => { - cy.wrap(el) - .get('img') - .should('have.attr', 'src', heroImage) - .should('have.attr', 'alt', title) - cy.wrap(el).get('#main-title').should('have.text', title) + cy.get('.hero img') + .should('have.attr', 'src', heroImage) + .should('have.attr', 'alt', title) - cy.wrap(el).get('.description').should('have.text', description) + cy.get('#main-title').should('have.text', title) - cy.wrap(el) - .get('.actions') - .then((el) => { - cy.wrap(el) - .get('.action-button') - .should('have.length', 2) - .each((el, index) => { - cy.wrap(el) - .should('have.attr', 'href', `${BASE}action${index + 1}.html`) - .should('have.attr', 'aria-label', `Action${index + 1}`) - .contains(`Action${index + 1}`) - }) - }) - }) + cy.get('.hero .description').should('have.text', description) + + cy.get('.actions .action-button') + .should('have.length', 2) + .each((el, index) => { + cy.wrap(el) + .should('have.attr', 'href', `${BASE}action${index + 1}.html`) + .should('have.attr', 'aria-label', `Action${index + 1}`) + .contains(`Action${index + 1}`) + }) cy.get('.features .feature').then((el) => { cy.wrap(el) diff --git a/package.json b/package.json index 520c12fc9d..e1f9e14e93 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,8 @@ "release:check": "pnpm lint && pnpm clean && pnpm build && pnpm test", "release:publish": "lerna publish", "test": "vitest run", - "test:cov": "vitest run --coverage" + "test:cov": "vitest run --coverage", + "test:e2e": "pnpm --dir e2e e2e:ci:build" }, "lint-staged": { "**/*": "prettier --write --ignore-unknown",