File size: 1,173 Bytes
f5071ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/// <reference types="Cypress" />

describe('<Browse />', () => {
    beforeEach(() => {
        cy.validLogin()
    })

    it('opens browse section if local storage profile selection is set', () => {
        localStorage.setItem('profileSelected', true)

        cy.get('.Button')
            .contains('Sign In')
            .click()

        cy.get('.BrowseContent')
            .should('exist')
    })

    it('opens modal if local storage is not set, and continues to browse section', () => {
        cy.clearLocalStorage()
        
        cy.get('.Button')
            .contains('Sign In')
            .click()

        cy.get('.BrowseContent')
            .should('not.exist')

        cy.get('.ProfileDiv')
            .should('exist')
            .find('.ProfileCard')
            .as('profileCard')
            .should('have.length', 4)

        cy.get('@profileCard')
            .first()
            .click()
            .should(($profileCard) => {
                expect(localStorage.getItem('profileSelected')).to.exist
                expect($profileCard).to.not.exist
            })

        cy.get('.BrowseContent')
            .should('exist')
    })
})