diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index bd4b2998..f7d9a890 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -97,7 +97,7 @@ jobs: rancher: ${{ (github.event_name == 'schedule' || github.event_name == 'workflow_run') && fromJSON('["2.7", "2.8", "2.9"]') || fromJSON(format('["{0}"]', inputs.rancher || 'released')) }} mode: ${{ (github.event_name == 'schedule' || github.event_name == 'workflow_run') && fromJSON('["base", "upgrade", "fleet"]') || fromJSON(format('["{0}"]', inputs.mode || 'base')) }} exclude: - # Run full tests on 2.8 since it's latest prime version + # Run full tests on 2.9 since it's latest prime version - rancher: ${{ (github.event_name == 'schedule' || github.event_name == 'workflow_run') && '2.7' }} mode: upgrade - rancher: ${{ (github.event_name == 'schedule' || github.event_name == 'workflow_run') && '2.7' }} @@ -220,9 +220,8 @@ jobs: # Setup playwright ENV and run tests # https://rancher.github.io/dashboard/testing/e2e-test#setup-for-local-tests - uses: actions/setup-node@v4 - if: env.KUBEWARDEN == 'source' with: - node-version: '16' + node-version: '20' - name: Build Kubewarden extension if: env.KUBEWARDEN == 'source' @@ -230,10 +229,6 @@ jobs: yarn install --ignore-engines VERSION=0.0.1 yarn build-pkg kubewarden - - uses: actions/setup-node@v4 - with: - node-version: '18' - - name: Install playwright working-directory: tests run: | diff --git a/tests/e2e/00-installation.spec.ts b/tests/e2e/00-installation.spec.ts index 1c0dd0ba..4bac9adc 100644 --- a/tests/e2e/00-installation.spec.ts +++ b/tests/e2e/00-installation.spec.ts @@ -110,6 +110,9 @@ test('Install Kubewarden', async({ page, ui, nav }) => { await expect(page.getByRole('heading', { name: 'Welcome to Kubewarden' })).toBeVisible() }, 'Kubewarden installation not detected') + // Workaround for issues#938: Both singular & plural resource names in menu + await page.reload() + await test.step('Install default policyserver', async() => { const psPage = new PolicyServersPage(page) diff --git a/tests/e2e/10-landing.spec.ts b/tests/e2e/10-landing.spec.ts index 64201565..5fa9a42f 100644 --- a/tests/e2e/10-landing.spec.ts +++ b/tests/e2e/10-landing.spec.ts @@ -11,9 +11,9 @@ test('Brief check of landing pages', async({ page, ui, nav }) => { await expect(head.getByText(/App Version:\s+v[1-9][0-9.]+[0-9]/)).toBeVisible() // Recommended policies stats - await expect1m(page.getByText('Active 1 of 1 Pods / 100%')).toBeVisible() - await expect1m(page.getByText('Active 0 of 0 Namespaced Policies / 0%')).toBeVisible() - await expect1m(page.getByText('Active 6 of 6 Global Policies / 100%')).toBeVisible() + await expect1m(page.getByText('Active1 of 1 Pods / 100%')).toBeVisible() + await expect1m(page.getByText('Active0 of 0 Namespaced Policies / 0%')).toBeVisible() + await expect1m(page.getByText('Active6 of 6 Global Policies / 100%')).toBeVisible() }) await test.step('Policy Servers Landing Page', async() => { diff --git a/tests/e2e/60-telemetry.spec.ts b/tests/e2e/60-telemetry.spec.ts index a286e8e5..d3a90fed 100644 --- a/tests/e2e/60-telemetry.spec.ts +++ b/tests/e2e/60-telemetry.spec.ts @@ -78,6 +78,7 @@ test.describe('Tracing', () => { await telPage.toBeIncomplete('config') await telPage.configBtn.click() + const now = new Date().toISOString() await apps.updateApp('rancher-kubewarden-controller', { navigate : false, questions: async() => { @@ -88,7 +89,6 @@ test.describe('Tracing', () => { } }) // Wait until kubewarden controller restarts policyserver - const now = new Date().toISOString() await shell.retry(`kubectl logs -l app=kubewarden-policy-server-default -n cattle-kubewarden-system -c otc-container --since-time ${now} | grep -F "Everything is ready."`) }) diff --git a/tests/e2e/components/navigation.ts b/tests/e2e/components/navigation.ts index dc217876..d19bfb90 100644 --- a/tests/e2e/components/navigation.ts +++ b/tests/e2e/components/navigation.ts @@ -81,6 +81,10 @@ export class Navigation { async explorer(groupName: T, childName?: ExpItemMap[T]) { if (this.isblank()) await this.cluster() await this.sideNavHandler(groupName, childName) + // Wait for child page before next step + if (groupName == 'Kubewarden' && childName && childName != 'Policy Reporter') { + await expect(this.page.getByRole('heading', { name: childName })).toBeVisible() + } } // Wrapper for page.goto using default cluster @@ -118,7 +122,7 @@ export class Navigation { await this.explorer('Kubewarden', 'PolicyServers') if (name) { await this.ui.tableRow(name).open() - await expect(this.page.getByTestId('kw-ps-detail-status-title')).toBeVisible() + await expect(this.page.getByRole('heading', { name: `PolicyServer: ${name}` })).toBeVisible() } if (tab) await this.ui.tab(tab).click() } diff --git a/tests/e2e/components/rancher-ui.ts b/tests/e2e/components/rancher-ui.ts index 4211cd71..e91ad370 100644 --- a/tests/e2e/components/rancher-ui.ts +++ b/tests/e2e/components/rancher-ui.ts @@ -178,8 +178,10 @@ export class RancherUI { } static isVersion(query: string|Range): boolean { + // Convert v2.10-6e85a811efd6b831c3d49a7336a6d4b3e96c1a93-head -> v2.10.0-head + const version = this.requireEnv('RANCHER_VERSION').replace(/-[a-f0-9]{40}/, '.0') if (!semver.validRange(query)) throw new Error(`Invalid range: ${query}`) - return semver.satisfies(this.requireEnv('RANCHER_VERSION'), query, { includePrerelease: true }) + return semver.satisfies(version, query, { includePrerelease: true }) } static get hasAppCollection(): boolean { diff --git a/tests/e2e/pages/policyservers.page.ts b/tests/e2e/pages/policyservers.page.ts index 9121399e..ff2274fd 100644 --- a/tests/e2e/pages/policyservers.page.ts +++ b/tests/e2e/pages/policyservers.page.ts @@ -21,8 +21,8 @@ export class PolicyServersPage extends BasePage { } async goto(): Promise { - // await this.nav.explorer('Kubewarden', 'PolicyServers') - await this.nav.goto('dashboard/c/local/kubewarden/policies.kubewarden.io.policyserver') + await this.nav.explorer('Kubewarden', 'PolicyServers') + // await this.nav.goto('dashboard/c/local/kubewarden/policies.kubewarden.io.policyserver') } async setName(name: string) {