Skip to content

Commit

Permalink
e2e: set-timout-to-session-e2e (#2782)
Browse files Browse the repository at this point in the history
**Changes:**

This PR updates several end-to-end tests to improve reliability and reduce flakiness:

1. In `config.test.ts`, removed an unnecessary click action on the environment selector.
2. In `session-launcher.test.ts`, increased the timeout for session tests to 60 seconds.
3. In `test-util.ts`:
   - Added a 15-second timeout to the "App close" button click.
   - Updated the session deletion verification to use a more specific locator with a 15-second timeout.

**Rationale:**

These changes address potential timing issues in the tests, allowing for slower operations or network delays. The removal of the unnecessary click in the config test simplifies the test flow.
  • Loading branch information
yomybaby committed Oct 31, 2024
1 parent d92b388 commit 99b7cd2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
6 changes: 0 additions & 6 deletions e2e/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,6 @@ test.describe.parallel('config.toml', () => {
await page
.getByRole('button', { name: '2 Environments & Resource' })
.click();
await page
.locator(
'.ant-form-item-control-input-content > .ant-select > .ant-select-selector',
)
.first()
.click();
await page.getByLabel('Environments / Version').fill('AF');
await page
.locator('.rc-virtual-list-holder-inner > div:nth-child(2)')
Expand Down
4 changes: 3 additions & 1 deletion e2e/session-launcher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import {
import { test, expect } from '@playwright/test';

test.describe('NEO Sessions Launcher', () => {
test.beforeEach(async ({ page }) => {
test.beforeEach(async ({ page }, testInfo) => {
// session test code needs more time to run
testInfo.setTimeout(60_000);
await loginAsUser(page);
});

Expand Down
6 changes: 4 additions & 2 deletions e2e/test-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export async function createSession(page: Page, sessionName: string) {
await page
.getByRole('heading', { name: 'App close' })
.getByLabel('close')
.click();
.click({ timeout: 15000 });

// Verify that a cell exists to display the session name
const session = page
Expand Down Expand Up @@ -256,7 +256,9 @@ export async function deleteSession(page: Page, sessionName: string) {

// Verify session is cleared
await searchSessionInfo.fill('');
await expect(page.getByText(sessionName)).toBeHidden();
await expect(
page.locator('vaadin-grid-cell-content').filter({ hasText: sessionName }),
).toBeHidden({ timeout: 30_000 });
}

/**
Expand Down

0 comments on commit 99b7cd2

Please sign in to comment.