Skip to content

Commit 743f1f8

Browse files
committed
test: fix Cypress tests related to scrolling
1 parent e17d2a4 commit 743f1f8

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

cypress/integration/helipopper.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
Cypress.on('scrolled', element => {
2+
// When we do `cy.get()` the Cypress finds the element
3+
// and scrolls down, thus this element becomes at the very top
4+
// of the page.
5+
// `tippy.js` will not show tooltips if they appeared in an invisible
6+
// part of the window.
7+
element.get(0).scrollIntoView({
8+
block: 'center',
9+
inline: 'center'
10+
});
11+
});
12+
113
describe('@ngneat/helipopper', () => {
214
beforeEach(() => {
315
cy.visit('/').wait(200);

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,16 @@
2222
"schematics:build": "npm run build --prefix ./schematics",
2323
"build:playground": "ng build --project helipopper-playground --prod",
2424
"test:playground": "ng test --project helipopper-playground",
25-
"serve:integration:static": "serve dist/helipopper-playground -l 4200",
25+
"serve:playground": "ng s --project helipopper-playground --live-reload false",
26+
"serve:playground:static": "serve dist/helipopper-playground -l 4200",
2627
"// - E2E": "E2E testing",
2728
"cy:open": "cypress open --config integrationFolder=cypress/integration",
2829
"cy:run": "cypress run --config integrationFolder=cypress/integration",
29-
"e2e": "start-test serve:integration 4200 cy:open",
30-
"e2e:chrome": "start-test serve:integration 4200 cy:run:chrome",
31-
"e2e:chromium": "start-test serve:integration 4200 cy:run:chromium",
30+
"e2e": "start-test serve:playground 4200 cy:open",
31+
"e2e:chrome": "start-test serve:playground 4200 cy:run:chrome",
32+
"e2e:chromium": "start-test serve:playground 4200 cy:run:chromium",
3233
"// - CI": "CI Testing",
33-
"test:ci:e2e": "start-test serve:integration:static 4200 cy:run",
34+
"test:ci:e2e": "start-test serve:playground:static 4200 cy:run",
3435
"test:playground:ci": "cross-env CI=true npm run test:playground -- --watch=false --browsers=ChromeHeadlessCustom"
3536
},
3637
"private": true,

0 commit comments

Comments
 (0)