Skip to content

Commit

Permalink
test: add update-head e2e test case
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorlxy committed Dec 14, 2023
1 parent 9a36f4d commit 256c112
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions e2e/tests/update-head.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
describe('updateHead', () => {
it('should update head correctly', () => {
// en-US
cy.visit('/')

cy.get('head meta[name="foo"]')
.should('have.length', 1)
.should('have.attr', 'content', 'foo')
cy.get('head meta[name="bar"]')
.should('have.length', 1)
.should('have.attr', 'content', 'foobar')
cy.get('head meta[name="baz"]')
.should('have.length', 1)
.should('have.attr', 'content', 'foobar baz')
cy.get('head meta[name="foo-en"]')
.should('have.length', 1)
.should('have.attr', 'content', 'foo-en')

// navigate to zh-CN
cy.get('.e2e-theme-nav a').contains('zh-CN').click()

cy.get('head meta[name="foo"]')
.should('have.length', 1)
.should('have.attr', 'content', 'foo')
cy.get('head meta[name="bar"]')
.should('have.length', 1)
.should('have.attr', 'content', 'foobar zh')
cy.get('head meta[name="baz"]')
.should('have.length', 1)
.should('have.attr', 'content', 'baz')
cy.get('head meta[name="foo-zh"]')
.should('have.length', 1)
.should('have.attr', 'content', 'foo-zh')
})
})

0 comments on commit 256c112

Please sign in to comment.