Skip to content

Commit 3741bca

Browse files
authored
Merge pull request #328 from shairez/pr-cypress-ci
2 parents 975db81 + 92ce48e commit 3741bca

File tree

12 files changed

+257
-26
lines changed

12 files changed

+257
-26
lines changed

.github/actions/test/action.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,19 @@ runs:
3030
shell: bash
3131
run: npx nx build-storybook headless
3232

33-
- name: Publish to Chromatic
34-
uses: chromaui/action@v1
35-
# Chromatic GitHub Action options
33+
- name: Run Cypress component tests
34+
uses: cypress-io/github-action@v5
3635
with:
37-
# 👇 Chromatic projectToken, refer to the manage page to obtain it.
38-
projectToken: ${{ inputs.chromatic_token }}
39-
storybookBuildDir: dist/storybook/headless
40-
zip: true
36+
command: 'pnpm test:headless:ci'
37+
38+
# - name: Publish to Chromatic
39+
# uses: chromaui/action@v1
40+
# # Chromatic GitHub Action options
41+
# with:
42+
# # 👇 Chromatic projectToken, refer to the manage page to obtain it.
43+
# projectToken: ${{ inputs.chromatic_token }}
44+
# storybookBuildDir: dist/storybook/headless
45+
# zip: true
4146

4247
# - name: Build Tailwind Theme
4348
# shell: bash

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,7 @@ Thumbs.db
6767

6868
# Storybook
6969
**/storybook-static/*
70+
71+
# Cypress
72+
**/cypress/screenshots
73+
**/cypress/videos

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"commit": "git-cz",
1212
"format:fix": "pretty-quick --staged",
1313
"prepare": "husky install",
14-
"test:headless": "nx component-test headless --watch",
14+
"test:headless": "nx component-test headless",
15+
"test:headless:ci": "nx component-test-ci headless",
1516
"story:build:headless": "nx build-storybook headless",
1617
"story:headless": "nx storybook headless",
1718
"website": "nx serve website"
@@ -25,6 +26,7 @@
2526
"@cypress/code-coverage": "3.10.0",
2627
"@cypress/vite-dev-server": "^2.2.1",
2728
"@floating-ui/dom": "1.0.10",
29+
"@frsource/cypress-plugin-visual-regression-diff": "3.3.5",
2830
"@jscutlery/semver": "^2.30.1",
2931
"@k11r/nx-cloudflare-wrangler": "^2.0.0",
3032
"@nx/cypress": "16.0.3",
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
import { defineConfig } from 'cypress';
2+
import { initPlugin } from '@frsource/cypress-plugin-visual-regression-diff/plugins';
23

34
export default defineConfig({
45
component: {
56
specPattern: '**/*.spec.{js,jsx,ts,tsx}',
7+
screenshotOnRunFailure: true,
8+
video: false,
69
devServer: {
710
framework: 'cypress-ct-qwik',
811
bundler: 'vite',
912
} as any,
13+
setupNodeEvents(on, config) {
14+
initPlugin(on, config);
15+
},
1016
},
1117
});

packages/kit-headless/cypress/support/component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// You can read more here:
1313
// https://on.cypress.io/configuration
1414
// ***********************************************************
15-
15+
import '@frsource/cypress-plugin-visual-regression-diff';
1616
import { addQwikLoader, mount } from 'cypress-ct-qwik';
1717

1818
addQwikLoader();

packages/kit-headless/project.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,21 @@
105105
"executor": "@nx/cypress:cypress",
106106
"options": {
107107
"cypressConfig": "packages/kit-headless/cypress.config.ts",
108-
"testingType": "component"
108+
"testingType": "component",
109+
"watch": true,
110+
"env": {
111+
"pluginVisualRegressionCleanupUnusedImages": false
112+
}
113+
}
114+
},
115+
"component-test-ci": {
116+
"executor": "@nx/cypress:cypress",
117+
"options": {
118+
"cypressConfig": "packages/kit-headless/cypress.config.ts",
119+
"testingType": "component",
120+
"env": {
121+
"pluginVisualRegressionCleanupUnusedImages": false
122+
}
109123
}
110124
}
111125
},
1.6 KB
Loading
2.29 KB
Loading
1.52 KB
Loading
1.52 KB
Loading

0 commit comments

Comments
 (0)