Skip to content

Commit

Permalink
Changing the place of page.reload in the tests (#1492)
Browse files Browse the repository at this point in the history
Signed-off-by: ytimocin <[email protected]>
  • Loading branch information
ytimocin authored May 1, 2024
1 parent 2c0de3a commit 341e4d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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

0 comments on commit 341e4d3

Please sign in to comment.