Skip to content

Commit f437b10

Browse files
docs-as-tests (#22283)
## Description - Adds UI tests and GitHub actions workflow ## Related issues or tickets [ENGDOCS-2284 ](https://docker.atlassian.net/browse/ENGDOCS-2284) ## Reviews - [ ] Technical review
1 parent 4ff1ad2 commit f437b10

File tree

92 files changed

+4118
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+4118
-0
lines changed

.github/workflows/docs-tests.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Docs UI Tests
2+
3+
on:
4+
schedule:
5+
- cron: '0 15 * * *' # Runs daily at 10:00 AM EST / 15:00 UTC
6+
workflow_dispatch:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repo
13+
uses: actions/checkout@v3
14+
15+
- name: Install dependencies
16+
run: npm install
17+
18+
- name: Install Playwright browsers
19+
run: npx playwright install --with-deps
20+
21+
- name: Set environment variables from GitHub Secrets
22+
run: |
23+
echo "ENV_APP_USERNAME=${{ secrets.ENV_APP_USERNAME }}" >> $GITHUB_ENV
24+
echo "ENV_APP_PASSWORD=${{ secrets.ENV_APP_PASSWORD }}" >> $GITHUB_ENV
25+
26+
- name: Run Playwright tests
27+
run: npx playwright test --trace on
28+
29+
- name: Send Slack notification on failure
30+
if: failure()
31+
uses: 8398a7/action-slack@v3
32+
with:
33+
status: ${{ job.status }}
34+
fields: repo, action, workflow
35+
env:
36+
SLACK_WEBHOOK_URL: ${{ secrets.DOCS_TESTS_SLACK_WEBHOOK }}
37+
38+
- name: Cleanup app-auth.json
39+
if: always()
40+
run: rm -f ${{ github.workspace }}/app-auth.json

docs-tests/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules/
2+
/test-results/
3+
/playwright-report/
4+
/blob-report/
5+
/playwright/.cache/
6+
.env

docs-tests/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM mcr.microsoft.com/playwright:v1.49.1-jammy
2+
3+
WORKDIR /app
4+
COPY . /app
5+
6+
RUN npm install
7+
8+
CMD ["npx", "playwright", "test", "--headed"]

docs-tests/package-lock.json

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

docs-tests/package.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "docs-tests",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"scripts": {},
6+
"keywords": [],
7+
"author": "",
8+
"license": "ISC",
9+
"description": "",
10+
"devDependencies": {
11+
"@playwright/test": "^1.49.1",
12+
"@types/node": "^22.10.2"
13+
},
14+
"dependencies": {
15+
"dotenv": "^16.4.7"
16+
}
17+
}

