Skip to content

Commit

Permalink
test: run hmr restore tasks in after hook
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorlxy committed Feb 19, 2024
1 parent bb96427 commit a7a23f7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions e2e/tests/hmr/frontmatter.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
if (Cypress.env('E2E_COMMAND') === 'dev') {
after(() => {
cy.task('hmr:frontmatter:restore')
})

it('should update frontmatter correctly', () => {
cy.visit('/hmr/frontmatter.html')
cy.get('.e2e-theme-content #rendered-foo + p').should(
Expand Down
5 changes: 5 additions & 0 deletions e2e/tests/hmr/navigation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
if (Cypress.env('E2E_COMMAND') === 'dev') {
after(() => {
cy.task('hmr:title:restore')
cy.task('hmr:frontmatter:restore')
})

it('should update title and frontmatter correctly after navigation', () => {
cy.visit('/hmr/title.html')
cy.title().should('include', 'HMR Title')
Expand Down
4 changes: 4 additions & 0 deletions e2e/tests/hmr/title.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
if (Cypress.env('E2E_COMMAND') === 'dev') {
after(() => {
cy.task('hmr:title:restore')
})

it('should update title correctly', () => {
cy.visit('/hmr/title.html')
cy.title().should('include', 'HMR Title')
Expand Down

0 comments on commit a7a23f7

Please sign in to comment.