Skip to content

Commit 9cba718

Browse files
committed
test: "Dont show again" cypress tests
1 parent 0e98d65 commit 9cba718

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
context("Don't show again checkbox", () => {
2+
beforeEach(() => {
3+
cy.visit("./cypress/setup/index.html");
4+
cy.clearCookies();
5+
});
6+
7+
it("should render the 'Dont show Again' checkbox", () => {
8+
cy.window().then((window) => {
9+
window
10+
.introJs()
11+
.setOptions({
12+
dontShowAgain: true,
13+
steps: [
14+
{
15+
intro: "step one",
16+
},
17+
{
18+
element: "#clickable-button",
19+
intro: "step two",
20+
},
21+
],
22+
})
23+
.start();
24+
25+
cy.wait(500);
26+
27+
cy.compareSnapshot("dont-show-again-checkbox-first-step", 0.05);
28+
29+
cy.nextStep();
30+
31+
cy.wait(800);
32+
33+
cy.compareSnapshot("dont-show-again-checkbox-second-step", 0.05);
34+
});
35+
});
36+
37+
it("should not display the tour if checkbox is clicked", () => {
38+
cy.window().then((window) => {
39+
const instance = window.introJs().setOptions({
40+
dontShowAgain: true,
41+
steps: [
42+
{
43+
intro: "step one",
44+
},
45+
{
46+
element: "#clickable-button",
47+
intro: "step two",
48+
},
49+
],
50+
});
51+
52+
instance.start();
53+
54+
cy.wait(500);
55+
56+
cy.compareSnapshot("dont-show-again-clicked-first-step", 0.05);
57+
58+
cy.get(".introjs-dontShowAgain input").click();
59+
60+
cy.get(".introjs-skipbutton").click();
61+
62+
cy.wait(800);
63+
64+
cy.compareSnapshot("dont-show-again-clicked-after-exit", 0.05);
65+
66+
instance.start();
67+
68+
cy.wait(500);
69+
70+
cy.compareSnapshot("dont-show-again-clicked-after-second-start", 0.05);
71+
});
72+
});
73+
});

0 commit comments

Comments
 (0)