Skip to content

Commit 008a6a4

Browse files
authored
Merge pull request #1462 from isaacphysics/vrt-improvements
VRT improvements
2 parents 986be87 + 00fa849 commit 008a6a4

File tree

4 files changed

+32
-30
lines changed

4 files changed

+32
-30
lines changed

.github/workflows/cypress.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
find ./src/test/pages/__image_snapshots__ -type f -name "*.actual.png" -exec bash -c 'exiftool -overwrite_original -FRSOURCE_CPVRD_V="1" "$1"; mv "$1" "${1/.actual./.}"' shell {} \;
5050
git fetch origin $target_ref
5151
git checkout -B $update_branch_name origin/$target_ref
52-
git commit -am "Update VRT baselines"
52+
git add . && git commit -m "Update VRT baselines"
5353
git push --set-upstream origin $update_branch_name --force
5454
echo "TARGET_REF=$target_ref" >> "$GITHUB_ENV"
5555
echo "UPDATE_BRANCH_NAME=$update_branch_name" >> "$GITHUB_ENV"

cypress.config.ts

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,31 @@ const SITE_STRING = process.env.CYPRESS_SITE == 'ada' ? 'ada' : 'phy';
55
const UPDATE_BASELINE = process.env.CYPRESS_UPDATE_BASELINE == 'true';
66

77
export default defineConfig({
8-
component: {
9-
devServer: {
10-
framework: "react",
11-
bundler: "webpack",
12-
webpackConfig: require(`./config/webpack.config.${SITE_STRING}.cypress.js`)
13-
},
14-
indexHtmlFile: `cypress/support/component-index-${SITE_STRING}.html`,
15-
supportFile: `cypress/support/component-${SITE_STRING}.tsx`,
16-
setupNodeEvents(on, config) {
17-
initPlugin(on, config);
18-
on('before:browser:launch', (browser, launchOptions) => {
19-
if (browser.family === 'chromium') {
20-
// Disable smooth scrolling, which can interfere with screenshots
21-
launchOptions.args.push('--force-color-profile=srgb');
22-
launchOptions.args.push('--disable-low-res-tiling');
23-
launchOptions.args.push('--disable-smooth-scrolling');
8+
component: {
9+
devServer: {
10+
framework: "react",
11+
bundler: "webpack",
12+
webpackConfig: require(`./config/webpack.config.${SITE_STRING}.cypress.js`)
13+
},
14+
indexHtmlFile: `cypress/support/component-index-${SITE_STRING}.html`,
15+
supportFile: `cypress/support/component-${SITE_STRING}.tsx`,
16+
setupNodeEvents(on, config) {
17+
initPlugin(on, config);
18+
on('before:browser:launch', (browser, launchOptions) => {
19+
if (browser.family === 'chromium') {
20+
// Disable smooth scrolling, which can interfere with screenshots
21+
launchOptions.args.push('--force-color-profile=srgb');
22+
launchOptions.args.push('--disable-low-res-tiling');
23+
launchOptions.args.push('--disable-smooth-scrolling');
24+
}
25+
return launchOptions;
26+
});
2427
}
25-
return launchOptions;
26-
});
28+
},
29+
env: {
30+
pluginVisualRegressionImagesPath : `{spec_path}/__image_snapshots__/${SITE_STRING}`,
31+
pluginVisualRegressionMaxDiffThreshold: 0,
32+
pluginVisualRegressionUpdateImages: UPDATE_BASELINE,
33+
pluginVisualRegressionCreateMissingImages: false,
2734
}
28-
},
29-
env: {
30-
pluginVisualRegressionImagesPath : `{spec_path}/__image_snapshots__/${SITE_STRING}`,
31-
pluginVisualRegressionMaxDiffThreshold: 0,
32-
pluginVisualRegressionUpdateImages: UPDATE_BASELINE,
33-
}
3435
});

docker-entrypoint-vrt.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
22

33
yarn install --frozen-lockfile
4-
yarn cypress run --component --browser chrome
4+
yarn cypress run --component --browser chrome "$@"

vrt-in-docker.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import subprocess
33
import argparse
44

5-
def run(site: str, update_baselines: bool):
5+
def run(site: str, update_baselines: bool, cypress_args):
66
subprocess.run([
77
"docker",
88
"run",
@@ -24,7 +24,8 @@ def run(site: str, update_baselines: bool):
2424
"-e", "CYPRESS_INTERNAL_BROWSER_CONNECT_TIMEOUT=300000",
2525
"-e", "CYPRESS_CACHE_FOLDER=/tests/.cache/Cypress",
2626
"cypress/browsers:node-20.14.0-chrome-125.0.6422.141-1-ff-126.0.1-edge-125.0.2535.85-1",
27-
"/tests/docker-entrypoint-vrt.sh"
27+
"/tests/docker-entrypoint-vrt.sh",
28+
*cypress_args
2829
])
2930

3031
if __name__ == "__main__":
@@ -36,5 +37,5 @@ def run(site: str, update_baselines: bool):
3637
help="If provided, the run's results will become the new baselines for you to include in your commit.",
3738
)
3839

39-
args = parser.parse_args()
40-
run(site=args.site, update_baselines=args.update_baselines)
40+
args, unknown = parser.parse_known_args()
41+
run(site=args.site, update_baselines=args.update_baselines, cypress_args=unknown)

0 commit comments

Comments
 (0)