Skip to content

Commit 0a60954

Browse files
committed
Cypress test for added later element
1 parent 9031e45 commit 0a60954

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
context("Added later element", () => {
2+
const addedLaterElId = "later_added";
3+
const stepOneText = "step one";
4+
const stepTwoText = "step two, click on create btn";
5+
const stepThreeText = "added later element";
6+
const createDivBtnSelector = "#create-div-button";
7+
beforeEach(() => {
8+
cy.visit("./cypress/setup/index.html").then((window) => {
9+
window
10+
.introJs()
11+
.setOptions({
12+
disableInteraction: false,
13+
steps: [
14+
{
15+
intro: stepOneText,
16+
},
17+
{
18+
intro: stepTwoText,
19+
element: createDivBtnSelector,
20+
},
21+
{
22+
intro: stepThreeText,
23+
element: "#" + addedLaterElId,
24+
},
25+
],
26+
})
27+
.start();
28+
});
29+
});
30+
31+
it("should find by selector and highlight added later element", () => {
32+
cy.get(".introjs-tooltiptext").contains(stepOneText);
33+
cy.nextStep();
34+
cy.get(".introjs-tooltiptext").contains(stepTwoText);
35+
cy.wait(500);
36+
cy.get(createDivBtnSelector).click();
37+
cy.nextStep();
38+
cy.wait(500);
39+
cy.get("#" + addedLaterElId)
40+
.filter(".introjs-showElement")
41+
.contains("Later added div");
42+
cy.compareSnapshot("added-later-element-end", 0.05);
43+
});
44+
});
Loading

0 commit comments

Comments
 (0)