Added timeout for restart etherpad server.

This commit is contained in:
SamTV12345 2024-03-10 22:40:38 +01:00
parent 4efe667396
commit 6fa9e1e673
4 changed files with 7 additions and 13 deletions

View file

@ -10,9 +10,9 @@ export default defineConfig({
/* Run tests in files in parallel */ /* Run tests in files in parallel */
fullyParallel: true, fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */ /* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ /* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html', reporter: 'html',
retries: 3,
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: { use: {
/* Base URL to use in actions like `await page.goto('/')`. */ /* Base URL to use in actions like `await page.goto('/')`. */

View file

@ -53,5 +53,6 @@ test.describe('admin settings',()=> {
await page.waitForSelector('.settings') await page.waitForSelector('.settings')
const settings = page.locator('.settings'); const settings = page.locator('.settings');
await expect(settings).not.toBeEmpty(); await expect(settings).not.toBeEmpty();
await page.waitForTimeout(1000)
}); });
}) })

View file

@ -31,7 +31,9 @@ test.describe('Plugins page', ()=> {
test('Attempt to Install and Uninstall a plugin', async ({page}) => { test('Attempt to Install and Uninstall a plugin', async ({page}) => {
await page.waitForSelector('.search-field'); await page.waitForSelector('.search-field');
const pluginTable = page.locator('table tbody').nth(1); const pluginTable = page.locator('table tbody').nth(1);
await expect(pluginTable).not.toBeEmpty() await expect(pluginTable).not.toBeEmpty({
timeout: 15000
})
const plugins = await pluginTable.locator('tr').count() const plugins = await pluginTable.locator('tr').count()
expect(plugins).toBeGreaterThan(10) expect(plugins).toBeGreaterThan(10)

View file

@ -6,18 +6,9 @@ export const goToAdminPage = async (page: Page) => {
export const loginToAdmin = async (page: Page, username: string, password: string) => { export const loginToAdmin = async (page: Page, username: string, password: string) => {
const maxAttempts = 10;
let currentAttempt = 0;
let success = false;
while (!success && currentAttempt < maxAttempts) { await page.goto('http://localhost:9001/admin/');
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.waitForSelector('input[name="username"]');
await page.fill('input[name="username"]', username); await page.fill('input[name="username"]', username);
await page.fill('input[name="password"]', password); await page.fill('input[name="password"]', password);