Skip to content

Commit

Permalink
more tests the merrier
Browse files Browse the repository at this point in the history
  • Loading branch information
flotwig committed Aug 14, 2020
1 parent 80799a1 commit ee60b01
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions packages/desktop-gui/cypress/integration/project_nav_spec.js
Expand Up @@ -318,32 +318,42 @@ describe('Project Nav', function () {
})

describe('local storage saved browser', function () {
// deliberately not the default 'chrome' browser
// @see https://github.com/cypress-io/cypress/issues/8281
const canaryJson = JSON.stringify({
name: 'chrome',
channel: 'canary',
afterEach(() => {
cy.clearLocalStorage()
})

beforeEach(function () {
localStorage.setItem('chosenBrowser', canaryJson)
it('displays chosen browser in localStorage', function () {
// deliberately not the default 'chrome' browser
// @see https://github.com/cypress-io/cypress/issues/8281
localStorage.setItem('chosenBrowser', JSON.stringify({
name: 'chrome',
channel: 'canary',
}))

this.openProject.resolve(this.config)
})

afterEach(() => {
cy.clearLocalStorage()
cy.get('.browsers-list .dropdown-chosen')
.should('contain', 'Canary').and('not.contain', 'Edge')
.get('.dropdown-chosen .browser-icon')
.should('have.attr', 'src').and('include', './img/chrome-canary')
})

it('displays local storage browser name in chosen', () => {
it('displays chosen browser with old string-style id in localStorage', function () {
localStorage.setItem('chosenBrowser', 'chrome')

this.openProject.resolve(this.config)

cy.get('.browsers-list .dropdown-chosen')
.should('contain', 'Canary').and('not.contain', 'Edge')
.should('contain', 'Chrome')
})

it('displays local storage browser icon in chosen', () => {
cy.get('.browsers-list .dropdown-chosen .browser-icon')
.should('have.attr', 'src')
.and('include', './img/chrome-canary')
it('displays default browser with null localStorage', function () {
localStorage.removeItem('chosenBrowser')

this.openProject.resolve(this.config)

cy.get('.browsers-list .dropdown-chosen')
.should('contain', this.config.browsers[0].displayName)
})
})

Expand Down

0 comments on commit ee60b01

Please sign in to comment.