diff --git a/.github/workflows/browserstack.yml b/.github/workflows/browserstack.yml deleted file mode 100644 index e91966c8..00000000 --- a/.github/workflows/browserstack.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Browserstack - -on: - merge_group: - workflow_dispatch: - pull_request: - types: - - opened - - synchronize - push: - branches: - - main - -permissions: - contents: read - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} - -env: - NODE_VERSION: 22 - CACHE_KEY: '${{ github.event.pull_request.head.sha || github.ref }}-${{ github.run_id }}-${{ github.run_attempt }}' - -jobs: - browserstack: - name: BrowserStack Tests - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v6 - with: - ref: ${{ github.event.pull_request.head.sha || github.ref }} - - - name: Build package - uses: ./.github/actions/build - with: - node: ${{ env.NODE_VERSION }} - - - name: Run tests - shell: bash - run: npx concurrently --kill-others --success first 'npm run start:local:oidc' 'npx wait-on tcp:127.0.0.1:3000 && npm run start:local:playground' 'npx wait-on tcp:127.0.0.1:4200 && npx browserstack-cypress-cli run --build-name ${{ github.ref }}-${{ github.sha }}' - env: - BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} - BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} diff --git a/.github/workflows/cross-browser.yml b/.github/workflows/cross-browser.yml new file mode 100644 index 00000000..ed8b746a --- /dev/null +++ b/.github/workflows/cross-browser.yml @@ -0,0 +1,96 @@ +name: Cross-Browser Tests + +on: + merge_group: + workflow_dispatch: + pull_request: + types: + - opened + - synchronize + push: + branches: + - main + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +env: + NODE_VERSION: 22 + +jobs: + build: + name: Build Package + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v6 + with: + ref: ${{ github.event.pull_request.head.sha || github.ref }} + + - name: Build package + uses: ./.github/actions/build + with: + node: ${{ env.NODE_VERSION }} + + - name: Upload build artifacts + uses: actions/upload-artifact@v7 + with: + name: dist-${{ github.run_id }} + path: dist + retention-days: 1 + + cross-browser: + needs: build + name: ${{ matrix.browser }} + runs-on: ${{ matrix.os }} + timeout-minutes: 25 + + strategy: + fail-fast: false + matrix: + os: [windows-latest] + browser: [chrome, edge, firefox] + + steps: + - name: Checkout code + uses: actions/checkout@v6 + with: + ref: ${{ github.event.pull_request.head.sha || github.ref }} + + - name: Download build artifacts + uses: actions/download-artifact@v8 + with: + name: dist-${{ github.run_id }} + path: dist + + - name: Setup Node + uses: actions/setup-node@v6 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Install dependencies + run: npm i + + - name: Run cross-browser tests + uses: cypress-io/github-action@v7 + with: + browser: ${{ matrix.browser }} + start: npm run start:local + wait-on: 'http://127.0.0.1:4200' + spec: projects/playground/e2e/integration/playground.cy.ts + config-file: cypress.config.js + install-command: npx cypress install + + - name: Upload Cypress screenshots + if: failure() + uses: actions/upload-artifact@v7 + with: + name: cypress-screenshots-${{ matrix.browser }}-${{ github.run_id }} + path: projects/playground/e2e/screenshots + retention-days: 30 + if-no-files-found: ignore diff --git a/browserstack.json b/browserstack.json deleted file mode 100644 index 9ebc0c99..00000000 --- a/browserstack.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "browsers": [ - { - "browser": "chrome", - "os": "Windows 10", - "versions": ["latest"] - }, - { - "browser": "firefox", - "os": "Windows 10", - "versions": ["latest"] - }, - { - "browser": "edge", - "os": "Windows 10", - "versions": ["latest"] - } - ], - "run_settings": { - "cypress_config_file": "./cypress.json", - "cypress-version": "9", - "project_name": "Auth0 Angular SDK", - "exclude": [], - "parallels": "5", - "npm_dependencies": { - "typescript": "~4.2.4", - "qss": "2.0.3" - }, - "package_config_options": {}, - "headless": true - }, - "connection_settings": { - "local": true, - "local_mode": "always-on" - }, - "disable_usage_reporting": false -} diff --git a/cypress.config.js b/cypress.config.js new file mode 100644 index 00000000..2c0a9f17 --- /dev/null +++ b/cypress.config.js @@ -0,0 +1,18 @@ +const { defineConfig } = require('cypress'); + +module.exports = defineConfig({ + e2e: { + baseUrl: 'http://127.0.0.1:4200', + specPattern: 'projects/playground/e2e/integration/**/*.cy.ts', + screenshotsFolder: 'projects/playground/e2e/screenshots', + videosFolder: 'projects/playground/e2e/videos', + supportFile: false, + chromeWebSecurity: false, + viewportWidth: 1000, + viewportHeight: 1000, + reporter: 'junit', + reporterOptions: { + mochaFile: 'projects/playground/test-results/e2e/junit-[hash].xml', + }, + }, +}); diff --git a/cypress.json b/cypress.json deleted file mode 100644 index 57c6d210..00000000 --- a/cypress.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "baseUrl": "http://127.0.0.1:4200", - "chromeWebSecurity": false, - "viewportWidth": 1000, - "viewportHeight": 1000, - "fixturesFolder": false, - "pluginsFile": false, - "supportFile": false, - "reporter": "junit", - "reporterOptions": { - "mochaFile": "projects/playground/test-results/e2e/junit-[hash].xml" - }, - "fileServerFolder": "projects/playground", - "integrationFolder": "projects/playground/e2e/integration", - "pluginFolder": "projects/playground/e2e/plugins", - "screenshotsFolder": "projects/playground/e2e/screenshots", - "videosFolder": "projects/playground/e2e/videos" -} diff --git a/package.json b/package.json index 4ae10dc8..e8720446 100644 --- a/package.json +++ b/package.json @@ -54,11 +54,10 @@ "@types/node": "^22.19.17", "@typescript-eslint/eslint-plugin": "^8.59.1", "@typescript-eslint/parser": "^8.59.0", - "browserstack-cypress-cli": "^1.36.5", "concurrently": "^6.2.0", "cors": "^2.8.6", "cross-fetch": "^4.1.0", - "cypress": "^13.17.0", + "cypress": "^14.5.4", "eslint": "^8.57.0", "eslint-plugin-import": "latest", "eslint-plugin-jsdoc": "latest",