Skip to content

Commit 3544f45

Browse files
authored
Merge pull request #17058 from yonasberhe23/fix_oidc_provider_test_failures_213
[backport 2.13.5] Automation: Stabilize OIDC provider tests
2 parents 853c1d3 + 0485e79 commit 3544f45

2 files changed

Lines changed: 23 additions & 12 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: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import OidcClientCreateEditPo from '~/cypress/e2e/po/edit/management.cattle.io.o
33
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';
6+
import HomePagePo from '@/cypress/e2e/po/pages/home.po';
67

7-
describe('Rancher as an OIDC Provider', { testIsolation: 'off', tags: ['@globalSettings', '@adminUser'] }, () => {
8+
describe('Rancher as an OIDC Provider', { tags: ['@globalSettings', '@adminUser'] }, () => {
89
const OIDC_CREATE_DATA = {
910
APP_NAME: 'some-app-name',
1011
APP_DESC: 'some-app-desc',
@@ -34,15 +35,16 @@ describe('Rancher as an OIDC Provider', { testIsolation: 'off', tags: ['@globalS
3435
const oidcClientCreatePage = new OidcClientCreateEditPo(clusterId);
3536
const oidcClientEditPage = new OidcClientCreateEditPo(clusterId, OIDC_CREATE_DATA.APP_NAME, true);
3637

37-
before(() => {
38+
beforeEach(() => {
3839
cy.login();
3940
});
4041

4142
it('should be able to create an OIDC client application', () => {
4243
cy.intercept('POST', `/v1/management.cattle.io.oidcclients`).as('createRequest');
4344

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

4749
// check title and list view
4850
oidcClientsPage.list().title().should('contain', 'OIDC Apps');
@@ -56,7 +58,7 @@ describe('Rancher as an OIDC Provider', { testIsolation: 'off', tags: ['@globalS
5658

5759
// let's create an oidc client
5860
oidcClientsPage.createOidcClient();
59-
oidcClientCreatePage.waitForPage();
61+
oidcClientCreatePage.waitForUrlPathWithoutContext();
6062

6163
oidcClientCreatePage.nameNsDescription().name().set(OIDC_CREATE_DATA.APP_NAME);
6264
oidcClientCreatePage.nameNsDescription().description().set(OIDC_CREATE_DATA.APP_DESC);
@@ -78,7 +80,7 @@ describe('Rancher as an OIDC Provider', { testIsolation: 'off', tags: ['@globalS
7880
expect(response?.body.spec.tokenExpirationSeconds).to.equal(OIDC_CREATE_DATA.TOKEN_EXP);
7981
});
8082

81-
oidcClientDetailPage.waitForPage();
83+
oidcClientDetailPage.waitForUrlPathWithoutContext();
8284

8385
oidcClientDetailPage.clientID().exists();
8486
oidcClientDetailPage.clientFullSecretCopy(0).exists();
@@ -120,9 +122,13 @@ describe('Rancher as an OIDC Provider', { testIsolation: 'off', tags: ['@globalS
120122
it('should be able to add a new secret for an OIDC provider', () => {
121123
cy.intercept('PUT', `/v1/management.cattle.io.oidcclients/${ OIDC_CREATE_DATA.APP_NAME }`).as('addNewSecret');
122124

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

128134
// check data from network request
@@ -138,8 +144,13 @@ describe('Rancher as an OIDC Provider', { testIsolation: 'off', tags: ['@globalS
138144
it('should be able to regenerate a secret for an OIDC provider', () => {
139145
cy.intercept('PUT', `/v1/management.cattle.io.oidcclients/${ OIDC_CREATE_DATA.APP_NAME }`).as('regenSecret');
140146

141-
oidcClientDetailPage.goTo();
142-
oidcClientDetailPage.waitForPage();
147+
HomePagePo.goTo();
148+
OidcClientsPagePo.navTo(); // Do not use goTo() here — deep link (going directly to the detail page) makes the full-secret copy row behavior flaky.
149+
oidcClientsPage.waitForUrlPathWithoutContext();
150+
oidcClientsPage.list().resourceTable().sortableTable().checkLoadingIndicatorNotVisible();
151+
oidcClientsPage.list().resourceTable().sortableTable().noRowsShouldNotExist();
152+
oidcClientsPage.list().resourceTable().goToDetailsPage(OIDC_CREATE_DATA.APP_NAME);
153+
oidcClientDetailPage.waitForUrlPathWithoutContext();
143154

144155
// let's regen the secret we've added the step before
145156
oidcClientDetailPage.secretCardActionMenuToggle(1);

0 commit comments

Comments
 (0)