Skip to content

Commit

Permalink
test(tekton): add playwright tests for the plugin (#1228)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrichter1 authored Feb 21, 2024
1 parent cfe6716 commit 705afc2
Show file tree
Hide file tree
Showing 8 changed files with 374 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-playwright.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Determine changes
id: scan
env:
HEAD: ${{ github.event.pull_request.head.sha }}
HEAD: ${{ github.sha }}
BASE: ${{ github.event.pull_request.base.sha }}
run: |
root=$(pwd)
Expand Down
2 changes: 1 addition & 1 deletion plugins/quay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@backstage/dev-utils": "1.0.27",
"@backstage/test-utils": "1.5.0",
"@janus-idp/cli": "1.7.1",
"@playwright/test": "1.41.0",
"@playwright/test": "1.41.2",
"@testing-library/jest-dom": "6.4.2",
"@testing-library/react": "14.2.1",
"@testing-library/react-hooks": "8.0.1",
Expand Down
1 change: 1 addition & 0 deletions plugins/quay/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default defineConfig({
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
baseURL: process.env.PLUGIN_BASE_URL || 'http://localhost:3000',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
screenshot: 'only-on-failure',
Expand Down
2 changes: 1 addition & 1 deletion plugins/quay/tests/quay.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test.describe('Quay plugin', () => {
test.beforeAll(async ({ browser }) => {
const context = await browser.newContext();
page = await context.newPage();
await page.goto('http://localhost:3000/quay');
await page.goto('/');
await expect(
page.getByRole('link', { name: 'backstage-test/test-images' }),
).toBeEnabled({ timeout: 20000 });
Expand Down
4 changes: 3 additions & 1 deletion plugins/tekton/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"prepack": "backstage-cli package prepack",
"start": "backstage-cli package start",
"test": "backstage-cli package test --passWithNoTests --coverage",
"tsc": "tsc"
"tsc": "tsc",
"ui-test": "yarn playwright test"
},
"dependencies": {
"@aonic-ui/pipelines": "^1.1.0",
Expand Down Expand Up @@ -62,6 +63,7 @@
"@janus-idp/cli": "1.7.1",
"@testing-library/jest-dom": "6.4.2",
"@testing-library/react": "14.2.1",
"@playwright/test": "1.41.2",
"@testing-library/react-hooks": "8.0.1",
"@testing-library/user-event": "14.5.1",
"@types/node": "18.18.5",
Expand Down
34 changes: 34 additions & 0 deletions plugins/tekton/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { defineConfig, devices } from '@playwright/test';

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './tests',
/* 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,
/* Run tests in sequence. */
workers: 1,
/* 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. */
use: {
baseURL: process.env.PLUGIN_BASE_URL || 'http://localhost:3000',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
},

/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
});
Loading

0 comments on commit 705afc2

Please sign in to comment.