Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSUI-3539 add GitHub certifier #1992

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .deployment.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@
},
{
"system_certifier": "snyk-code"
},
{
"github": {
"name": "e2e-certifier",
"workflow_repository": "coveo/search-ui",
wmannard marked this conversation as resolved.
Show resolved Hide resolved
"workflow_file": "e2e-certifier.yml",
"extra_parameters": {
"JSUI_VERSION": "$[MAJOR_MINOR_VERSION].$[PATCH_VERSION]"
},
"required": false
}
}
]
},
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/e2e-certifier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ on:
description: The package name
job:
description: The name of the job (as defined in the deployment config)
JSUI_VERSION:
description: The version of JSUI to test

jobs:
test-job:
e2e-certifier:
runs-on: ubuntu-24.04
steps:
- name: Deploy JSUI beta version on Netlify
Expand All @@ -26,10 +28,14 @@ jobs:

- name: Install test dependencies
working-directory: ${{ github.workspace }}/playwright
run: |
npm install
npx playwright install --with-deps

run: npm install && npx playwright install --with-deps

- name: Validate JSUI version
working-directory: ${{ github.workspace }}/playwright
env:
JSUI_VERSION: ${{ inputs.JSUI_VERSION }}
run: npm run validate-jsui-version

- name: Run tests
working-directory: ${{ github.workspace }}/playwright
run: npx playwright test
run: npm test
24 changes: 24 additions & 0 deletions playwright/e2e/validateJsuiVersion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// This test is run in CI to validate that the JSUI version is the one expected.
import {test, expect} from '@playwright/test';
import {pageURL} from '../utils/utils';

const expectedJsuiVersion = process.env.JSUI_VERSION;
const timeout = 180_000;

if (expectedJsuiVersion) {
console.log(`Expected JSUI version: ${expectedJsuiVersion}`);

test('validate JSUI version', async ({page}) => {
test.setTimeout(timeout);
await expect(async () => {
await page.goto(pageURL());
const coveoVersion = await page.evaluate(() => (window as any).Coveo.version);
// Example value: {lib: '2.10120.0', product: '2.10120.0', supportedApiVersion: 2}
expect(coveoVersion.lib).toBe(expectedJsuiVersion);
expect(coveoVersion.product).toBe(expectedJsuiVersion);
wmannard marked this conversation as resolved.
Show resolved Hide resolved
}).toPass({timeout});

Check failure on line 19 in playwright/e2e/validateJsuiVersion.ts

View workflow job for this annotation

GitHub Actions / e2e-certifier

[validate-jsui-version] › validateJsuiVersion.ts:11:9 › validate JSUI version

1) [validate-jsui-version] › validateJsuiVersion.ts:11:9 › validate JSUI version ───────────────── Error: expect(received).toBe(expected) // Object.is equality Expected: "2.10120.1" Received: "2.10120.0" Call Log: - Test timeout of 180000ms exceeded 17 | expect(coveoVersion.lib).toBe(expectedJsuiVersion); 18 | expect(coveoVersion.product).toBe(expectedJsuiVersion); > 19 | }).toPass({timeout}); | ^ 20 | }); 21 | 22 | } else { at /home/runner/work/search-ui/search-ui/playwright/e2e/validateJsuiVersion.ts:19:12

Check failure on line 19 in playwright/e2e/validateJsuiVersion.ts

View workflow job for this annotation

GitHub Actions / e2e-certifier

[validate-jsui-version] › validateJsuiVersion.ts:11:9 › validate JSUI version

1) [validate-jsui-version] › validateJsuiVersion.ts:11:9 › validate JSUI version ───────────────── Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: expect(received).toBe(expected) // Object.is equality Expected: "2.10120.1" Received: "2.10120.0" Call Log: - Test timeout of 180000ms exceeded 17 | expect(coveoVersion.lib).toBe(expectedJsuiVersion); 18 | expect(coveoVersion.product).toBe(expectedJsuiVersion); > 19 | }).toPass({timeout}); | ^ 20 | }); 21 | 22 | } else { at /home/runner/work/search-ui/search-ui/playwright/e2e/validateJsuiVersion.ts:19:12

Check failure on line 19 in playwright/e2e/validateJsuiVersion.ts

View workflow job for this annotation

GitHub Actions / e2e-certifier

[validate-jsui-version] › validateJsuiVersion.ts:11:9 › validate JSUI version

1) [validate-jsui-version] › validateJsuiVersion.ts:11:9 › validate JSUI version ───────────────── Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: expect(received).toBe(expected) // Object.is equality Expected: "2.10120.1" Received: "2.10120.0" Call Log: - Test timeout of 180000ms exceeded 17 | expect(coveoVersion.lib).toBe(expectedJsuiVersion); 18 | expect(coveoVersion.product).toBe(expectedJsuiVersion); > 19 | }).toPass({timeout}); | ^ 20 | }); 21 | 22 | } else { at /home/runner/work/search-ui/search-ui/playwright/e2e/validateJsuiVersion.ts:19:12
});

} else {
console.log('No JSUI version to validate.');
}
5 changes: 4 additions & 1 deletion playwright/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {},
"scripts": {
"test": "npx playwright test --project chromium --project firefox --project webkit",
"validate-jsui-version": "npx playwright test --project validate-jsui-version"
},
"keywords": [],
"author": "",
"license": "ISC",
Expand Down
8 changes: 8 additions & 0 deletions playwright/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,14 @@ export default defineConfig({

/* Configure projects for major browsers */
projects: [
{
name: 'validate-jsui-version',
testMatch: 'validateJsuiVersion.ts',
},

{
name: 'chromium',
testIgnore: 'validateJsuiVersion.ts',
use: {
...devices['Desktop Chrome'],
headless: true,
Expand All @@ -46,6 +52,7 @@ export default defineConfig({

{
name: 'firefox',
testIgnore: 'validateJsuiVersion.ts',
use: {
...devices['Desktop Firefox'],
headless: true,
Expand All @@ -54,6 +61,7 @@ export default defineConfig({

{
name: 'webkit',
testIgnore: 'validateJsuiVersion.ts',
use: {
...devices['Desktop Safari'],
headless: true,
Expand Down
Loading