Added retry mechanism.

This commit is contained in:
SamTV12345 2024-03-10 22:17:54 +01:00
parent d37a65eabc
commit 4efe667396
2 changed files with 13 additions and 2 deletions

View file

@ -45,7 +45,7 @@ test.describe('Plugins page', ()=> {
const pluginRow = pluginTable.locator('tr').first()
await expect(pluginRow).toContainText('ep_font_color3')
// Select Install button
// Select Installation button
await pluginRow.locator('td').nth(4).locator('button').first().click()
await page.waitForTimeout(100)
await page.waitForSelector('table tbody')

View file

@ -6,7 +6,18 @@ export const goToAdminPage = async (page: Page) => {
export const loginToAdmin = async (page: Page, username: string, password: string) => {
await page.goto('http://localhost:9001/admin');
const maxAttempts = 10;
let currentAttempt = 0;
let success = false;
while (!success && currentAttempt < maxAttempts) {
try {
await page.goto('http://localhost:9001/admin');
success = true; // If the page loads successfully, set success to true
} catch (error) {
currentAttempt++;
}
}
await page.waitForSelector('input[name="username"]');
await page.fill('input[name="username"]', username);
await page.fill('input[name="password"]', password);