Skip to content

Commit

Permalink
remove flake
Browse files Browse the repository at this point in the history
  • Loading branch information
JComins000 committed May 30, 2024
1 parent 55c2fe2 commit caa39ab
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 28 deletions.
13 changes: 5 additions & 8 deletions webui/react/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
import { defineConfig, devices } from '@playwright/test';
import * as dotenv from 'dotenv';

import {
defineConfig,
devices,
} from '@playwright/test';

dotenv.config();

const serverAddess = process.env.PW_SERVER_ADDRESS;
Expand All @@ -28,7 +24,7 @@ export default defineConfig({
fullyParallel: !!process.env.CI,

/* https://playwright.dev/docs/test-timeouts#global-timeout */
globalTimeout: process.env.PWDEBUG ? 0 : 900_000,
globalTimeout: process.env.PWDEBUG ? 0 : 1_800_000,
/* Folder for test artifacts such as screenshots, videos, traces, etc. */
outputDir: './src/e2e/test-results',
/* Folder for test artifacts such as screenshots, videos, traces, etc. */
Expand All @@ -42,7 +38,7 @@ export default defineConfig({

{
name: 'firefox',
use: { ...devices['Desktop Firefox']},
use: { ...devices['Desktop Firefox'] },
},

{
Expand Down Expand Up @@ -103,5 +99,6 @@ export default defineConfig({
reuseExistingServer: !process.env.CI,
},

workers: process.env.CI ? 4 : 1,
// workers: process.env.CI ? 4 : 1,
workers: 1,
});
42 changes: 26 additions & 16 deletions webui/react/src/e2e/tests/experimentList.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ test.describe('Experiement List', () => {
const grid = projectDetailsPage.f_experiemntList.dataGrid;

await projectDetailsPage.gotoProject();
await expect(projectDetailsPage.f_experiemntList.dataGrid.rows.pwLocator).not.toHaveCount(0);
await expect(projectDetailsPage.f_experiemntList.dataGrid.rows.pwLocator).not.toHaveCount(0, {
timeout: 10_000,
});
await test.step('Deselect', async () => {
try {
await grid.headRow.selectDropdown.menuItem('select-none').select({ timeout: 1_000 });
Expand Down Expand Up @@ -84,6 +86,7 @@ test.describe('Experiement List', () => {
});

test('Column Picker add and remove', async () => {
test.setTimeout(120_000);
const columnTitle = 'Forked From',
columnTestid = 'forkedFrom';
const columnPicker = projectDetailsPage.f_experiemntList.tableActionBar.columnPickerMenu;
Expand Down Expand Up @@ -111,7 +114,7 @@ test.describe('Experiement List', () => {
});

test('Column Picker Show All and Hide All', async () => {
test.setTimeout(120_000);
test.setTimeout(180_000);
const columnPicker = projectDetailsPage.f_experiemntList.tableActionBar.columnPickerMenu;
const grid = projectDetailsPage.f_experiemntList.dataGrid;
let previousTabs = grid.headRow.columnDefs.size;
Expand Down Expand Up @@ -212,20 +215,27 @@ test.describe('Experiement List', () => {
// This looks a little screwy with nth(1) in some places. Everything here is referring to the second filterfield row.
// [INFENG-715]
await tableFilter.filterForm.addCondition.pwLocator.click();
await tableFilter.filterForm.filter.filterFields.conjunctionContainer.conjunctionSelect.pwLocator.click();
await tableFilter.filterForm.filter.filterFields.conjunctionContainer.conjunctionSelect._menu.pwLocator.waitFor();
await tableFilter.filterForm.filter.filterFields.conjunctionContainer.conjunctionSelect.selectMenuOption(
'or',
);
await tableFilter.filterForm.filter.filterFields.columnName.pwLocator.nth(1).click();
await tableFilter.filterForm.filter.filterFields.columnName._menu.pwLocator.waitFor();
await tableFilter.filterForm.filter.filterFields.columnName.selectMenuOption('ID');
await expect(
tableFilter.filterForm.filter.filterFields.operator.pwLocator.nth(1),
).toHaveText('=');
await tableFilter.filterForm.filter.filterFields.operator.pwLocator.nth(1).click();
await tableFilter.filterForm.filter.filterFields.operator._menu.pwLocator.waitFor();
await tableFilter.filterForm.filter.filterFields.operator.selectMenuOption('=');

const conjunction =
tableFilter.filterForm.filter.filterFields.conjunctionContainer.conjunctionSelect;
await conjunction.pwLocator.click();
await conjunction._menu.pwLocator.waitFor();
await conjunction.menuItem('or').pwLocator.click();
await conjunction._menu.pwLocator.waitFor({ state: 'hidden' });

const columnName = tableFilter.filterForm.filter.filterFields.columnName;
await columnName.pwLocator.nth(1).click();
await columnName._menu.pwLocator.waitFor();
await columnName.menuItem('ID').pwLocator.click();
await columnName._menu.pwLocator.waitFor({ state: 'hidden' });

const operator = tableFilter.filterForm.filter.filterFields.operator;
await expect(operator.pwLocator.nth(1)).toHaveText('=');
await operator.pwLocator.nth(1).click();
await operator._menu.pwLocator.waitFor();
await operator.menuItem('=').pwLocator.click();
await operator._menu.pwLocator.waitFor({ state: 'hidden' });

await tableFilter.filterForm.filter.filterFields.valueNumber.pwLocator.nth(1).fill('1');
},
totalExperiments,
Expand Down
10 changes: 6 additions & 4 deletions webui/react/src/e2e/tests/userManagement.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@ test.describe('User Management', () => {
const userManagementPage = new UserManagement(authedPage);
await userManagementPage.goto();
// wait for table to be stable and select page 1
await userManagementPage.table.table.rows.pwLocator.count();
const page1 = userManagementPage.table.table.pagination.pageButtonLocator(1);
if (await userManagementPage.table.table.pagination.pwLocator.isVisible()) {
await expect(async () =>
expect(await userManagementPage.table.table.rows.pwLocator.count()).toBeGreaterThanOrEqual(1),
).toPass({ timeout: 10_000 });
if ((await userManagementPage.table.table.rows.pwLocator.count()) >= 10) {
await expect(
repeatWithFallback(
async () => await expect(page1).toHaveClass(/ant-pagination-item-active/),
async () => await page1.click(),
),
).toPass({ timeout: 10_000 });
).toPass({ timeout: 5_000 });
}
});

Expand Down Expand Up @@ -220,12 +222,12 @@ test.describe('User Management', () => {
await test.step('Check that all users are disabled', async () => {
// wait for table to be stable and check that pagination and "no data" both dont show
await userManagementPage.table.table.pwLocator.click({ trial: true });
await userManagementPage._page.reload(); // BUG [ET-240] requires reload
try {
await userManagementPage.table.table.noData.pwLocator.waitFor();
await userManagementPage.table.table.pagination.pwLocator.waitFor();
// if we see these elements, we should fail the test
// sometimes BUG [ET-240] makes this test pass unexpectedly
test.fail();
throw new Error('Expected table to have data and no pagination');
} catch (error) {
// if we see a timeout error, that means we don't see "no data"
Expand Down

0 comments on commit caa39ab

Please sign in to comment.