Skip to content

Commit

Permalink
cypress in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
binrysearch committed Jul 7, 2024
1 parent 7b76616 commit 0b3f2e1
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 22 deletions.
18 changes: 0 additions & 18 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,15 @@ import { defineConfig } from "cypress";
import { configureVisualRegression } from "cypress-visual-regression";

module.exports = defineConfig({
viewportWidth: 1000,
viewportHeight: 660,
trashAssetsBeforeRuns: true,
env: {
failSilently: false,
},

e2e: {
screenshotsFolder: "./cypress/snapshots/actual",
supportFile: "./cypress/support/index.ts",
specPattern: "**/*.*cy.*",
setupNodeEvents(on, config) {
on("before:browser:launch", (browser, launchOptions) => {
// https://on.cypress.io/browser-launch-api

// the browser width and height we want to get
if (browser.family === 'chromium' && browser.name !== 'electron') {
launchOptions.args.push('--force-device-scale-factor=1')

launchOptions.args.push("--window-size=1000,660");
launchOptions.args.push("--force-color-profile=srgb");
launchOptions.args.push("--font-render-hinting=none");
}

return launchOptions;
});

configureVisualRegression(on);

return config;
Expand Down
4 changes: 2 additions & 2 deletions cypress/setup/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
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
Expand Down Expand Up @@ -178,6 +178,6 @@ <h2 data-intro="fourth header step" data-hint="secondary header">
console.log(3);
};
</script>
<script type="text/javascript" src="http://localhost:10001/dist/intro.js"></script>
<script type="text/javascript" src="http://host.docker.internal:10001/dist/intro.js"></script>
</body>
</html>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@
"test:watch": "jest --watch",
"test:jest": "jest --coverage --silent --ci --coverage --coverageReporters=\"text\" --coverageReporters=\"text-summary\"",
"test:jshint": "jshint ./src --verbose && jshint ./tests --verbose",
"test:cypress": "start-server-and-test dev http://localhost:10001/dist/intro.js 'cypress run --env type=regression'",
"test:cypress": "start-server-and-test dev http://localhost:10001/dist/intro.js 'docker run -it -v $PWD:/e2e -w /e2e --entrypoint=cypress cypress/included run --env type=regression'",
"release": "./bin/release.sh || true",
"prebuild": "rimraf ./dist",
"build": "rollup -c",
"build:watch": "rollup -c -w",
"dev": "npm run build:watch -- --configPlugin serve",
"cypress": "start-server-and-test dev http://localhost:10001/dist/intro.js 'cypress open --env type=regression'"
},
"devDependencies": {
"@babel/core": "^7.12.3",
Expand Down

0 comments on commit 0b3f2e1

Please sign in to comment.