Skip to content

Commit

Permalink
Maintenance: Move cypress folder to the new .dev directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
mgruner committed May 17, 2024
1 parent 05e949d commit 3c6c126
Show file tree
Hide file tree
Showing 26 changed files with 43 additions and 43 deletions.
8 changes: 0 additions & 8 deletions .cypress/visual-regression/snapshots.sh

This file was deleted.

20 changes: 10 additions & 10 deletions .cypress/cypress.config.mjs → .dev/cypress/cypress.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ import { rm } from 'node:fs/promises'
import { resolve, dirname } from 'node:path'
import { fileURLToPath } from 'node:url'
import { initPlugin as initVisualRegressionPlugin } from '@frsource/cypress-plugin-visual-regression-diff/plugins'
import pkg from '../package.json' with { type: 'json' }
import pkg from '../../package.json' with { type: 'json' }

const dir = dirname(fileURLToPath(import.meta.url))

const isCYCI = !process.env.CY_OPEN
const root = resolve(dir, '..')
const root = resolve(dir, '../..')

// we don't need to optimize graphql and apollo
const skipDeps = ['graphql', 'apollo', '@tiptap/pm']

export default defineConfig({
videosFolder: '.cypress/videos',
supportFolder: '.cypress/support/index.js',
fixturesFolder: '.cypress/fixtures',
downloadsFolder: '.cypress/downloads',
screenshotsFolder: '.cypress/screenshots',
videosFolder: '.dev/cypress/videos',
supportFolder: '.dev/cypress/support/index.js',
fixturesFolder: '.dev/cypress/fixtures',
downloadsFolder: '.dev/cypress/downloads',
screenshotsFolder: '.dev/cypress/screenshots',
videoCompression: false,
env: {
CY_CI: isCYCI,
Expand All @@ -28,7 +28,7 @@ export default defineConfig({
pluginVisualRegressionMaxDiffThreshold: 0.02,
},
component: {
supportFile: '.cypress/support/index.js',
supportFile: '.dev/cypress/support/index.js',
setupNodeEvents(on, config) {
on('after:spec', (spec, results) => {
if (results && results.stats.failures === 0 && results.video) {
Expand All @@ -49,7 +49,7 @@ export default defineConfig({
viteConfig: {
mode: 'cypress',
root,
configFile: resolve(dir, '..', 'vite.config.mjs'),
configFile: resolve(dir, '../..', 'vite.config.mjs'),
cacheDir: resolve(dir, 'node_modules', '.vite'),
server: {
fs: {
Expand Down Expand Up @@ -77,7 +77,7 @@ export default defineConfig({
viewportWidth: 390,
viewportHeight: 844,
fileServerFolder: '..',
indexHtmlFile: '.cypress/support/component-index.html',
indexHtmlFile: '.dev/cypress/support/component-index.html',
specPattern: ['app/frontend/cypress/**/*.cy.{js,jsx,ts,tsx}'],
},
retries: 0,
Expand Down
File renamed without changes.
File renamed without changes
8 changes: 4 additions & 4 deletions .cypress/package.json → .dev/cypress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"cypress-real-events": "^1.12.0"
},
"imports": {
"#tests/*": "../app/frontend/tests/*",
"#shared/*": "../app/frontend/shared/*",
"#mobile/*": "../app/frontend/apps/mobile/*",
"#desktop/*": "../app/frontend/apps/desktop/*",
"#tests/*": "../../app/frontend/tests/*",
"#shared/*": "../../app/frontend/shared/*",
"#mobile/*": "../../app/frontend/apps/mobile/*",
"#desktop/*": "../../app/frontend/apps/desktop/*",
"#cy/*": "./*"
}
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import './prepare.js'
import '#mobile/styles/main.css'
import '#shared/components/CommonIcon/injectIcons.ts'

import '../../public/assets/frontend/fonts.css'
import '../../../public/assets/frontend/fonts.css'

import './commands.js'

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ services:
image: cypress/base:latest
ipc: host
volumes:
- ../..:/app
- ../../..:/app
- visual-regression-dependencies-amd64:/app/node_modules
- ~/.cache/Cypress:/root/.cache/Cypress
working_dir: /app
ports:
- "8000:8000"
- "443:443"
command: bash ./.cypress/visual-regression/run.sh
command: bash ./.dev/cypress/visual-regression/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ services:
image: cypress/base:latest
ipc: host
volumes:
- ../..:/app
- ../../..:/app
- visual-regression-dependencies-arm:/app/node_modules
working_dir: /app
ports:
- "8000:8000"
- "443:443"
command: bash ./.cypress/visual-regression/run.sh
command: bash ./.dev/cypress/visual-regression/run.sh
File renamed without changes.
8 changes: 8 additions & 0 deletions .dev/cypress/visual-regression/snapshots.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

if [[ $(uname -m) == 'arm64' ]]; then
# cannot run cypress while on arm, but in amd container
docker compose -f .dev/cypress/visual-regression/docker-compose.arm.yml up --exit-code-from cypress
else
docker compose -f .dev/cypress/visual-regression/docker-compose.amd64.yml up --exit-code-from cypress
fi
File renamed without changes.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ yarn-error.log
.yarn/cache

# Cypress
.cypress/screenshots/*
.cypress/videos/*
.cypress/**/__diff_output__/**
.dev/cypress/screenshots/*
.dev/cypress/videos/*
.dev/cypress/**/__diff_output__/**
**/__image_snapshots__/**/*.diff.png
**/__image_snapshots__/**/*.actual.png

Expand Down
6 changes: 3 additions & 3 deletions .gitlab/ci/test/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ frontend:cypress:
when: on_failure
paths:
- app/frontend/cypress/**/__image_snapshots__/**/*
- .cypress/**/__diff_output__/*
- .cypress/videos/**/*
- .cypress/screenshots/**/*
- .dev/cypress/**/__diff_output__/*
- .dev/cypress/videos/**/*
- .dev/cypress/screenshots/**/*
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('resizing image within editor', () => {
.then(() => {
cy.findByTestId('editor-image-input').selectFile(
{
contents: '.cypress/fixtures/example.png',
contents: '.dev/cypress/fixtures/example.png',
fileName: 'file.png',
mimeType: 'image/png',
lastModified: Date.now(),
Expand Down
2 changes: 1 addition & 1 deletion app/frontend/cypress/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"compilerOptions": {
"types": ["cypress", "@testing-library/cypress", "cypress-real-events"]
},
"include": ["**/*.cy.ts", "**/cypress/**/*.ts", "**/.cypress/**/*"],
"include": ["**/*.cy.ts", "**/cypress/**/*.ts"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion app/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"#shared/*": "./shared/*",
"#mobile/*": "./apps/mobile/*",
"#desktop/*": "./apps/desktop/*",
"#cy/*": "../../.cypress/*"
"#cy/*": "../../.dev/cypress/*"
}
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"lint:css": "stylelint **/*.{css,vue,scss}",
"lint:css:fix": "stylelint **/*.{css,vue,scss} --fix",
"test": "VTL_SKIP_AUTO_CLEANUP=true TZ=utc vitest",
"test:ct": "CY_OPEN=true yarn --cwd ./.cypress cypress open --component --project ../ --config-file .cypress/cypress.config.mjs",
"test:ci:ct": "CI=true yarn --cwd ./.cypress cypress run --component --project ../ --config-file .cypress/cypress.config.mjs --browser electron",
"cypress:snapshots": "sh .cypress/visual-regression/snapshots.sh",
"cypress:install": "yarn --cwd ./.cypress install",
"test:ct": "CY_OPEN=true yarn --cwd ./.dev/cypress cypress open --component --project ../../ --config-file .dev/cypress/cypress.config.mjs",
"test:ci:ct": "CI=true yarn --cwd ./.dev/cypress cypress run --component --project ../../ --config-file .dev/cypress/cypress.config.mjs --browser electron",
"cypress:snapshots": "sh .dev/cypress/visual-regression/snapshots.sh",
"cypress:install": "yarn --cwd ./.dev/cypress install",
"analyse:vite-bundle": "npx vite-bundle-visualizer",
"generate:component": "cd .dev/hygen; npx hygen component new"
},
Expand Down
2 changes: 1 addition & 1 deletion script/build/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ rm app/assets/javascripts/app/controllers/layout_ref.coffee
rm -rf app/assets/javascripts/app/views/layout_ref/

# tests
rm -rf test spec app/frontend/tests app/frontend/cypress .cypress
rm -rf test spec app/frontend/tests app/frontend/cypress
find app/frontend/ -type d -name __tests__ -exec rm -rf {} +
rm .rspec

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"#desktop/*": ["app/frontend/apps/desktop/*"],
"#shared/*": ["app/frontend/shared/*"],
"#tests/*": ["app/frontend/tests/*"],
"#cy/*": [".cypress/*"]
"#cy/*": [".dev/cypress/*"]
},
"types": [
"vite/client",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"exclude": [
"app/frontend/cypress/**/*",
"**/*.cy.ts",
"**/.cypress/**/*",
"**/.dev/cypress/**/*",
"node_modules",
"public",
"vendor"
Expand Down

0 comments on commit 3c6c126

Please sign in to comment.