Skip to content

Instantly share code, notes, and snippets.

@TClark1011
Last active February 7, 2022 01:24
Show Gist options
  • Select an option

  • Save TClark1011/fcec01d5820a38aa3ad2b428db45031e to your computer and use it in GitHub Desktop.

Select an option

Save TClark1011/fcec01d5820a38aa3ad2b428db45031e to your computer and use it in GitHub Desktop.
Bag of Holding V2 Cypress Setup
  1. Run yarn add cypress --dev
  2. Add cypress.json to root
  3. Run yarn run cypress open.
  4. Close the window
  5. Rename cypress/plugins/index.js to index.cjs
  6. Create a new tsconfig.json inside the cypress folder and copy the contents from this gist
  7. Add the following to your .gitignore:
cypress/videos
cypress/screenshots
  1. Add the following to the scripts in package.json:
"test:integration":"yarn dev & cypress run",
  1. Change the current package.json test script to be named test:unit
  2. Replace the contents of the check.yaml github workflow with the one in this gist
name: check
on: pull_request
jobs:
test-and-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- run: yarn
- uses: mattallty/jest-github-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
test-command: "yarn test:unit"
- run: yarn test:integration
- uses: actions/upload-artifact@v2
with:
name: integration-test-artifacts
path: |
cypress/screenshots
cypress/videos
- run: yarn build
{
"baseUrl": "http://localhost:3000/"
}
{
"extends": "../tsconfig.json",
"compilerOptions": {
"noEmit": true,
// be explicit about types included
// to avoid clashing with Jest types
"types": ["cypress"],
"isolatedModules": true
},
"include": ["../node_modules/cypress", "./**/*.ts"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment