Skip to content

Commit

Permalink
upgrade cypress-visual-regression
Browse files Browse the repository at this point in the history
  • Loading branch information
binrysearch committed Sep 10, 2024
1 parent 0eec7fc commit 62103b1
Show file tree
Hide file tree
Showing 29 changed files with 37 additions and 38 deletions.
3 changes: 2 additions & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { defineConfig } from "cypress";
import { configureVisualRegression } from "cypress-visual-regression";

module.exports = defineConfig({
viewportWidth: 1000,
trashAssetsBeforeRuns: true,
env: {
failSilently: false,
visualRegressionFailSilently: false,
},
e2e: {
screenshotsFolder: "./cypress/snapshots/actual",
Expand Down
8 changes: 4 additions & 4 deletions cypress/setup/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
crossorigin="anonymous"
/>

<link href="http://localhost:10001/dist/introjs.css" rel="stylesheet" />
<link href="http://host.docker.internal:10001/dist/introjs.css" rel="stylesheet" />

<link rel="preconnect" href="https://fonts.gstatic.com" />
<link
href="https://fonts.googleapis.com/css2?family=Roboto&display=swap"
rel="stylesheet"
/>

<link href="http://localhost:10001/dist/introjs.css" rel="stylesheet" />
<link href="http://host.docker.internal:10001/dist/introjs.css" rel="stylesheet" />

<style type="text/css">
body,
h1,
Expand Down Expand Up @@ -157,7 +157,7 @@ <h2 data-intro="fourth header step" data-hint="secondary header">
class="pt-3 mt-4 text-muted border-top"
data-hint="this is the footer"
>
&copy; YEAR
&copy; 2021
</footer>
</div>
</main>
Expand Down
1 change: 1 addition & 0 deletions cypress/support/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { addCompareSnapshotCommand } from "cypress-visual-regression/dist/comman

addCompareSnapshotCommand({
capture: "fullPage",
errorThreshold: 0.05
});

Cypress.Commands.add("nextStep", () => {
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"core-js": "^3.6.5",
"cypress": "^13.12.0",
"cypress-real-events": "^1.13.0",
"cypress-visual-regression": "^5.0.2",
"cypress-visual-regression": "^5.2.1",
"eslint": "^8.0.1",
"jest": "^29.5.0",
"jest-extended": "^3.2.4",
Expand Down
10 changes: 5 additions & 5 deletions src/packages/tour/dont-show-again.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ context("Don't show again checkbox", () => {

cy.wait(500);

cy.compareSnapshot("dont-show-again-checkbox-first-step", 0.05);
cy.compareSnapshot("dont-show-again-checkbox-first-step");

cy.nextStep();

cy.wait(800);

cy.compareSnapshot("dont-show-again-checkbox-second-step", 0.05);
cy.compareSnapshot("dont-show-again-checkbox-second-step");
});
});

Expand All @@ -53,21 +53,21 @@ context("Don't show again checkbox", () => {

cy.wait(500);

cy.compareSnapshot("dont-show-again-clicked-first-step", 0.05);
cy.compareSnapshot("dont-show-again-clicked-first-step");

cy.get(".introjs-dontShowAgain input").click();

cy.get(".introjs-skipbutton").click();

cy.wait(800);

cy.compareSnapshot("dont-show-again-clicked-after-exit", 0.05);
cy.compareSnapshot("dont-show-again-clicked-after-exit");

instance.start();

cy.wait(500);

cy.compareSnapshot("dont-show-again-clicked-after-second-start", 0.05);
cy.compareSnapshot("dont-show-again-clicked-after-second-start");
});
});
});
13 changes: 5 additions & 8 deletions src/packages/tour/highlight.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ context("Highlight", () => {

cy.wait(500);

cy.compareSnapshot("highlight-element-first-step", 0.05);
cy.compareSnapshot("highlight-element-first-step");

cy.nextStep();

cy.wait(800);

cy.compareSnapshot("highlight-element-second-step", 0.05);
cy.compareSnapshot("highlight-element-second-step");
});
});

Expand Down Expand Up @@ -228,8 +228,7 @@ context("Highlight", () => {
cy.wait(500);

cy.compareSnapshot("highlight-fixed-element", {
capture: "viewport",
errorThreshold: 0.05,
capture: "viewport"
});
});
});
Expand Down Expand Up @@ -257,8 +256,7 @@ context("Highlight", () => {
cy.wait(500);

cy.compareSnapshot("highlight-fixed-element-scroll", {
capture: "viewport",
errorThreshold: 0.05,
capture: "viewport"
});
});
});
Expand Down Expand Up @@ -286,8 +284,7 @@ context("Highlight", () => {
cy.wait(500);

cy.compareSnapshot("highlight-fixed-parent-element-scroll", {
capture: "viewport",
errorThreshold: 0.05,
capture: "viewport"
});
});
});
Expand Down
18 changes: 9 additions & 9 deletions src/packages/tour/modal.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ context("Modal", () => {

cy.wait(500);

cy.compareSnapshot("first-step", 0.05);
cy.compareSnapshot("first-step");

cy.nextStep();
cy.wait(800);

cy.compareSnapshot("second-step", 0.05);
cy.compareSnapshot("second-step");

cy.nextStep();
cy.wait(800);

cy.compareSnapshot("exit", 0.05);
cy.compareSnapshot("exit");
});
});

Expand Down Expand Up @@ -63,15 +63,15 @@ context("Modal", () => {
.start();

cy.wait(800);
cy.compareSnapshot("position-bottom", 0.05);
cy.compareSnapshot("position-bottom");

cy.nextStep();
cy.wait(500);
cy.compareSnapshot("position-right", 0.05);
cy.compareSnapshot("position-right");

cy.nextStep();
cy.wait(500);
cy.compareSnapshot("position-left", 0.05);
cy.compareSnapshot("position-left");
});
});

Expand All @@ -95,11 +95,11 @@ context("Modal", () => {
instance.start();

cy.wait(800).then(() => {
cy.compareSnapshot("refresh-first-step", 0.05);
cy.compareSnapshot("refresh-first-step");
cy.nextStep();

cy.wait(500).then(() => {
cy.compareSnapshot("refresh-second-step", 0.05);
cy.compareSnapshot("refresh-second-step");

cy.wait(500).then(() => {
instance
Expand All @@ -123,7 +123,7 @@ context("Modal", () => {

cy.nextStep();
cy.wait(500);
cy.compareSnapshot("refresh-third-step", 0.05);
cy.compareSnapshot("refresh-third-step");
});
});
});
Expand Down
6 changes: 3 additions & 3 deletions src/packages/tour/progressbar.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ context("ProgressBar", () => {

cy.wait(500);

cy.compareSnapshot("first-step", 0.05);
cy.compareSnapshot("first-step");

cy.nextStep();
cy.wait(800);

cy.compareSnapshot("second-step", 0.05);
cy.compareSnapshot("second-step");

cy.nextStep();
cy.wait(800);

cy.compareSnapshot("exit", 0.05);
cy.compareSnapshot("exit");
});
});
});

0 comments on commit 62103b1

Please sign in to comment.