Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,3 @@ jobs:
name: image diff output directory
path: gatsby/cypress/snapshots/diff
if: failure()
lighthouse_audit:
runs-on: ubuntu-latest
steps:
- name: checkout ${{ env.GITHUB_REF }}
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- env:
CONTENTFUL_SPACE_ID: ${{ secrets.CONTENTFUL_SPACE_ID }}
CONTENTFUL_ACCESS_TOKEN: ${{ secrets.CONTENTFUL_ACCESS_TOKEN }}
run: cd gatsby && npm ci && npm run cy:install && npm run audit:ci
7 changes: 4 additions & 3 deletions gatsby/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from "cypress"
import { configureVisualRegression } from 'cypress-visual-regression'
import getCompareSnapshotsPlugin from 'cypress-visual-regression/dist/plugin'
import { pa11y, lighthouse, prepareAudit } from '@appsfactory/cypress-audit'
import cypressTerminalReport from 'cypress-terminal-report/src/installLogsPrinter'
import path from 'path'
Expand All @@ -8,7 +8,7 @@ import fs from 'fs'
export default defineConfig({
env: {
screenshotsFolder: './cypress/snapshots/actual',
type: 'regression',
type: 'actual',
trashAssetsBeforeRuns: true,
failSilently: false,
video: false
Expand All @@ -18,7 +18,8 @@ export default defineConfig({
baseUrl: "http://localhost:8000",
specPattern: ["cypress/e2e/**/*.cy.js", "cypress/audit/**/*.cy.js"],
setupNodeEvents(on, config) {
configureVisualRegression(on)
// implement node event listeners here
getCompareSnapshotsPlugin(on, config)
cypressTerminalReport(on)
on('before:browser:launch', (browser = {}, launchOptions) => {
prepareAudit(launchOptions)
Expand Down
13 changes: 7 additions & 6 deletions gatsby/cypress/bin/compare_images
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,24 @@ if [[ $1 == "--clear" ]]; then
rm -rfv $dir_diff $dir_actual
rm -rfv "cypress/snapshots/base/*.png"
exit 0

# Loop through each file and open the corresponding images with feh
elif [ -d $dir_diff ]; then
echo "diff folder exists"
elif [ -d $dir_base ]; then
#echo "base folder exists"
# Get the list of files in the first directory (assuming all directories have the same filenames)
files=$(ls "$dir_diff")
echo "found in diff folder: $files"
files=$(ls "$dir_base")
echo "found in base folder: $files"
for file in $files; do
# Construct the full paths for each image
img_diff="$dir_diff$file"
img_base="$dir_base$file"
img_actual="$dir_actual$file"

# Check if the files exist in all directories
if [[ -f "$img_diff" && -f "$img_base" && -f "$img_actual" ]]; then
#if [[ -f "$img_diff" && -f "$img_base" && -f "$img_actual" ]]; then
# Use feh to display the images
feh -F "$img_diff" "$img_base" "$img_actual"
fi
#fi

# Options
read -p "update base image? y/[n]/q: " UPDATE
Expand Down
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.
5 changes: 3 additions & 2 deletions gatsby/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@
// }
// }
// }
import { addCompareSnapshotCommand } from 'cypress-visual-regression/dist/command'
addCompareSnapshotCommand()
import compareSnapshotCommand from 'cypress-visual-regression/dist/command'

compareSnapshotCommand()

//Cypress.on('viewport:changed', (viewport) => {
// Cypress.config('viewportWidth', viewport.width)
Expand Down
2 changes: 1 addition & 1 deletion gatsby/cypress/support/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ export function isDesktopMenuOnMobile(device, orientation) {
return orientation === 'landscape' && ['iphone-xr'].includes(device)
}

export const errorThreshold = 0.01
export const errorThreshold = 0.0
Loading