Skip to content

Commit ed4c18e

Browse files
authored
Merge pull request #17032 from yonasberhe23/fix_oidc_provider_test_failures_215
Automation: Stabilize OIDC provider tests
2 parents d84a83e + 489ce97 commit ed4c18e

2 files changed

Lines changed: 37 additions & 25 deletions

File tree

cypress/e2e/po/pages/users-and-auth/oidc-client.po.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default class OidcClientsPagePo extends PagePo {
2222
const sideNav = new ProductNavPo();
2323

2424
BurgerMenuPo.burgerMenuNavToMenubyLabel('Users & Authentication');
25-
sideNav.navToSideMenuGroupByLabel('Client Application');
25+
sideNav.navToSideMenuEntryByLabel('OIDC Apps');
2626
}
2727

2828
createOidcClient() {

cypress/e2e/tests/pages/users-and-auth/oidcProvider.spec.ts

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import PromptRemove from '@/cypress/e2e/po/prompts/promptRemove.po';
44
import { promptModal } from '@/cypress/e2e/po/prompts/shared/modalInstances.po';
55
import OIDCClientDetailPo from '@/cypress/e2e/po/detail/management.cattle.io.oidcclient.po';
66
import { MEDIUM_TIMEOUT_OPT } from '@/cypress/support/utils/timeouts';
7+
import HomePagePo from '@/cypress/e2e/po/pages/home.po';
8+
import { qase } from '@/cypress/support/qase';
79

8-
describe('Rancher as an OIDC Provider', { testIsolation: 'off', tags: ['@globalSettings', '@adminUser'] }, () => {
10+
describe('Rancher as an OIDC Provider', { tags: ['@globalSettings', '@adminUser'] }, () => {
911
const OIDC_CREATE_DATA = {
1012
APP_NAME: 'some-app-name',
1113
APP_DESC: 'some-app-desc',
@@ -35,15 +37,16 @@ describe('Rancher as an OIDC Provider', { testIsolation: 'off', tags: ['@globalS
3537
const oidcClientCreatePage = new OidcClientCreateEditPo(clusterId);
3638
const oidcClientEditPage = new OidcClientCreateEditPo(clusterId, OIDC_CREATE_DATA.APP_NAME, true);
3739

38-
before(() => {
40+
beforeEach(() => {
3941
cy.login();
4042
});
4143

42-
it('should be able to create an OIDC client application', () => {
44+
qase(9761, it('should be able to create an OIDC client application', () => {
4345
cy.intercept('POST', `/v1/management.cattle.io.oidcclients`).as('createRequest');
4446

45-
oidcClientsPage.goTo();
46-
oidcClientsPage.waitForPage();
47+
HomePagePo.goTo();
48+
OidcClientsPagePo.navTo(); // Do not use goTo() here — deep link (going directly to the list page) makes the full-secret copy row behavior flaky.
49+
oidcClientsPage.waitForUrlPathWithoutContext();
4750

4851
// check title and list view
4952
oidcClientsPage.list().title().should('contain', 'OIDC Apps');
@@ -57,7 +60,7 @@ describe('Rancher as an OIDC Provider', { testIsolation: 'off', tags: ['@globalS
5760

5861
// let's create an oidc client
5962
oidcClientsPage.createOidcClient();
60-
oidcClientCreatePage.waitForPage();
63+
oidcClientCreatePage.waitForUrlPathWithoutContext();
6164

6265
oidcClientCreatePage.nameNsDescription().name().set(OIDC_CREATE_DATA.APP_NAME);
6366
oidcClientCreatePage.nameNsDescription().description().set(OIDC_CREATE_DATA.APP_DESC);
@@ -79,16 +82,16 @@ describe('Rancher as an OIDC Provider', { testIsolation: 'off', tags: ['@globalS
7982
expect(response?.body.spec.tokenExpirationSeconds).to.equal(OIDC_CREATE_DATA.TOKEN_EXP);
8083
});
8184

82-
oidcClientDetailPage.waitForPage();
85+
oidcClientDetailPage.waitForUrlPathWithoutContext();
8386

8487
oidcClientDetailPage.clientID().exists();
8588
oidcClientDetailPage.clientFullSecretCopy(0).exists();
8689

8790
oidcClientDetailPage.clientID().copyToClipboard();
8891
oidcClientDetailPage.clientFullSecretCopy(0).copyToClipboard();
89-
});
92+
}));
9093

91-
it('should be able to edit an OIDC client application', () => {
94+
qase(9762, it('should be able to edit an OIDC client application', () => {
9295
cy.intercept('PUT', `/v1/management.cattle.io.oidcclients/${ OIDC_CREATE_DATA.APP_NAME }`).as('editRequest');
9396

9497
OidcClientsPagePo.goTo();
@@ -116,14 +119,18 @@ describe('Rancher as an OIDC Provider', { testIsolation: 'off', tags: ['@globalS
116119
expect(response?.body.spec.refreshTokenExpirationSeconds).to.equal(OIDC_EDIT_DATA.REF_TOKEN_EXP);
117120
expect(response?.body.spec.tokenExpirationSeconds).to.equal(OIDC_EDIT_DATA.TOKEN_EXP);
118121
});
119-
});
122+
}));
120123

121-
it('should be able to add a new secret for an OIDC provider', () => {
124+
qase(9763, it('should be able to add a new secret for an OIDC provider', () => {
122125
cy.intercept('PUT', `/v1/management.cattle.io.oidcclients/${ OIDC_CREATE_DATA.APP_NAME }`).as('addNewSecret');
123126

124-
oidcClientDetailPage.goTo();
125-
oidcClientDetailPage.waitForPage();
126-
127+
HomePagePo.goTo();
128+
OidcClientsPagePo.navTo(); // Do not use goTo() here — deep link (going directly to the detail page) makes the full-secret copy row behavior flaky.
129+
oidcClientsPage.waitForUrlPathWithoutContext();
130+
oidcClientsPage.list().resourceTable().sortableTable().checkLoadingIndicatorNotVisible();
131+
oidcClientsPage.list().resourceTable().sortableTable().noRowsShouldNotExist();
132+
oidcClientsPage.list().resourceTable().goToDetailsPage(OIDC_CREATE_DATA.APP_NAME);
133+
oidcClientDetailPage.waitForUrlPathWithoutContext();
127134
oidcClientDetailPage.addNewSecretBtnClick();
128135

129136
// check data from network request
@@ -133,20 +140,25 @@ describe('Rancher as an OIDC Provider', { testIsolation: 'off', tags: ['@globalS
133140
});
134141

135142
// Wait for the page to refresh and show the new secret with proper timeout
136-
oidcClientDetailPage.waitForPage();
143+
oidcClientDetailPage.waitForUrlPathWithoutContext();
137144

138145
// Wait for the secret element to appear before trying to interact with it
139146
oidcClientDetailPage.clientFullSecretCopy(1).checkVisible();
140147

141148
oidcClientDetailPage.clientFullSecretCopy(1).exists();
142149
oidcClientDetailPage.clientFullSecretCopy(1).copyToClipboard();
143-
});
150+
}));
144151

145-
it('should be able to regenerate a secret for an OIDC provider', () => {
152+
qase(9764, it('should be able to regenerate a secret for an OIDC provider', () => {
146153
cy.intercept('PUT', `/v1/management.cattle.io.oidcclients/${ OIDC_CREATE_DATA.APP_NAME }`).as('regenSecret');
147154

148-
oidcClientDetailPage.goTo();
149-
oidcClientDetailPage.waitForPage();
155+
HomePagePo.goTo();
156+
OidcClientsPagePo.navTo(); // Do not use goTo() here — deep link (going directly to the detail page) makes the full-secret copy row behavior flaky.
157+
oidcClientsPage.waitForUrlPathWithoutContext();
158+
oidcClientsPage.list().resourceTable().sortableTable().checkLoadingIndicatorNotVisible();
159+
oidcClientsPage.list().resourceTable().sortableTable().noRowsShouldNotExist();
160+
oidcClientsPage.list().resourceTable().goToDetailsPage(OIDC_CREATE_DATA.APP_NAME);
161+
oidcClientDetailPage.waitForUrlPathWithoutContext();
150162

151163
// let's regen the secret we've added the step before
152164
oidcClientDetailPage.secretCardActionMenuToggle(1);
@@ -163,9 +175,9 @@ describe('Rancher as an OIDC Provider', { testIsolation: 'off', tags: ['@globalS
163175

164176
oidcClientDetailPage.clientFullSecretCopy(1).exists();
165177
oidcClientDetailPage.clientFullSecretCopy(1).copyToClipboard();
166-
});
178+
}));
167179

168-
it('should be able to delete a secret for an OIDC provider', () => {
180+
qase(9765, it('should be able to delete a secret for an OIDC provider', () => {
169181
cy.intercept('PUT', `/v1/management.cattle.io.oidcclients/${ OIDC_CREATE_DATA.APP_NAME }`).as('deleteSecret');
170182

171183
oidcClientDetailPage.goTo();
@@ -186,9 +198,9 @@ describe('Rancher as an OIDC Provider', { testIsolation: 'off', tags: ['@globalS
186198

187199
// check that the card doesn't exist anymore
188200
cy.get('[data-testid="item-card-client-secret-2"]').should('not.exist');
189-
});
201+
}));
190202

191-
it('should be able to delete an OIDC client application', () => {
203+
qase(9766, it('should be able to delete an OIDC client application', () => {
192204
cy.intercept('DELETE', `/v1/management.cattle.io.oidcclients/${ OIDC_CREATE_DATA.APP_NAME }`).as('deleteRequest');
193205

194206
OidcClientsPagePo.goTo();
@@ -204,5 +216,5 @@ describe('Rancher as an OIDC Provider', { testIsolation: 'off', tags: ['@globalS
204216

205217
oidcClientsPage.waitForPage();
206218
cy.contains(OIDC_CREATE_DATA.APP_NAME).should('not.exist');
207-
});
219+
}));
208220
});

0 commit comments

Comments
 (0)