Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit72aef4b

Browse files
jaaydenhaslilac
authored andcommitted
fix: fix flaky IDP e2e tests (#16331)
resolvescoder/internal#325
1 parenta0c5e08 commit72aef4b

File tree

3 files changed

+44
-18
lines changed

3 files changed

+44
-18
lines changed

‎site/e2e/tests/deployment/idpOrgSync.spec.ts‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ test.beforeEach(async ({ page }) => {
1616
});
1717

1818
test.describe("IdpOrgSyncPage",()=>{
19+
test.describe.configure({retries:1});
20+
1921
test("show empty table when no org mappings are present",async({
2022
page,
2123
})=>{
@@ -149,7 +151,6 @@ test.describe("IdpOrgSyncPage", () => {
149151
});
150152

151153
constidpOrgInput=page.getByLabel("IdP organization name");
152-
constorgSelector=page.getByPlaceholder("Select organization");
153154
constaddButton=page.getByRole("button",{
154155
name:/AddIdPorganization/i,
155156
});
@@ -159,8 +160,16 @@ test.describe("IdpOrgSyncPage", () => {
159160
awaitidpOrgInput.fill("new-idp-org");
160161

161162
// Select Coder organization from combobox
163+
constorgSelector=page.getByPlaceholder("Select organization");
164+
awaitexpect(orgSelector).toBeAttached();
165+
awaitexpect(orgSelector).toBeVisible();
162166
awaitorgSelector.click();
163-
awaitpage.getByRole("option",{name:orgName}).click();
167+
awaitpage.waitForTimeout(1000);
168+
169+
constoption=awaitpage.getByRole("option",{name:orgName});
170+
awaitexpect(option).toBeAttached({timeout:30000});
171+
awaitexpect(option).toBeVisible();
172+
awaitoption.click();
164173

165174
// Add button should now be enabled
166175
awaitexpect(addButton).toBeEnabled();

‎site/e2e/tests/organizations/idpGroupSync.spec.ts‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ test.beforeEach(async ({ page }) => {
1616
});
1717

1818
test.describe("IdpGroupSyncPage",()=>{
19+
test.describe.configure({retries:1});
20+
1921
test("show empty table when no group mappings are present",async({
2022
page,
2123
})=>{
@@ -149,7 +151,6 @@ test.describe("IdpGroupSyncPage", () => {
149151
});
150152

151153
constidpOrgInput=page.getByLabel("IdP group name");
152-
constorgSelector=page.getByPlaceholder("Select group");
153154
constaddButton=page.getByRole("button",{
154155
name:/AddIdPgroup/i,
155156
});
@@ -159,8 +160,16 @@ test.describe("IdpGroupSyncPage", () => {
159160
awaitidpOrgInput.fill("new-idp-group");
160161

161162
// Select Coder organization from combobox
162-
awaitorgSelector.click();
163-
awaitpage.getByRole("option",{name:/Everyone/i}).click();
163+
constgroupSelector=page.getByPlaceholder("Select group");
164+
awaitexpect(groupSelector).toBeAttached();
165+
awaitexpect(groupSelector).toBeVisible();
166+
awaitgroupSelector.click();
167+
awaitpage.waitForTimeout(1000);
168+
169+
constoption=awaitpage.getByRole("option",{name:/Everyone/i});
170+
awaitexpect(option).toBeAttached({timeout:30000});
171+
awaitexpect(option).toBeVisible();
172+
awaitoption.click();
164173

165174
// Add button should now be enabled
166175
awaitexpect(addButton).toBeEnabled();

‎site/e2e/tests/organizations/idpRoleSync.spec.ts‎

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@ import { login } from "../../helpers";
1010
import{beforeCoderTest}from"../../hooks";
1111

1212
test.beforeEach(async({ page})=>{
13+
requiresLicense();
1314
beforeCoderTest(page);
1415
awaitlogin(page);
1516
awaitsetupApiCalls(page);
1617
});
1718

1819
test.describe("IdpRoleSyncPage",()=>{
20+
test.describe.configure({retries:1});
21+
1922
test("show empty table when no role mappings are present",async({
2023
page,
2124
})=>{
22-
requiresLicense();
2325
constorg=awaitcreateOrganizationWithName(randomName());
2426
awaitpage.goto(`/organizations/${org.name}/idp-sync?tab=roles`,{
2527
waitUntil:"domcontentloaded",
@@ -36,7 +38,6 @@ test.describe("IdpRoleSyncPage", () => {
3638
});
3739

3840
test("add new IdP role mapping with API",async({ page})=>{
39-
requiresLicense();
4041
constorg=awaitcreateOrganizationWithName(randomName());
4142
awaitcreateRoleSyncSettings(org.id);
4243

@@ -58,7 +59,6 @@ test.describe("IdpRoleSyncPage", () => {
5859
});
5960

6061
test("delete a IdP role to coder role mapping row",async({ page})=>{
61-
requiresLicense();
6262
constorg=awaitcreateOrganizationWithName(randomName());
6363
awaitcreateRoleSyncSettings(org.id);
6464

@@ -79,7 +79,6 @@ test.describe("IdpRoleSyncPage", () => {
7979
});
8080

8181
test("update sync field",async({ page})=>{
82-
requiresLicense();
8382
constorg=awaitcreateOrganizationWithName(randomName());
8483
awaitpage.goto(`/organizations/${org.name}/idp-sync?tab=roles`,{
8584
waitUntil:"domcontentloaded",
@@ -107,7 +106,6 @@ test.describe("IdpRoleSyncPage", () => {
107106
test("export policy button is enabled when sync settings are present",async({
108107
page,
109108
})=>{
110-
requiresLicense();
111109
constorg=awaitcreateOrganizationWithName(randomName());
112110
awaitpage.goto(`/organizations/${org.name}/idp-sync?tab=roles`,{
113111
waitUntil:"domcontentloaded",
@@ -121,7 +119,6 @@ test.describe("IdpRoleSyncPage", () => {
121119
});
122120

123121
test("add new IdP role mapping with UI",async({ page})=>{
124-
requiresLicense();
125122
constorgName=randomName();
126123
awaitcreateOrganizationWithName(orgName);
127124

@@ -130,30 +127,41 @@ test.describe("IdpRoleSyncPage", () => {
130127
});
131128

132129
constidpOrgInput=page.getByLabel("IdP role name");
133-
constroleSelector=page.getByPlaceholder("Select role");
134130
constaddButton=page.getByRole("button",{
135131
name:/AddIdProle/i,
136132
});
137133

138134
awaitexpect(addButton).toBeDisabled();
139135

140-
awaitidpOrgInput.fill("new-idp-role");
136+
constidpRoleName=randomName();
137+
awaitidpOrgInput.fill(idpRoleName);
141138

142139
// Select Coder role from combobox
140+
constroleSelector=page.getByPlaceholder("Select role");
141+
awaitexpect(roleSelector).toBeAttached();
142+
awaitexpect(roleSelector).toBeVisible();
143143
awaitroleSelector.click();
144-
awaitpage.getByRole("option",{name:/OrganizationAdmin/i}).click();
144+
145+
awaitpage.getByRole("combobox").click();
146+
awaitpage.waitForTimeout(1000);
147+
148+
constoption=awaitpage.getByRole("option",{
149+
name:/OrganizationAdmin/i,
150+
});
151+
152+
awaitexpect(option).toBeAttached({timeout:30000});
153+
awaitexpect(option).toBeVisible();
154+
awaitoption.click();
145155

146156
// Add button should now be enabled
147157
awaitexpect(addButton).toBeEnabled();
148158

149159
awaitaddButton.click();
150160

151161
// Verify new mapping appears in table
152-
constnewRow=page.getByTestId("role-new-idp-role");
162+
constnewRow=page.getByTestId(`role-${idpRoleName}`);
153163
awaitexpect(newRow).toBeVisible();
154-
awaitexpect(
155-
newRow.getByRole("cell",{name:"new-idp-role"}),
156-
).toBeVisible();
164+
awaitexpect(newRow.getByRole("cell",{name:idpRoleName})).toBeVisible();
157165
awaitexpect(
158166
newRow.getByRole("cell",{name:"organization-admin"}),
159167
).toBeVisible();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp