Skip to content

Commit d1fb032

Browse files
authored
fix: fix flaky about test (#5872)
1 parent 6cccb32 commit d1fb032

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

cypress/e2e/shared/about.test.ts

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,41 @@
11
import {Organization} from '../../../src/types'
22

33
describe('About Page', () => {
4+
const apiOrgPath =
5+
Cypress.env('dexUrl') === 'OSS' ? '/api/v2/orgs/*' : '/api/v2/quartz/orgs/*'
6+
const CLOUD = Cypress.env('dexUrl') === 'OSS' ? false : true
7+
48
beforeEach(() => {
59
cy.flush()
610
cy.signin()
711

12+
cy.intercept('GET', apiOrgPath).as('getOrg')
13+
cy.intercept('GET', `${apiOrgPath}/users`).as('getOrgUsers')
14+
cy.intercept('GET', `${apiOrgPath}/invites`).as('getOrgInvites')
15+
cy.intercept('PATCH', apiOrgPath).as('patchOrg')
816
cy.get('@org').then((org: Organization) => {
917
cy.visit(`/orgs/${org.id}/org-settings`)
1018
cy.getByTestID('about-page--header').should('be.visible')
1119
})
1220
})
1321

1422
it('should display everything correctly', () => {
15-
cy.getByTestID('common-ids--panel').within(() => {
16-
cy.getByTestID('code-snippet--userid').should('exist')
17-
cy.getByTestID('copy-btn--userid').should('not.be.disabled')
23+
if (CLOUD) {
24+
cy.wait('@getOrg')
25+
cy.wait('@getOrgUsers')
26+
cy.wait('@getOrgInvites')
27+
}
28+
cy.getByTestID('code-snippet--userid').should('be.visible')
29+
cy.getByTestID('copy-btn--userid').should('not.be.disabled')
1830

19-
cy.getByTestID('code-snippet--orgid').should('exist')
20-
cy.getByTestID('copy-btn--orgid').should('not.be.disabled')
21-
})
31+
cy.getByTestID('code-snippet--orgid').should('be.visible')
32+
cy.getByTestID('copy-btn--orgid').should('not.be.disabled')
2233

23-
cy.getByTestID('organization-profile--panel').within(() => {
24-
cy.getByTestID('rename-org--button').click()
25-
})
34+
if (CLOUD) {
35+
cy.getByTestID('org-profile--panel').contains('Cloud Provider')
36+
}
37+
38+
cy.getByTestID('rename-org--button').should('be.visible').click()
2639

2740
cy.getByTestID('danger-confirmation--button').click()
2841
cy.getByTestID('form--element-error').should('not.exist')
@@ -41,10 +54,6 @@ describe('About Page', () => {
4154

4255
const newOrgName = `hard@knock.life${Math.random()}`
4356

44-
const patchOrgPath =
45-
Cypress.env('dexUrl') === 'OSS' ? 'api/v2/orgs/*' : 'api/v2/quartz/orgs/*'
46-
47-
cy.intercept('PATCH', patchOrgPath).as('patchOrg')
4857
cy.getByTestID('create-org-name-input').type(newOrgName)
4958
cy.getByTestID('rename-org-submit--button')
5059
.should('not.be.disabled')

0 commit comments

Comments
 (0)