Basic Playwright Framework Example
Below is a basic workflow for executing a Playwright project which is available
on GitHub. You can paste this directly into the YAML of an existing or new test, just make
sure to update the name
and namespace
for your environment if needed.
- The
spec.content
property defines the location of the GitHub project - The
spec.steps
property defines a single step that runs the test and uploads the created reports, including the generated trace report.
Basic Playwright Workflow
apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
metadata:
name: playwright-sample
namespace: testkube
labels:
docs: example
spec:
content:
git:
uri: https://github.com/kubeshop/testkube
revision: main
paths:
- test/playwright/executor-tests/playwright-project
container:
workingDir: /data/repo/test/playwright/executor-tests/playwright-project
image: mcr.microsoft.com/playwright:v1.32.3-focal
resources:
requests:
cpu: 2
memory: 2Gi
steps:
- name: Install dependencies
shell: npm ci
- name: Run tests
shell: npx --yes playwright@1.32.3 test --trace on
artifacts:
paths:
- playwright-report/**/*
After execution, you can see the output from the test executions under the executions panel tabs:
- Log Output
- Artifacts
- Overview Report
- Test Report
- Trace UI
The log output from the Playwright Framework execution:
The uploaded report is available in the Artifacts tab:
Clicking the HTML report opens it in your browser:
Clicking a specific test shows that tests details, including a link to the trace report.
Clicking the trace opens the Playwright Trace UI
Basic Playwright from Template
Below is an example workflow for executing the Playwright project using an official Testkube Template.
Basic Playwright Workflow from Template
apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
metadata:
name: playwright-sample-from-template
namespace: testkube
labels:
docs: example
spec:
container:
workingDir: /data/repo/test/playwright/executor-tests/playwright-project
steps:
- name: Run from template
content:
git:
uri: https://github.com/kubeshop/testkube
revision: main
paths:
- test/playwright/executor-tests/playwright-project
workingDir: /data/repo/test/playwright/executor-tests/playwright-project
template:
name: official/playwright/v1
config:
version: v1.32.3-jammy