Skip to content

Commit 8b8bab8

Browse files
committed
bump @visual-regression-tracker/agent-cypress to 5.1.0
1 parent 8bcfff7 commit 8b8bab8

File tree

10 files changed

+316
-737
lines changed

10 files changed

+316
-737
lines changed

agent-cypress/cypress.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"baseUrl": "https://www.gom.com/",
2+
"baseUrl": "https://www.google.com/",
33
"video": false,
44
"screenshotOnRunFailure": false,
55
"retries": {
80.1 KB
Loading

agent-cypress/cypress/fixtures/vrt-page-path.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

agent-cypress/cypress/integration/screenshot.spec.js

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,21 @@
11
describe("Test", () => {
2+
before(() => {
3+
cy.vrtStart();
4+
});
25

3-
const viewports = {
4-
5-
"desktop": {"viewportWidth": 1920, "viewportHeight": 1080}
6-
}
6+
after(() => {
7+
cy.vrtStop();
8+
});
79

8-
var target_paths
10+
it(`VRT Test`, function () {
11+
cy.visit("/");
912

10-
before(() => {
11-
cy.vrtStart()
12-
cy.fixture('vrt-page-path.json').then((paths) => {
13-
target_paths = paths
14-
})
15-
});
16-
17-
after(() => {
18-
cy.vrtStop()
19-
});
13+
cy.vrtTrack("Home page");
2014

21-
context("Visual Regression Tracker", () => {
15+
cy.get("[name='q']").vrtTrack("Search field");
2216

23-
Object.keys(viewports).forEach((viewport) => {
24-
it(`VRT Test for ${viewport}`, function() {
25-
cy.wrap(Object.keys(target_paths)).each(function(page) {
26-
cy.viewport(viewports[viewport].viewportWidth, viewports[viewport].viewportHeight)
27-
cy.log(Cypress.config("viewportHeight"))
28-
cy.visit(target_paths[page])
29-
cy.vrtTrack(`${page}-${viewport}`, {
30-
viewport: viewports[viewport].viewportWidth + "x" + viewports[viewport].viewportHeight
31-
})
32-
})
33-
})
34-
})
35-
})
36-
})
17+
cy.fixture("test.png").then((logo) => {
18+
cy.vrtTrackBase64("Fixture image", logo);
19+
});
20+
});
21+
});

agent-cypress/cypress/plugins/index.js

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,5 @@ module.exports = (on, config) => {
2424
// `config` is the resolved Cypress config
2525
addVisualRegressionTrackerPlugin(on, config)
2626

27-
on('before:browser:launch', (browser, launchOptions) => {
28-
if (browser.name === 'chrome' && browser.isHeadless) {
29-
// fullPage screenshot size is 1400x1200 on non-retina screens
30-
// and 2800x2400 on retina screens
31-
launchOptions.args.push('--window-size=1920,1080')
32-
33-
// force screen to be non-retina (1400x1200 size)
34-
launchOptions.args.push('--force-device-scale-factor=1')
35-
36-
// force screen to be retina (2800x2400 size)
37-
// launchOptions.args.push('--force-device-scale-factor=2')
38-
}
39-
40-
if (browser.name === 'electron' && browser.isHeadless) {
41-
// fullPage screenshot size is 1400x1200
42-
launchOptions.preferences.width = 1920
43-
launchOptions.preferences.height = 1080
44-
}
45-
46-
if (browser.name === 'firefox' && browser.isHeadless) {
47-
// menubars take up height on the screen
48-
// so fullPage screenshot size is 1400x1126
49-
launchOptions.args.push('--width=1920')
50-
launchOptions.args.push('--height=1080')
51-
}
52-
53-
return launchOptions
54-
})
27+
return config;
5528
}

agent-cypress/cypress/support/commands.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,12 @@ import {
2727
addVrtStartCommand,
2828
addVrtTrackCommand,
2929
addVrtStopCommand,
30+
addVrtTrackBufferCommand,
31+
addVrtTrackBase64Command,
3032
} from "@visual-regression-tracker/agent-cypress/dist/commands";
3133

3234
addVrtStartCommand();
3335
addVrtTrackCommand();
3436
addVrtStopCommand();
37+
addVrtTrackBufferCommand();
38+
addVrtTrackBase64Command();

0 commit comments

Comments
 (0)