Changeset View
Changeset View
Standalone View
Standalone View
cypress/integration/layout.spec.js
/** | /** | ||||
* Copyright (C) 2019 The Software Heritage developers | * Copyright (C) 2019 The Software Heritage developers | ||||
* See the AUTHORS file at the top-level directory of this distribution | * See the AUTHORS file at the top-level directory of this distribution | ||||
* License: GNU Affero General Public License version 3, or any later version | * License: GNU Affero General Public License version 3, or any later version | ||||
* See top-level LICENSE file for more information | * See top-level LICENSE file for more information | ||||
*/ | */ | ||||
const url = '/'; | const url = '/'; | ||||
describe('Test top-bar', function() { | describe('Test top-bar', function() { | ||||
it('should should contain all navigation links', function() { | beforeEach(function() { | ||||
cy.clearLocalStorage(); | |||||
cy.visit(url); | cy.visit(url); | ||||
}); | |||||
it('should should contain all navigation links', function() { | |||||
cy.get('.swh-top-bar a') | cy.get('.swh-top-bar a') | ||||
.should('have.length.of.at.least', 4) | .should('have.length.of.at.least', 4) | ||||
.and('be.visible') | .and('be.visible') | ||||
.and('have.attr', 'href'); | .and('have.attr', 'href'); | ||||
}); | }); | ||||
it('should show donate button on lg screen', function() { | it('should show donate button on lg screen', function() { | ||||
cy.visit(url); | |||||
cy.get('.swh-donate-link') | cy.get('.swh-donate-link') | ||||
.should('be.visible'); | .should('be.visible'); | ||||
}); | }); | ||||
it('should hide donate button on sm screen', function() { | it('should hide donate button on sm screen', function() { | ||||
cy.viewport(600, 800); | cy.viewport(600, 800); | ||||
cy.visit(url); | |||||
cy.get('.swh-donate-link') | cy.get('.swh-donate-link') | ||||
.should('not.be.visible'); | .should('not.be.visible'); | ||||
}); | }); | ||||
it('should change container width when toggling Full width switch', function() { | |||||
cy.get('#swh-web-content') | |||||
.should('have.class', 'container') | |||||
.should('not.have.class', 'container-fluid'); | |||||
cy.should(() => { | |||||
expect(JSON.parse(localStorage.getItem('swh-web-full-width'))).to.be.null; | |||||
}); | |||||
cy.get('#swh-full-width-switch') | |||||
.click({force: true}); | |||||
cy.get('#swh-web-content') | |||||
.should('not.have.class', 'container') | |||||
.should('have.class', 'container-fluid'); | |||||
cy.should(() => { | |||||
expect(JSON.parse(localStorage.getItem('swh-web-full-width'))).to.be.true; | |||||
}); | |||||
cy.get('#swh-full-width-switch') | |||||
.click({force: true}); | |||||
cy.get('#swh-web-content') | |||||
.should('have.class', 'container') | |||||
.should('not.have.class', 'container-fluid'); | |||||
cy.should(() => { | |||||
expect(JSON.parse(localStorage.getItem('swh-web-full-width'))).to.be.false; | |||||
}); | |||||
}); | |||||
it('should restore container width when loading page again', function() { | |||||
cy.visit(url) | |||||
.get('#swh-web-content') | |||||
.should('have.class', 'container') | |||||
.should('not.have.class', 'container-fluid'); | |||||
cy.get('#swh-full-width-switch') | |||||
.click({force: true}); | |||||
cy.visit(url) | |||||
.get('#swh-web-content') | |||||
.should('not.have.class', 'container') | |||||
.should('have.class', 'container-fluid'); | |||||
cy.get('#swh-full-width-switch') | |||||
.click({force: true}); | |||||
cy.visit(url) | |||||
.get('#swh-web-content') | |||||
.should('have.class', 'container') | |||||
.should('not.have.class', 'container-fluid'); | |||||
}); | |||||
}); | }); | ||||
describe('Test footer', function() { | describe('Test footer', function() { | ||||
beforeEach(function() { | beforeEach(function() { | ||||
cy.visit(url); | cy.visit(url); | ||||
}); | }); | ||||
it('should be visible', function() { | it('should be visible', function() { | ||||
Show All 17 Lines |