File size: 1,597 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 47 48 49 50 |
/// <reference types="Cypress" />
describe('<Home /> -> <BrowseContent />', () => {
beforeEach(() => {
localStorage.setItem('profileSelected', true)
cy.visit('/browse')
cy.window()
.its('store')
.invoke('getState')
.as('reduxState')
})
it('fetches trending, top-rated, and netflix originals successfully', () => {
cy.get('@reduxState')
.its('trending')
.its('ids')
.should('have.length', 20)
cy.get('@reduxState')
.its('toprated')
.its('ids')
.should('have.length', 20)
cy.get('@reduxState')
.its('netflixOriginals')
.its('ids')
.should('have.length', 20)
})
it('Ensure that the first video of trending section is placed on the <Video /> topTrailer', () => {
cy.get('@reduxState')
.its('trending')
.its('ids')
.then($idArray => {
const firstElem = $idArray[0]
cy.get('@reduxState')
.its('trending')
.its('entities')
.then(($entities => {
const item = Cypress._.find($entities, (element => element.id === firstElem))
cy.get('.VideoComponent')
.invoke('attr', 'style')
.then(style => {
expect(style).to.include(item.poster_path)
})
}))
})
})
}) |