Skip to content

Commit

Permalink
chore: make the CI more stable on deployments (#532)
Browse files Browse the repository at this point in the history
* chore: make the CI more stable on deployments

* test: remove counter test

The counter test was fixed #492 which requires you to delete the product rather
than reducing the quantity to 0.

* fix: Update visual regression baseline images

---------

Co-authored-by: Anudeep Vattipalli <[email protected]>
  • Loading branch information
chanceaclark and avattipalli authored Feb 12, 2024
1 parent 998f8cd commit 06c4fe6
Show file tree
Hide file tree
Showing 50 changed files with 101 additions and 99 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
name: Lighthouse Report

on:
deployment_status
deployment_status:
states: ['success']

jobs:
generate_lighthouse_audit:
name: Deployment Audit
timeout-minutes: 30
runs-on: ubuntu-latest
if: ${{ github.event.deployment_status.state == 'success' && contains(github.event.deployment_status.target_url, 'catalyst-latest') }}
if: ${{ contains(fromJson('["Production – catalyst-latest", "Preview – catalyst-latest"]'), github.event.deployment_status.environment) }}

steps:
- name: Checkout code
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/playwright-ui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Playwright UI Tests

on:
deployment_status:
states: ['success']

jobs:
ui-tests:
name: Run UI Tests
timeout-minutes: 30
runs-on: ubuntu-latest
if: ${{ contains(fromJson('["Production – catalyst-latest", "Preview – catalyst-latest"]'), github.event.deployment_status.environment) }}

steps:
- name: Checkout code
uses: actions/checkout@main

- uses: pnpm/action-setup@v2

- name: Use Node.js
uses: actions/setup-node@main
with:
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Install Playwright Browsers
run: |
cd packages/functional
npx playwright install chromium
- name: Run Playwright tests
env:
PLAYWRIGHT_TEST_BASE_URL: ${{ github.event.deployment_status.target_url }}
VERCEL_PROTECTION_BYPASS: ${{ secrets.VERCEL_PROTECTION_BYPASS_CATALYST_LATEST }}
run: |
cd packages/functional
npx playwright test tests/ui/ --project=tests-chromium
- uses: actions/upload-artifact@v3
if: failure()
with:
name: playwright-report
path: packages/functional/playwright-report/
retention-days: 30
47 changes: 47 additions & 0 deletions .github/workflows/playwright-visual-regression.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Playwright Visual Regression Tests

on:
deployment_status:
states: ['success']

jobs:
visual-regression-tests:
name: Run Visual Regression Tests
timeout-minutes: 30
runs-on: ubuntu-latest
if: ${{ contains(fromJson('["Production – catalyst-storybook", "Preview – catalyst-storybook"]'), github.event.deployment_status.environment) }}

steps:
- name: Checkout code
uses: actions/checkout@main

- uses: pnpm/action-setup@v2

- name: Use Node.js
uses: actions/setup-node@main
with:
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Install Playwright Browsers
run: |
cd packages/functional
npx playwright install chromium
- name: Run Playwright tests
env:
PLAYWRIGHT_TEST_BASE_URL: ${{ github.event.deployment_status.target_url }}
VERCEL_PROTECTION_BYPASS: ${{ secrets.VERCEL_PROTECTION_BYPASS_STORYBOOK }}
run: |
cd packages/functional
npx playwright test tests/visual-regression/reactant/components/ --project=tests-chromium
- uses: actions/upload-artifact@v3
if: failure()
with:
name: playwright-report
path: packages/functional/playwright-report/
retention-days: 30
83 changes: 0 additions & 83 deletions .github/workflows/playwright.yml

This file was deleted.

4 changes: 4 additions & 0 deletions packages/functional/playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export default defineConfig({
screenshot: 'only-on-failure',
video: 'retain-on-failure',
trace: 'retain-on-failure',
extraHTTPHeaders: {
'x-vercel-protection-bypass': process.env.VERCEL_PROTECTION_BYPASS,
'x-vercel-set-bypass-cookie': process.env.CI ? 'true' : 'false',
},
},
projects: [
{
Expand Down
14 changes: 0 additions & 14 deletions packages/functional/tests/ui/core/components/Counter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,3 @@ test('Decrease count and verify the results', async ({ page }) => {

await expect(page.getByRole('spinbutton')).toHaveValue('1');
});

test('Decreasing the count to 0 should remove the product from cart', async ({ page }) => {
await ProductActions.addProductToCart(page, '[Sample] Orbit Terrarium - Large');
await page.getByRole('link', { name: 'your cart' }).click();

await expect(page.getByRole('spinbutton')).toHaveValue('1');

await page.getByLabel('Decrease count').click();

await expect(page.getByRole('spinbutton')).toHaveValue('0');
await expect(page.getByText('[Sample] Orbit Terrarium -')).toBeHidden({
timeout: 10000,
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 06c4fe6

Please sign in to comment.