Skip to content

Commit

Permalink
fix(cypress): use corret events, remove duplicated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kettei-sproutty committed Jun 13, 2024
1 parent cafc0fd commit 574fc61
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 154 deletions.
15 changes: 2 additions & 13 deletions cypress/e2e/blog.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('blog page', () => {

it('should return to the homepage', () => {
cy.visit('/blog')
cy.get('a').contains(/back/i).click()
cy.get('a').contains(/back/i).first().click()
cy.url().should('include', '/')
})

Expand All @@ -32,7 +32,7 @@ describe('blog page', () => {
cy.get('input').should('not.exist')
})

it('should filter the articles pressing <esc>', () => {
it('should close the filter modal pressing <esc>', () => {
cy.visit('/blog')
cy.keyup('s')
cy.get('input').should('be.focused').type('test')
Expand All @@ -41,17 +41,6 @@ describe('blog page', () => {
cy.get('input').should('not.exist')
})

it('should filter the articles', () => {
cy.visit('/blog')
cy.keyup('s')
cy.get('input').should('be.focused').type('test')
cy.get('input').should('have.value', 'test')
cy.get('button')
.contains(/search/i)
.click()
cy.get('input').should('not.exist')
})

it('should filter the articles with <enter> key', () => {
cy.visit('/blog')
cy.keyup('s')
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/home.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('homepage', () => {

it(`should navigate to the ${url} page with shortcut`, () => {
cy.visit('/')
cy.keypress(shortcut)
cy.keydown(shortcut)
cy.url().should('include', url)
})
}
Expand All @@ -31,7 +31,7 @@ describe('homepage', () => {

it('should navigate to the changelog page with shortcut', () => {
cy.visit('/')
cy.keypress('c')
cy.keydown('c')
cy.url().should('include', '/changelog')
})
})
Expand Down
Loading

0 comments on commit 574fc61

Please sign in to comment.