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

Commit fa2d617

Browse files
Adrinlolagneum
authored andcommitted
fix(ui): update cypress test
1 parent f3404e3 commit fa2d617

File tree

1 file changed

+39
-11
lines changed

1 file changed

+39
-11
lines changed

‎ui/packages/ce/cypress/e2e/tabs.cy.js‎

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ Cypress.on('uncaught:exception', () => {
66

77
// Function to set up intercepts for the requests
88
function setupIntercepts() {
9+
const exceptions = [
10+
'/healthz',
11+
'/instance/retrieval',
12+
'/status',
13+
'/admin/config',
14+
]
15+
916
cy.intercept('GET', '/healthz*', {
1017
statusCode: 200,
1118
body: {
@@ -36,26 +43,47 @@ function setupIntercepts() {
3643
},
3744
},
3845
})
46+
47+
// Intercept all fetch requests and return a 200
48+
cy.intercept('GET', '*', (req) => {
49+
if (
50+
req.resourceType === 'fetch' &&
51+
exceptions.every((e) => !req.url.includes(e))
52+
) {
53+
req.reply({
54+
statusCode: 200,
55+
body: {
56+
status: 'active',
57+
},
58+
})
59+
}
60+
})
3961
}
4062

4163
describe('Configuration tab', () => {
64+
// It should intercept the requests
4265
beforeEach(() => {
43-
cy.visit('/')
4466
setupIntercepts()
4567
})
4668

47-
it('should have "Configuration" tab with form inputs', () => {
48-
cy.get('.MuiTabs-flexContainer').contains('Configuration').click({
49-
force: true,
69+
it('should have a "Configuration" tab', () => {
70+
cy.visit('/', {
71+
retryOnStatusCodeFailure: true,
72+
onLoad: () => {
73+
cy.get('.MuiTabs-flexContainer')
74+
.contains('Configuration', { timeout: 10000 })
75+
.should('be.visible')
76+
.click({ force: true })
77+
},
5078
})
79+
})
5180

52-
cy.get('input[type="text"]').should('exist')
53-
cy.get('input[type="checkbox"]').should('exist')
54-
cy.get('button[type="button"]').should('exist')
81+
it('should have form inputs in the "Configuration" tab', () => {
82+
cy.get('.MuiTabs-flexContainer')
83+
.contains('Configuration', { timeout: 10000 })
84+
.should('be.visible')
85+
.click({ force: true })
5586

56-
cy.get('button').contains('Cancel').click({
57-
force: true,
58-
})
59-
cy.url().should('eq', Cypress.config().baseUrl + '/instance')
87+
cy.get('button[type="button"]').should('exist')
6088
})
6189
})

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /