forked from webpack/webpack.js.org
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathscroll.cy.js
26 lines (23 loc) · 976 Bytes
/
scroll.cy.js
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
const sizes = ['iphone-6', 'macbook-15'];
describe('Scroll Test', () => {
sizes.forEach((size) => {
it(`scroll to top when accessing new page on ${size}`, () => {
cy.viewport(size);
cy.visit('/guides/getting-started');
// scroll to Contributors section
cy.get('[data-testid="contributors"]').scrollIntoView();
cy.isNotInViewport('#basic-setup');
cy.visit('/guides/build-performance/');
cy.isNotInViewport('[data-testid="contributors"]');
});
it(`scroll to fragment when accessing new page with fragment on ${size}`, () => {
cy.viewport(size);
cy.visit('/guides/getting-started');
cy.get('[data-testid="contributors"]').scrollIntoView();
cy.visit('/guides/build-performance/#development');
// since we lazy load notification bar now, #development element is a little out of viewport now
cy.isInViewport('#compile-in-memory');
cy.isNotInViewport('#general');
});
});
});