Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,12 @@ Object.entries(entities).forEach(([key, EntityClass]) => {
* and verifying the owner list maintains proper state
*/
test('User as Owner with unsorted list', async ({ page }) => {
test.slow(true);
// Cap at 120s instead of test.slow()'s 180s — see rationale on the
// Roles spec: hitting the slow ceiling on a hung wait burns 3
// minutes before retry kicks in. The warmup below eliminates the
// main hang source (search-index freshness), but keep a tighter
// ceiling as insurance.
test.setTimeout(120_000);

const { afterAction, apiContext } = await getApiContext(page);
const owner1Data = generateRandomUsername('PW_A_');
Expand All @@ -254,6 +259,38 @@ Object.entries(entities).forEach(([key, EntityClass]) => {
await OWNER1.create(apiContext);
await OWNER2.create(apiContext);

// Wait for the freshly created users to land in user_search_index
// before we open the owner picker. Under CI load the async indexer
// can lag creation by several seconds; when addMultiOwner's search
// returns empty each ownerItem.waitFor({visible}) hangs the default
// 30s. Two adds + a remove = up to 90s of waste from one cold index.
// Poll the search API up-front so the UI dropdown finds them on
// the first search.
// Poll with getUserDisplayName() — this is the term addMultiOwner
// types into the picker (line ~292). If displayName ever diverges
// from name, polling by name would silently pass while the UI
// search still misses (per @gitar-bot review on PR #30390).
await expect
.poll(
async () => {
const [r1, r2] = await Promise.all([
apiContext.get(
`/api/v1/search/query?q=${OWNER1.getUserDisplayName()}&index=user_search_index`
),
apiContext.get(
`/api/v1/search/query?q=${OWNER2.getUserDisplayName()}&index=user_search_index`
),
]);
const [d1, d2] = await Promise.all([r1.json(), r2.json()]);
return (
(d1.hits?.total?.value ?? 0) > 0 &&
(d2.hits?.total?.value ?? 0) > 0
);
},
{ timeout: 15_000, intervals: [500, 1000, 2000] }
)
.toBeTruthy();

await addMultiOwner({
page,
ownerNames: [OWNER2.getUserDisplayName()],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ test.describe('Roles page tests', PLAYWRIGHT_BASIC_TEST_TAG_OBJ, () => {
});

test('Roles page should work properly', async ({ page }) => {
test.slow();
// 8 sequential test.step blocks that each renavigate to the roles list
// and paginate via getElementWithPagination (50-page loop, 30s loader
// wait each). Under CI load the whole thing has been hitting the
// 180s test.slow() ceiling — a 3-minute burn per attempt before the
// retry starts. Cap at 120s so failures fail fast and Playwright's
// per-test retry recovers the run without triple-timing-out.
// Happy-path runtime for this test on a warm shard is ~60-90s.
test.setTimeout(120_000);

const roleName = `Role-test-${uuid()}`;
const description = `This is ${roleName} description`;
Expand Down Expand Up @@ -246,18 +253,11 @@ test.describe('Roles page tests', PLAYWRIGHT_BASIC_TEST_TAG_OBJ, () => {
});

await test.step('Edit created role', async () => {
await settingClick(page, GlobalSettingOptions.ROLES);

// Wait for roles page to be ready
await waitForAllLoadersToDisappear(page);

// Edit description
const roleLocator = page.locator(
`[data-testid="role-name"][href="/settings/access/roles/${roleName}"]`
);
await getElementWithPagination(page, roleLocator);

// Wait for role details page to load
// Direct-nav to the role detail page. The previous pattern
// (settingClick → paginate the roles list until the row is found →
// click it) can burn 30s+ of loader waits per hop; the URL is
// deterministic from roleName so skip the round-trip entirely.
await page.goto(`/settings/access/roles/${roleName}`);
await waitForAllLoadersToDisappear(page);

const editDescriptionButton = page.locator(
Expand Down Expand Up @@ -336,17 +336,7 @@ test.describe('Roles page tests', PLAYWRIGHT_BASIC_TEST_TAG_OBJ, () => {
});

await test.step('Add new policy to created role', async () => {
await settingClick(page, GlobalSettingOptions.ROLES);

// Wait for roles page to be ready
await waitForAllLoadersToDisappear(page);

const roleLocator = page.locator(
`[data-testid="role-name"][href="/settings/access/roles/${roleName}"]`
);
await getElementWithPagination(page, roleLocator);

// Wait for role details page to load
await page.goto(`/settings/access/roles/${roleName}`);
await waitForAllLoadersToDisappear(page);

// Click add policy button
Expand Down Expand Up @@ -403,17 +393,7 @@ test.describe('Roles page tests', PLAYWRIGHT_BASIC_TEST_TAG_OBJ, () => {
});

await test.step('Remove added policy from created role', async () => {
await settingClick(page, GlobalSettingOptions.ROLES);

// Wait for roles page to be ready
await waitForAllLoadersToDisappear(page);

const roleLocator = page.locator(
`[data-testid="role-name"][href="/settings/access/roles/${roleName}"]`
);
await getElementWithPagination(page, roleLocator);

// Wait for role details page to load
await page.goto(`/settings/access/roles/${roleName}`);
await waitForAllLoadersToDisappear(page);

// Remove policy
Expand All @@ -436,17 +416,7 @@ test.describe('Roles page tests', PLAYWRIGHT_BASIC_TEST_TAG_OBJ, () => {
});

await test.step('Check if last policy is not removed', async () => {
await settingClick(page, GlobalSettingOptions.ROLES);

// Wait for roles page to be ready
await waitForAllLoadersToDisappear(page);

const roleLocator = page.locator(
`[data-testid="role-name"][href="/settings/access/roles/${roleName}"]`
);
await getElementWithPagination(page, roleLocator);

// Wait for role details page to load
await page.goto(`/settings/access/roles/${roleName}`);
await waitForAllLoadersToDisappear(page);

// Removing second policy from the role
Expand Down
Loading