Skip to content

Commit

Permalink
Cypress test for added later element
Browse files Browse the repository at this point in the history
  • Loading branch information
gooddaytoday committed May 26, 2022
1 parent 9031e45 commit 0a60954
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions tests/cypress/integration/tour/added-later-element.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
context("Added later element", () => {
const addedLaterElId = "later_added";
const stepOneText = "step one";
const stepTwoText = "step two, click on create btn";
const stepThreeText = "added later element";
const createDivBtnSelector = "#create-div-button";
beforeEach(() => {
cy.visit("./cypress/setup/index.html").then((window) => {
window
.introJs()
.setOptions({
disableInteraction: false,
steps: [
{
intro: stepOneText,
},
{
intro: stepTwoText,
element: createDivBtnSelector,
},
{
intro: stepThreeText,
element: "#" + addedLaterElId,
},
],
})
.start();
});
});

it("should find by selector and highlight added later element", () => {
cy.get(".introjs-tooltiptext").contains(stepOneText);
cy.nextStep();
cy.get(".introjs-tooltiptext").contains(stepTwoText);
cy.wait(500);
cy.get(createDivBtnSelector).click();
cy.nextStep();
cy.wait(500);
cy.get("#" + addedLaterElId)
.filter(".introjs-showElement")
.contains("Later added div");
cy.compareSnapshot("added-later-element-end", 0.05);
});
});
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0a60954

Please sign in to comment.