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

[WIP] Update for timeout issue for playwright test errors #1601

Closed
Closed
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
7 changes: 7 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,13 @@ jobs:
max_attempts: 3
retry_wait_seconds: 30
command: rad deploy ${{ matrix.path }} ${{ matrix.deployArgs }}
- name: Wait for all pods to be ready
if: steps.gen-id.outputs.RUN_TEST == 'true'
id: wait-for-pods
run: |
namespace="${{ matrix.env }}-${{ matrix.app }}"
label="radapp.io/application=${{ matrix.app }}"
kubectl rollout status deployment -l $label -n $namespace --timeout=90s
Comment on lines +269 to +275
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this because rad deploy already waits for all pods to be ready. We discussed this with @rynowak.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we don't need this 😉. If we're inserting waits in random places it can mask bugs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, i had seen the comment in an earlier PR where this isn't needed. I was curious what the output of this would be now since the endpoint isn't currently loading. no intention to merge this in.

- name: Run Playwright Test
if: steps.gen-id.outputs.RUN_TEST == 'true' && matrix.uiTestFile != ''
id: run-playwright-test
Expand Down
4 changes: 2 additions & 2 deletions playwright/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export default defineConfig({
use: { ...devices["Desktop Safari"] },
},
],
timeout: 1 * 60 * 1000,
timeout: 2 * 60 * 1000,
expect: {
timeout: 30 * 1000,
timeout: 60 * 1000,
},
});
41 changes: 29 additions & 12 deletions playwright/tests/eshop/eshop.app.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect } from "@playwright/test";
import { expect, test } from "@playwright/test";

test("eShop on Containers App Basic UI and Functionality Checks", async ({
page,
Expand All @@ -17,17 +17,34 @@ test("eShop on Containers App Basic UI and Functionality Checks", async ({
let endpoint = process.env.ENDPOINT;
expect(endpoint).toBeDefined();

// Remove quotes from the endpoint if they exist
try {
endpoint = (endpoint as string).replace(/['"]+/g, "");
log(`Navigating to the endpoint: ${endpoint}`);
await page.goto(endpoint);
} catch (error) {
console.error(
`Attempt ${testInfo.retry}: Failed to navigate to the endpoint:`,
error
);
}
// Remove quotes from the endpoint if they exist
try {
endpoint = (endpoint as string).replace(/['"]+/g, "");
log(`Endpoint after removing quotes: ${endpoint}`);
} catch (error) {
console.error(`Error processing the endpoint:`, error);
}

// Check if the endpoint is reachable
try {
const response = await fetch(endpoint);
if (!response.ok) throw new Error(`HTTP error! Status: ${response.status}`);
log(`Endpoint is reachable: ${endpoint}`);
} catch (error) {
console.error(`Failed to reach the endpoint:`, error);
return;
}

// Navigate to the endpoint
try {
log(`Navigating to the endpoint: ${endpoint}`);
await page.goto(endpoint);
} catch (error) {
console.error(
`Attempt ${testInfo.retry}: Failed to navigate to the endpoint:`,
error
);
}

// Expect page to have proper URL
log(`Checking the URL: ${endpoint}/catalog`);
Expand Down
2 changes: 1 addition & 1 deletion playwright/tests/util/helper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios from "axios";

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