Skip to content

Commit

Permalink
ci setup
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-bompart committed May 30, 2024
1 parent 7a739b5 commit 4fa4961
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 79 deletions.
18 changes: 18 additions & 0 deletions .github/actions/playwright-atomic/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'Playwright Atomic'
description: 'Run Playwright tests for Atomic'
runs:
using: composite
steps:
- name: Install Playwright Browsers
run: npx playwright install --with-deps
shell: bash
- name: Run Playwright tests
run: npx playwright test
working-directory: packages/atomic
shell: bash
- uses: actions/upload-artifact@v4
if: always()
with:
name: atomic-playwright-report
path: packages/atomic/playwright-report/
retention-days: 30
1 change: 1 addition & 0 deletions .github/actions/publish-pr-review-site/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ runs:
if: ${{inputs.copy}}
run: |
cp -R packages/atomic/dist-storybook prs/${{github.event.pull_request.number}}
cp -R packages/atomic/playwright-report prs/${{github.event.pull_request.number}}
shell: bash
- name: 'Commit/Push'
run: |
Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/playwright.yml

This file was deleted.

20 changes: 15 additions & 5 deletions .github/workflows/prbot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ jobs:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- uses: ./.github/actions/build
- uses: ./.github/actions/commit-generated-files
- uses: ./.github/actions/publish-pr-review-site
if: github.event_name == 'pull_request'
with:
token: ${{ secrets.GH_PUBLISH_TOKEN }}
copy: true
lint-check:
name: 'Check with linter'
needs: build
Expand All @@ -58,6 +53,19 @@ jobs:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- uses: ./.github/actions/setup
- uses: ./.github/actions/e2e-atomic-csp
playwright-atomic:
name: 'Run Playwright tests for Atomic'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- uses: ./.github/actions/setup
- uses: ./.github/actions/playwright-atomic
- uses: ./.github/actions/publish-pr-review-site
if: ${{ always() && github.event_name == 'pull_request'}}
with:
token: ${{ secrets.GH_PUBLISH_TOKEN }}
copy: true
e2e-atomic-test:
name: 'Run e2e tests on Atomic'
needs: build
Expand Down Expand Up @@ -268,6 +276,7 @@ jobs:
- 'build'
- 'lint-check'
- 'unit-test'
- 'playwright-atomic'
- 'e2e-atomic-test'
- 'e2e-atomic-csp-test'
- 'e2e-quantic'
Expand Down Expand Up @@ -302,6 +311,7 @@ jobs:
- 'build'
- 'lint-check'
- 'unit-test'
- 'playwright-atomic'
- 'e2e-atomic-test'
- 'e2e-atomic-screenshots'
- 'e2e-atomic-react-test'
Expand Down
49 changes: 4 additions & 45 deletions packages/atomic/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,23 @@
import {defineConfig, devices} from '@playwright/test';

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();

const DEFAULT_DESKTOP_VIEWPORT = {
width: 1920,
height: 1080,
};

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './src',
testMatch: '*.e2e.ts',
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
reporter: process.env.CI
? [['html'], ['list'], ['github']]
: [['html'], ['list']],
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
trace: 'retain-on-failure',
},

/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
Expand All @@ -45,36 +26,14 @@ export default defineConfig({
viewport: DEFAULT_DESKTOP_VIEWPORT,
},
},

{
name: 'firefox',
use: {...devices['Desktop Firefox'], viewport: DEFAULT_DESKTOP_VIEWPORT},
},

{
name: 'webkit',
use: {...devices['Desktop Safari'], viewport: DEFAULT_DESKTOP_VIEWPORT},
},

/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },

/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// },
],
expect: {
timeout: 20 * 1000,
Expand Down
1 change: 1 addition & 0 deletions scripts/reports/live-examples/live-examples.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export const buildLiveExampleReport = async () =>
[
'## Live demo links',
`* [Storybook](https://coveo.github.io/ui-kit-prs/${context.payload.pull_request.number}/dist-storybook/)`,
`* [Playwright report](https://coveo.github.io/ui-kit-prs/${context.payload.pull_request.number}/playwright-report/)`,
].join('\n\n');

0 comments on commit 4fa4961

Please sign in to comment.