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

Attach / upload Playwright report on failure #4573

Merged
merged 8 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions .github/actions/kots-e2e/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ runs:
SKIP_TEARDOWN=1
shell: bash

- uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: ${{ github.job }}-${{ inputs.k8s-distribution }}-${{ inputs.k8s-version }}-playwright-report
path: ./e2e/playwright/playwright-report/

- name: Print logs on failure
if: ${{ failure() }}
env:
Expand Down
2 changes: 1 addition & 1 deletion e2e/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:latest
FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive

Expand Down
2 changes: 2 additions & 0 deletions e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ include ../Makefile.build.mk

BIN_DIR := $(shell pwd)/bin
KOTS_BIN_DIR := $(shell dirname $(shell pwd))/bin
PLAYWRIGHT_DIR := $(shell pwd)/playwright

SHELL := /bin/bash

Expand Down Expand Up @@ -32,6 +33,7 @@ test:
-v $(BIN_DIR)/e2e.test:/usr/local/bin/e2e.test \
-v $(KOTS_BIN_DIR)/kots:/usr/local/bin/kots \
-v $(KOTS_BIN_DIR)/kots:/usr/local/bin/kubectl-kots \
-v $(PLAYWRIGHT_DIR)/playwright-report:/playwright/playwright-report \
$(EXISTING_KUBECONFIG_VOLUME_MOUNT) \
-v /var/run/docker.sock:/var/run/docker.sock \
e2e-deps \
Expand Down
11 changes: 4 additions & 7 deletions e2e/playwright/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@ import { defineConfig, devices } from '@playwright/test';
*/
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,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'list',
reporter: [
['line'],
['html', { open: 'never' }],
],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
Expand Down
5 changes: 3 additions & 2 deletions e2e/playwright/tests/smoke-test/test.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test('smoke test', async ({ page }) => {
await page.getByRole('button', { name: 'Deploy' }).click();
await page.getByRole('button', { name: 'Deploy anyway' }).click();
await expect(page.locator('#app')).toContainText('Ready', { timeout: 30000 });
await expect(page.locator('#app')).toContainText('Currently deployed version', { timeout: 15000 });
await expect(page.locator('#app')).toContainText('Currently deployed version', { timeout: 30000 });
await expect(page.locator('#app')).toContainText('Check for update');
await expect(page.locator('#app')).toContainText('Configure automatic updates');
await expect(page.locator('#app')).toContainText('Redeploy', { timeout: 15000 });
Expand All @@ -41,6 +41,7 @@ test('smoke test', async ({ page }) => {
await expect(page.locator('.ConfigureUpdatesModal')).toContainText('At 12:00 AM, only on Sunday');
await page.getByRole('button', { name: 'Update', exact: true }).click();
await expect(page.getByText('Automatically check for updates', { exact: true })).not.toBeVisible();
await page.waitForTimeout(2000);
await page.locator('span[data-tip="View deploy logs"]').first().click();
await validateDeployLogs(page, expect);
await page.reload();
Expand Down Expand Up @@ -115,7 +116,7 @@ test('smoke test', async ({ page }) => {
await expect(page.getByRole('button', { name: 'Save changes' })).toBeDisabled();
await expect(page.locator('.Loader')).toBeVisible();
await expect(page.locator('#app')).toContainText('Writing manifest to image destination', { timeout: 30000 });
await expect(page.getByRole('button', { name: 'Save changes' })).toBeEnabled({ timeout: 30000 });
await expect(page.getByRole('button', { name: 'Save changes' })).toBeEnabled({ timeout: 60000 });
await expect(page.locator('.Loader')).not.toBeVisible();
await page.getByRole('link', { name: 'Version history' }).click();
await expect(page.locator('#app')).toContainText('Registry Change');
Expand Down
Loading