Skip to content
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
8 changes: 4 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on:
workflow_dispatch:
inputs:
version:
description: 'Radius version number to use (e.g. 0.1.0, 0.1.0-rc1, edge). Defaults to edge.'
description: "Radius version number to use (e.g. 0.1.0, 0.1.0-rc1, edge). Defaults to edge."
required: false
default: 'edge'
default: "edge"
type: string
push:
branches:
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
enableDapr: false
- name: eshop-azure
os: ubuntu-latest
runOnPullRequest: false
runOnPullRequest: true
app: eshop
env: azure
path: ./samples/eshop/eshop.bicep
Expand All @@ -85,7 +85,7 @@ jobs:
enableDapr: false
- name: eshop-aws
os: ubuntu-latest
runOnPullRequest: false
runOnPullRequest: true
app: eshop
env: aws
path: ./samples/eshop/eshop.bicep
Expand Down
176 changes: 147 additions & 29 deletions playwright/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions playwright/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
"author": "",
"license": "ISC",
"devDependencies": {
"@playwright/test": "^1.35.0",
"@types/node": "^20.6.0",
"@types/uuid": "^9.0.3",
"typescript": "^5.2.2"
"@playwright/test": "^1.41.2",
"@types/node": "^20.11.19",
"@types/uuid": "^9.0.8",
"typescript": "^5.3.3"
},
"dependencies": {
"uuid": "^9.0.0"
"axios": "^1.6.7",
"uuid": "^9.0.1"
}
}
3 changes: 3 additions & 0 deletions playwright/tests/demo/demo.app.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { test, expect } from "@playwright/test";
import { v4 as uuidv4 } from "uuid";
import { waitForWebApp } from "../util/helper";

test("To-Do App Basic UI Checks", async ({ page }) => {
// Listen for all console events and handle errors
Expand All @@ -9,6 +10,8 @@ test("To-Do App Basic UI Checks", async ({ page }) => {
}
});

await waitForWebApp("http://localhost:3000/");

// Go to http://localhost:3000/
await page.goto("http://localhost:3000/");

Expand Down
3 changes: 3 additions & 0 deletions playwright/tests/eshop/eshop.app.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { test, expect } from "@playwright/test";
import { waitForWebApp } from "../util/helper";

test("eShop on Containers App Basic UI and Functionality Checks", async ({ page }) => {
// Listen for all console events and handle errors
Expand All @@ -13,6 +14,8 @@ test("eShop on Containers App Basic UI and Functionality Checks", async ({ page

// Remove quotes from the endpoint if they exist
endpoint = (endpoint as string).replace(/['"]+/g, '')

await waitForWebApp(endpoint);

await page.goto(endpoint);

Expand Down
24 changes: 24 additions & 0 deletions playwright/tests/util/helper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import axios from "axios";

export async function waitForWebApp(url: string | undefined, timeout = 30000) {
if (!url) {
throw new Error("URL is not defined");
}

const startTime = Date.now();
while (true) {
try {
await axios.get(url);
console.log(`Web application is ready: ${url}`);
break;
} catch (error) {
console.log(`Web application is not ready: ${url}`);
if (Date.now() - startTime > timeout) {
throw new Error(
`Web application not ready after ${timeout} ms: ${url}`
);
}
await new Promise((resolve) => setTimeout(resolve, 1000));
}
}
}