diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b3f88bc..37a8672 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,31 +3,34 @@ name: Tests on: pull_request jobs: - wait_deploy: - name: Wait Vercel Deploy - runs-on: ubuntu-latest - outputs: - preview_url: ${{ steps.waitForVercelPreviewDeployment.outputs.url }} - steps: - - name: Wait for Vercel preview deployment to be ready - uses: patrickedqvist/wait-for-vercel-preview@master - id: waitForVercelPreviewDeployment - with: - token: ${{ secrets.GITHUB_TOKEN }} - max_timeout: 120 - test_e2e: name: Run Cypress - needs: wait_deploy runs-on: ubuntu-16.04 steps: - uses: actions/checkout@v2 - - name: Run Cypress - uses: cypress-io/github-action@v1 + + - name: Use Node.js 12 + uses: actions/setup-node@v1 with: - config: baseUrl=${{ needs.wait_deploy.outputs.preview_url }} - wait-on: ${{ needs.wait_deploy.outputs.preview_url }} - wait-on-timeout: 120 + node-version: "12" + + - name: Install dependencies + uses: bahmutov/npm-install@v1 + + - name: Cache Next.js build cache + uses: actions/cache@v2 + with: + path: ${{ github.workspace }}/.next/cache + key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }} + + - name: Build static assets + run: yarn build + + - name: Run Cypress + uses: cypress-io/github-action@v2 + with: + start: npm start + wait-on: http://localhost:3000 # after the test run completes # store videos and any screenshots # NOTE: screenshots will be generated only if E2E test failed diff --git a/cypress/integration/drag-and-drop.spec.js b/cypress/integration/drag-and-drop.spec.js index 5a0174a..da943fa 100644 --- a/cypress/integration/drag-and-drop.spec.js +++ b/cypress/integration/drag-and-drop.spec.js @@ -5,14 +5,14 @@ describe('Drag & Drop', () => { beforeEach(() => { cy.viewport(1280, 720) cy.visit('/') - cy.wait(200) + cy.wait(250) }) function dropFile(fixture) { cy.get('[data-cy="drag-and-drop"]').attachFile(fixture, { subjectType: 'drag-n-drop', }) - cy.wait(20) + cy.wait(50) } it('Drop 310x310 PNG file', () => { diff --git a/cypress/integration/sample.spec.js b/cypress/integration/sample.spec.js deleted file mode 100644 index d56aeb2..0000000 --- a/cypress/integration/sample.spec.js +++ /dev/null @@ -1,7 +0,0 @@ -/// - -describe('My First Test', () => { - it('Visits the Favycon', () => { - cy.visit('/') - }) -}) diff --git a/package.json b/package.json index c770c01..13162e2 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "babel-plugin-prismjs": "2.0.1", "babel-preset-react-app": "9.1.2", "commitizen": "4.2.1", - "cypress": "5.1.0", + "cypress": "5.2.0", "cypress-file-upload": "4.1.1", "cz-conventional-changelog": "3.3.0", "dotenv": "8.2.0", @@ -116,12 +116,12 @@ "eslint-plugin-react": "7.20.6", "eslint-plugin-react-hooks": "4.1.2", "husky": "4.3.0", - "lint-staged": "10.3.0", + "lint-staged": "10.4.0", "npm-run-all": "4.1.5", "postcss-100vh-fix": "0.1.1", "postcss-flexbugs-fixes": "4.2.1", "postcss-preset-env": "6.7.0", - "prettier": "2.1.1", + "prettier": "2.1.2", "react-refresh": "0.8.3", "regenerator-runtime": "0.13.7", "sass": "1.26.10", diff --git a/yarn.lock b/yarn.lock index 1cad7e5..75ad181 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6534,10 +6534,10 @@ cypress-file-upload@4.1.1: dependencies: mime "^2.4.4" -cypress@5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/cypress/-/cypress-5.1.0.tgz#979e9ff3e0acd792eefd365bf104046479a9643b" - integrity sha512-craPRO+Viu4268s7eBvX5VJW8aBYcAQT+EwEccQSMY+eH1ZPwnxIgyDlmMWvxLVX9SkWxOlZbEycPyzanQScBQ== +cypress@5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-5.2.0.tgz#6902efd90703242a2539f0623c6e1118aff01f95" + integrity sha512-9S2spcrpIXrQ+CQIKHsjRoLQyRc2ehB06clJXPXXp1zyOL/uZMM3Qc20ipNki4CcNwY0nBTQZffPbRpODeGYQg== dependencies: "@cypress/listr-verbose-renderer" "^0.4.1" "@cypress/request" "^2.88.5" @@ -10375,10 +10375,10 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= -lint-staged@10.3.0: - version "10.3.0" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-10.3.0.tgz#388c3d440590c45c339e7163f669ea69ae90b1e0" - integrity sha512-an3VgjHqmJk0TORB/sdQl0CTkRg4E5ybYCXTTCSJ5h9jFwZbcgKIx5oVma5e7wp/uKt17s1QYFmYqT9MGVosGw== +lint-staged@10.4.0: + version "10.4.0" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-10.4.0.tgz#d18628f737328e0bbbf87d183f4020930e9a984e" + integrity sha512-uaiX4U5yERUSiIEQc329vhCTDDwUcSvKdRLsNomkYLRzijk3v8V9GWm2Nz0RMVB87VcuzLvtgy6OsjoH++QHIg== dependencies: chalk "^4.1.0" cli-truncate "^2.1.0" @@ -13255,10 +13255,10 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.1.1.tgz#d9485dd5e499daa6cb547023b87a6cf51bee37d6" - integrity sha512-9bY+5ZWCfqj3ghYBLxApy2zf6m+NJo5GzmLTpr9FsApsfjriNnS2dahWReHMi7qNPhhHl9SYHJs2cHZLgexNIw== +prettier@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.1.2.tgz#3050700dae2e4c8b67c4c3f666cdb8af405e1ce5" + integrity sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg== prettier@^1.16.4: version "1.19.1"