From 63970ed18e206d4a78b8c98cfca364b012e8feca Mon Sep 17 00:00:00 2001 From: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com> Date: Mon, 23 Oct 2023 17:58:18 +0100 Subject: [PATCH] GH Actions: Cypress test on Windows Edge and Mac WebKit --- .github/workflows/main.yml | 42 ++++++++++++++++++------------- cypress.config.js | 1 + tests/e2e/specs/userprofile.cy.js | 2 +- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 89d83c69a..0b31e6753 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,6 +16,7 @@ env: jobs: unit-test-and-build: runs-on: ubuntu-latest + timeout-minutes: 5 steps: - name: Checkout uses: actions/checkout@v4 @@ -52,16 +53,18 @@ jobs: cypress-run: runs-on: ${{ matrix.os }} + timeout-minutes: 15 strategy: fail-fast: false matrix: - type: [e2e, component] - browser: [firefox, chrome] os: [ubuntu-latest] -# TODO: re-enable once macos build is stable #590 -# include: -# - os: macos-latest -# browser: edge + browser: [firefox, chrome] + include: + - os: macos-latest + browser: webkit + - os: windows-latest + browser: edge + env: COVERAGE: true steps: @@ -74,36 +77,41 @@ jobs: node-version: 'lts/*' cache: yarn - - name: Test (E2E) - if: matrix.type == 'e2e' + - name: Install WebKit support + if: matrix.browser == 'webkit' + run: yarn add playwright-webkit --dev --mode=update-lockfile + + - name: Component test + # Component tests on webkit hang for some reason + if: matrix.browser != 'webkit' + uses: cypress-io/github-action@v6 + with: + component: true + browser: ${{ matrix.browser }} + + - name: E2E test uses: cypress-io/github-action@v6 env: BASE_URL: http://localhost:4173/ with: + install: ${{ matrix.browser == 'webkit' }} # Only install if not done in previous step build: yarn run build --mode offline start: yarn run preview config: baseUrl=${{ env.BASE_URL }} wait-on: ${{ env.BASE_URL }} browser: ${{ matrix.browser }} - - name: Test (component) - if: matrix.type == 'component' - uses: cypress-io/github-action@v6 - with: - component: true - browser: ${{ matrix.browser }} - - name: Upload screenshots uses: actions/upload-artifact@v4 if: failure() with: - name: 'cypress-screenshots_${{ matrix.type }}_${{ matrix.browser }}_${{ matrix.os }}' + name: 'cypress-screenshots_${{ matrix.browser }}_${{ matrix.os }}' path: tests/e2e/screenshots - name: Upload coverage artifact uses: actions/upload-artifact@v4 with: - name: 'coverage_${{ matrix.type }}_${{ matrix.browser }}_${{ matrix.os }}' + name: 'coverage_cypress_${{ matrix.browser }}_${{ matrix.os }}' path: coverage/lcov.info retention-days: 4 diff --git a/cypress.config.js b/cypress.config.js index d09185c4a..3f053d593 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -64,4 +64,5 @@ module.exports = defineConfig({ }, morgan: false, // Disable XHR logging as it's very noisy + experimentalWebKitSupport: true, }) diff --git a/tests/e2e/specs/userprofile.cy.js b/tests/e2e/specs/userprofile.cy.js index 7ab8085d6..09c31ea83 100644 --- a/tests/e2e/specs/userprofile.cy.js +++ b/tests/e2e/specs/userprofile.cy.js @@ -158,7 +158,7 @@ describe('User Profile', () => { .get('.node-data-cycle') .then(($els) => { expect( - Array.from($els, (el) => el.innerText) + Array.from($els, (el) => el.innerText.trim()) ).to.deep.equal(expected) }) }