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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
// See https://github.com/cypress-io/cypress/issues/761 - Cypress dies if we
// go straight to the next test with an XHR in progress. So visit a 404 page
// to cancel anything in progress.
Cypress.Commands.add('cleanUpXHR', function() {
cy.visit('/404', { failOnStatusCode: false });
});
describe('Front page responsive design tests', function() {
it('Shows correct things on mobile', function() {
cy.viewport(480, 800);
cy.visit('/');
cy.get('a#report-cta').should('be.visible');
});
it('Shows correct things on tablet', function() {
cy.viewport(800, 800);
cy.visit('/');
cy.get('a#report-cta').should('not.be.visible');
});
it('Shows correct things on desktop', function() {
cy.viewport(1024, 800);
cy.visit('/');
cy.get('a#report-cta').should('not.be.visible');
});
});
describe('Around page responsive design tests', function() {
it('Shows correct things on mobile', function() {
cy.viewport(480, 800);
cy.visit('/around?pc=BS10+5EE&js=1');
cy.get('.mobile-map-banner').should('be.visible');
cy.get('#sub_map_links').should('be.visible');
cy.get('#map_links_toggle').should('not.be.visible');
cy.get('#map_box').click(200, 200);
cy.get('#sub_map_links').should('not.be.visible');
cy.get('#try_again').should('be.visible');
cy.get('#mob_ok').click();
cy.cleanUpXHR();
});
it('Shows correct things on tablet', function() {
cy.viewport(800, 800);
cy.visit('/around?pc=BS10+5EE&js=1');
cy.get('.mobile-map-banner').should('not.be.visible');
cy.get('#map_sidebar').should('be.visible');
cy.get('#side-form').should('not.be.visible');
cy.get('#sub_map_links').should('be.visible');
cy.get('#map_links_toggle').should('be.visible');
cy.get('#map_box').click(200, 200);
cy.get('#sub_map_links').should('be.visible');
cy.get('#side-form').should('be.visible');
cy.cleanUpXHR();
});
it('Shows correct things on desktop', function() {
cy.viewport(1024, 800);
cy.visit('/around?pc=BS10+5EE&js=1');
cy.get('.mobile-map-banner').should('not.be.visible');
cy.get('#map_sidebar').should('be.visible');
cy.get('#sub_map_links').should('be.visible');
cy.get('#map_links_toggle').should('be.visible');
cy.get('#side-form').should('not.be.visible');
cy.get('#map_box').click(200, 200);
cy.get('#sub_map_links').should('be.visible');
cy.get('#side-form').should('be.visible');
cy.cleanUpXHR();
});
});
|