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

Changing the place of page.reload in the tests #1492

Merged
merged 1 commit into from
May 1, 2024
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
2 changes: 1 addition & 1 deletion playwright/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default defineConfig({
use: { ...devices["Desktop Safari"] },
},
],
timeout: 5 * 60 * 1000,
timeout: 1 * 60 * 1000,
expect: {
timeout: 30 * 1000,
},
Expand Down
7 changes: 6 additions & 1 deletion playwright/tests/eshop/eshop.app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ test("eShop on Containers App Basic UI and Functionality Checks", async ({

while (attempts < maxAttempts) {
try {
// If the item is not found in the first attempt,
// reload the page to trigger the API call again.
if (attempts > 0) {
await page.reload();
}

await page.waitForSelector(firstItemSelector);
firstItem = page.locator(firstItemSelector);
await expect(firstItem).toBeVisible();
Expand All @@ -102,7 +108,6 @@ test("eShop on Containers App Basic UI and Functionality Checks", async ({
} catch (error) {
// If the item is not found within 5 seconds, an error will be thrown here, then the page will be reloaded
console.error("Item not found:", error);
await page.reload();
attempts++;
}
}
Expand Down
Loading