Skip to content

Commit 66fb2cc

Browse files
authored
ci: add a Playwright-based test (#13)
2 parents dfed2a4 + acbbb00 commit 66fb2cc

5 files changed

Lines changed: 63 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,21 @@ jobs:
1717
- name: Checkout
1818
uses: actions/checkout@v2
1919

20+
- name: Debug
21+
run: |
22+
whoami
23+
pwd
2024
# A test for the basic CLI usage.
2125
- name: Running a single test
2226
uses: ./
2327
with:
2428
command: run ./test.yml
2529

30+
- name: Running a Playwright-based test
31+
uses: ./
32+
with:
33+
command: run ./browser-test.ts
34+
2635
# The generated report must be available to the rest of the workflow.
2736
- name: Generating the report
2837
uses: ./

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
FROM artilleryio/artillery:latest
1+
FROM artilleryio/artillery:2.0.30
2+
ENV PLAYWRIGHT_BROWSERS_PATH=/opt/playwright
3+
RUN npx playwright@1.58.1 install --with-deps chromium
24
COPY entrypoint.sh /entrypoint.sh
35
ENTRYPOINT ["/entrypoint.sh"]

browser-test.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
export const config = {
2+
target: "https://www.artillery.io",
3+
phases: [
4+
{
5+
arrivalRate: 1,
6+
duration: 10,
7+
},
8+
],
9+
engines: {
10+
playwright: {},
11+
},
12+
};
13+
14+
export const scenarios = [
15+
{
16+
engine: "playwright",
17+
name: "check_out_core_concepts_scenario",
18+
testFunction: async function checkOutArtilleryCoreConceptsFlow(
19+
page,
20+
_userContext,
21+
events,
22+
test,
23+
) {
24+
await test.step("Go to Artillery", async () => {
25+
const requestPromise = page.waitForRequest("https://artillery.io/");
26+
await page.goto("https://artillery.io/");
27+
const _req = await requestPromise;
28+
});
29+
30+
await test.step("Go to docs", async () => {
31+
await page.getByRole("link", { name: "Docs" }).first().click();
32+
await page.waitForURL("https://www.artillery.io/docs");
33+
});
34+
35+
await test.step("Go to core concepts", async () => {
36+
await page
37+
.getByRole("link", {
38+
name: "Start a new GitHub Discussion",
39+
})
40+
.click();
41+
42+
await page.waitForURL(
43+
"https://github.com/artilleryio/artillery/discussions",
44+
);
45+
});
46+
},
47+
},
48+
];

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "action-run",
4-
"version": "1.1.1",
4+
"version": "2.0.30",
55
"description": "GitHub Action for load testing with Artillery",
66
"keywords": [
77
"github",

0 commit comments

Comments
 (0)