-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
E2E test at blog root route's header (#92)
* chore: rename blog cypress file and directory * test: append more test at root routes header function
- Loading branch information
Showing
2 changed files
with
52 additions
and
7 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
describe('root - header', () => { | ||
it('should has header', () => { | ||
cy.visit('/'); | ||
cy.get('header').should('be.visible'); | ||
}); | ||
|
||
it('should navigate to root when click lever 1 heading', () => { | ||
cy.get('h1').click(); | ||
cy.url().should('eq', Cypress.config().baseUrl); | ||
}); | ||
|
||
const THEME_SWITCH_LABEL = 'theme switch'; | ||
const GET_THEME_SWITCH_BY_LABEL = `[aria-label="${THEME_SWITCH_LABEL}"]`; | ||
|
||
it('should visible theme toggle switch at header', () => { | ||
cy.get('header').within(() => { | ||
cy.get(GET_THEME_SWITCH_BY_LABEL).should('be.visible'); | ||
}); | ||
}); | ||
|
||
it('should toggle theme when click theme toggle switch', () => { | ||
// NOTE: visit with prefer white mode | ||
cy.visit('/', { | ||
onBeforeLoad: win => { | ||
cy.stub(win, 'matchMedia') | ||
.withArgs('(prefers-color-scheme: dark)') | ||
.returns({ matches: false, addListener: () => {}, removeListener: () => {} }); | ||
}, | ||
}); | ||
|
||
cy.get('body').then($body => { | ||
const lightBgColor = $body.css('background-color'); | ||
|
||
cy.get(GET_THEME_SWITCH_BY_LABEL).click(); | ||
cy.get('body').should('have.css', 'background-color').and('not.eq', lightBgColor); | ||
}); | ||
}); | ||
|
||
it('should visible kbar button at header', () => { | ||
cy.get('header').within(() => { | ||
cy.get('button').should('be.visible'); | ||
}); | ||
}); | ||
|
||
it('should render kbar menu when click kbar button', () => { | ||
cy.get('header').within(() => { | ||
cy.get('button').click(); | ||
}); | ||
|
||
cy.get('input').should('be.visible'); | ||
}); | ||
}); |
adc8872
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
comet-land-blog – ./apps/blog
comet-land-blog-git-main-hyesungoh.vercel.app
comet-land-blog-hyesungoh.vercel.app
comet-land-blog.vercel.app
adc8872
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
comet-land-resume – ./apps/resume
comet-land-resume-hyesungoh.vercel.app
comet-land-resume-git-main-hyesungoh.vercel.app
comet-land-resume.vercel.app