Skip to content

Commit c2d7f89

Browse files
committed
cleanup image snapshot package
1 parent aa0818b commit c2d7f89

25 files changed

+8
-386
lines changed

.pnp.cjs

-148
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

packages/browser-tests/.gitignore

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
node_modules
22
cypress/videos
33
cypress/screenshots
4-
5-
# folder is used to store screenshots and diffs created by `cy.matchImageSnapshot()`
6-
# ignored now until the snapshots will be stored somewhere else
7-
cypress/snapshots

packages/browser-tests/README.md

-12
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,3 @@ If you want to interact with cypress, you can start it like so:
1919
```
2020
yarn workspace browser-tests run cypress open
2121
```
22-
23-
## Screenshot matching
24-
25-
This package uses [simonsmith/cypress-image-snapshot](https://github.com/simonsmith/cypress-image-snapshot). It adds a `cy.matchImageSnapshot()` command to Cypress.
26-
27-
To take a screenshot while running tests, use `cy.matchImageSnapshot()`.
28-
This will take a screenshot and save it in relevant location (depending
29-
on test name) in `browser-tests/cypress/snapshots`.
30-
31-
On the next run, `cy.matchImageSnapshot()` will compare the screenshot with the one saved in `snapshots` and fail the test if they don't match.
32-
33-
If you want to update the screenshot, run `yarn workspace browser-tests test:update`

packages/browser-tests/cypress.config.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
const { defineConfig } = require("cypress");
2-
const {
3-
addMatchImageSnapshotPlugin,
4-
} = require("@simonsmith/cypress-image-snapshot/plugin");
52

63
const contextPath = process.env.QDB_HTTP_CONTEXT_WEB_CONSOLE || "";
74
const baseUrl = `http://localhost:9999${contextPath}`;
@@ -18,9 +15,7 @@ module.exports = defineConfig({
1815
viewportHeight: 720,
1916
specPattern: "cypress/integration/**/*.spec.js",
2017
supportFile: "cypress/commands.js",
21-
setupNodeEvents(on, config) {
22-
addMatchImageSnapshotPlugin(on, config);
23-
18+
setupNodeEvents(on) {
2419
on("before:browser:launch", (browser = {}, launchOptions) => {
2520
if (browser.family === "chromium" && browser.name !== "electron") {
2621
launchOptions.args.push(

packages/browser-tests/cypress/commands.js

-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
1-
const {
2-
addMatchImageSnapshotCommand,
3-
} = require("@simonsmith/cypress-image-snapshot/command");
4-
51
require("cypress-real-events");
62

73
require("@4tw/cypress-drag-drop");
84

9-
addMatchImageSnapshotCommand({
10-
failureThreshold: 0.3,
11-
blackout: [".notifications", 'button[class*="BuildVersion"'],
12-
});
13-
145
const { ctrlOrCmd, escapeRegExp } = require("./utils");
156

167
const contextPath = process.env.QDB_HTTP_CONTEXT_WEB_CONSOLE || ""

packages/browser-tests/cypress/integration/console/editor.spec.js

-4
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ describe("appendQuery", () => {
4242
const expected = `\n${queries[0]}`;
4343
cy.getEditorContent().should("have.value", expected);
4444
cy.getSelectedLines().should("have.length", 1);
45-
//cy.matchImageSnapshot(); // screenshot diff
4645
});
4746

4847
it("should append and select second query", () => {
@@ -109,7 +108,6 @@ describe("appendQuery", () => {
109108
const expected = `--a\n--b\n\n${queries[0]}`;
110109
cy.getEditorContent().should("have.value", expected);
111110
cy.getSelectedLines().should("have.length", 1);
112-
//cy.matchImageSnapshot();
113111
});
114112

115113
it("should correctly append and add surrounding new lines when there are two lines and position is last line which is empty", () => {
@@ -199,8 +197,6 @@ describe("autocomplete", () => {
199197
it("should work when provided table name doesn't exist", () => {
200198
cy.typeQuery("select * from teletubies");
201199
cy.getAutocomplete().should("not.be.visible").clearEditor();
202-
203-
//cy.matchImageSnapshot();
204200
});
205201

206202
it("should be case insensitive", () => {

packages/browser-tests/cypress/integration/console/import.spec.js

-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ describe("questdb import", () => {
88
it("display import panel", () => {
99
cy.getByDataHook("import-panel-button").click();
1010
cy.getByDataHook("import-dropbox").should("be.visible");
11-
//cy.matchImageSnapshot();
1211
});
1312
});

packages/browser-tests/cypress/integration/console/result_charts.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ describe("questdb charts", () => {
66
});
77

88
it("should render the chart after a successful query invocation", () => {
9-
cy.typeQuery(
9+
cy.typeQueryDirectly(
1010
"SELECT rnd_timestamp(to_timestamp('2024-07-19:00:00:00.000000', 'yyyy-MM-dd:HH:mm:ss.SSSUUU'), to_timestamp('2024-07-20:00:00:00.000000', 'yyyy-MM-dd:HH:mm:ss.SSSUUU'), 0), x FROM long_sequence(10);"
1111
);
1212
cy.clickRun();

packages/browser-tests/package.json

+3-5
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@
33
"packageManager": "yarn@3.1.1",
44
"private": true,
55
"scripts": {
6-
"test": "cypress run --env failOnSnapshotDiff=false --env requireSnapshots=false --spec 'cypress/integration/console/*.spec.js'",
7-
"test:auth": "cypress run --env failOnSnapshotDiff=false --env requireSnapshots=false --spec 'cypress/integration/auth/*.spec.js'",
8-
"test:enterprise": "cypress run --env failOnSnapshotDiff=false --env requireSnapshots=false --spec 'cypress/integration/enterprise/*.spec.js'",
9-
"test:update": "yarn run test --env updateSnapshots=true"
6+
"test": "cypress run --spec 'cypress/integration/console/*.spec.js'",
7+
"test:auth": "cypress run --spec 'cypress/integration/auth/*.spec.js'",
8+
"test:enterprise": "cypress run --spec 'cypress/integration/enterprise/*.spec.js'"
109
},
1110
"devDependencies": {
1211
"@4tw/cypress-drag-drop": "^2.2.5",
13-
"@simonsmith/cypress-image-snapshot": "^8.0.1",
1412
"cypress": "^10.11.0"
1513
},
1614
"dependencies": {

0 commit comments

Comments
 (0)