docs-tests/playwright.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { defineConfig } from '@playwright/test';
2+
3+
export default defineConfig({
4+
workers: 1,
5+
globalSetup: 'tests/globalSetup.ts',
6+
use: {
7+
storageState: 'app-auth.json',
8+
},
9+
});
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// This test verifies https://docs.docker.com/admin/company/owners/#add-a-company-owner
2+
3+
import { test, expect } from "@playwright/test";
4+
test.use({ storageState: "app-auth.json" });
5+
6+
test.beforeEach(async ({ page }) => {
7+
await page.goto("https://app-stage.docker.com/");
8+
await page.waitForLoadState("networkidle");
9+
10+
// Accept cookies if visible
11+
const acceptCookies = page.getByRole("button", {
12+
name: "Accept All Cookies",
13+
});
14+
if (await acceptCookies.isVisible({ timeout: 5000 }).catch(() => false)) {
15+
await acceptCookies.click();
16+
await expect(acceptCookies).toBeHidden();
17+
}
18+
});
19+
20+
test("adminConsoleAddCompanyOwner", async ({ page }) => {
21+
// Select Admin Console and choose company
22+
await page.getByTestId("dashboard-card-admin").click();
23+
await page.getByRole("menuitem", { name: "sarahscompany Company" }).click();
24+
25+
// Select Company owners
26+
await page.getByRole("menuitem", { name: "Company owners" }).click();
27+
28+
// Select Add owner and search for owner by Docker ID
29+
await page.getByRole("button", { name: "Add owner" }).click();
30+
await page.getByLabel("Search by Docker ID").click();
31+
await page.getByLabel("Search by Docker ID").fill("sarahstestaccount");
32+
33+
// Verify Add company owner button exists
34+
await expect(
35+
page.getByRole("button", { name: "Add company owner" })
36+
).toBeVisible();
37+
});
38+
39+
test.afterEach(async ({ page }) => {
40+
await page.goto("https://app-stage.docker.com/");
41+
await page.waitForLoadState("networkidle");
42+
});
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// This test verifies https://docs.docker.com/subscription/scale/#add-docker-build-cloud-minutes
2+
3+
import { test, expect } from "@playwright/test";
4+
test.use({ storageState: "app-auth.json" });
5+
6+
test.beforeEach(async ({ page }) => {
7+
await page.goto("https://app-stage.docker.com/");
8+
await page.waitForLoadState("networkidle");
9+
10+
// Accept cookies if visible
11+
const acceptCookies = page.getByRole("button", {
12+
name: "Accept All Cookies",
13+
});
14+
if (await acceptCookies.isVisible({ timeout: 5000 }).catch(() => false)) {
15+
await acceptCookies.click();
16+
await expect(acceptCookies).toBeHidden();
17+
}
18+
});
19+
20+
test("adminConsoleAddDBCMinutes", async ({ page }) => {
21+
// Select Billing and choose organization
22+
await page.getByTestId("dashboard-card-billing-account-center").click();
23+
await page
24+
.getByRole("menuitem", { name: "docs dat Docker Business" })
25+
.click();
26+
27+
// Select View build minutes
28+
await page.getByRole("link", { name: "View build minutes" }).click();
29+
30+
// Skip DBC pop-up
31+
await page.getByRole("button", { name: "Skip" }).click();
32+
33+
// Select Purchase addiitonal minutes and choose amount
34+
await page.getByRole("link", { name: "Purchase additional minutes" }).click();
35+
await page.getByLabel("build minutes | $50 $40").check();
36+
37+
// Select Continue to payment
38+
await page.getByRole("button", { name: "Continue to payment" }).click();
39+
});
40+
41+
test.afterEach(async ({ page }) => {
42+
await page.goto("https://app-stage.docker.com/");
43+
await page.waitForLoadState("networkidle");
44+
});
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// This test verifies https://docs.docker.com/admin/company/organizations/#add-organizations-to-a-company
2+
3+
import { test, expect } from "@playwright/test";
4+
test.use({ storageState: "app-auth.json" });
5+
6+
test.beforeEach(async ({ page }) => {
7+
await page.goto("https://app-stage.docker.com/");
8+
await page.waitForLoadState("networkidle");
9+
10+
// Accept cookies if visible
11+
const acceptCookies = page.getByRole("button", {
12+
name: "Accept All Cookies",
13+
});
14+
if (await acceptCookies.isVisible({ timeout: 5000 }).catch(() => false)) {
15+
await acceptCookies.click();
16+
await expect(acceptCookies).toBeHidden();
17+
}
18+
});
19+
20+
test("adminConsoleAddOrganizationsToCompany", async ({ page }) => {
21+
// Select Admin Console and choose company
22+
await page.getByTestId("dashboard-card-admin").click();
23+
await page.getByRole("menuitem", { name: "sarahscompany Company" }).click();
24+
25+
// Select Add organization
26+
await page.getByRole("button", { name: "Add organization" }).click();
27+
28+
// Choose organization to add from menu
29+
await page.getByLabel("Open", { exact: true }).click();
30+
await page.getByTestId("add-sarahdat-to-co-menu-item").click();
31+
32+
// Verify Submit button present
33+
await expect(page.getByTestId("add-org-submit-button")).toBeVisible();
34+
});
35+
36+
test.afterEach(async ({ page }) => {
37+
await page.goto("https://app-stage.docker.com/");
38+
await page.waitForLoadState("networkidle");
39+
});
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// This test verifies https://docs.docker.com/subscription/manage-seats/#add-seats
2+
// and https://docs.docker.com/subscription/manage-seats/#add-seats
3+
4+
import { test, expect } from "@playwright/test";
5+
test.use({ storageState: "app-auth.json" });
6+
7+
test.beforeEach(async ({ page }) => {
8+
await page.goto("https://app-stage.docker.com/");
9+
await page.waitForLoadState("networkidle");
10+
11+
// Accept cookies if visible
12+
const acceptCookies = page.getByRole("button", {
13+
name: "Accept All Cookies",
14+
});
15+
if (await acceptCookies.isVisible({ timeout: 5000 }).catch(() => false)) {
16+
await acceptCookies.click();
17+
await expect(acceptCookies).toBeHidden();
18+
}
19+
});
20+
21+
test("adminConsoleAddSeats", async ({ page }) => {
22+
// Select Billing and choose organization
23+
await page.getByTestId("dashboard-card-billing-account-center").click();
24+
await page
25+
.getByRole("menuitem", { name: "docs dat Docker Business" })
26+
.click();
27+
28+
// Select Add seats
29+
await page.getByRole("link", { name: "Add seats" }).click();
30+
31+
// Specify number of seats to add and select Continue to billing
32+
await page.getByRole("textbox").fill("10");
33+
await page.goto(
34+
"https://app-stage.docker.com/billing/sarahdat/update/quantity/plan?add=10"
35+
);
36+
await page.getByRole("link", { name: "Continue to billing" }).click();
37+
38+
// Select Continue to payment
39+
await page.getByRole("link", { name: "Continue to payment" }).click();
40+
41+
// Verify Update subscription button is there
42+
await expect(
43+
page.getByRole("button", { name: "Update subscription" })
44+
).toBeVisible();
45+
});
46+
47+
test.afterEach(async ({ page }) => {
48+
await page.goto("https://app-stage.docker.com/");
49+
await page.waitForLoadState("networkidle");
50+
});

0 commit comments

Comments
 (0)