Skip to content

Commit 8ea4f5f

Browse files
authored
Merge pull request #9707 from asirvadAbrahamVarghese/zone-form-cypress-refactor
Chain .then() directly to interceptApi for returning zone name
2 parents cfb6e56 + d808e9f commit 8ea4f5f

File tree

1 file changed

+19
-18
lines changed
  • cypress/e2e/ui/Settings/Application-Settings

1 file changed

+19
-18
lines changed

cypress/e2e/ui/Settings/Application-Settings/zone.cy.js

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -64,24 +64,25 @@ function addZone() {
6464
cy.getFormSelectFieldById({
6565
selectId: 'settings.concurrent_vm_scans',
6666
}).select(INITIAL_MAX_SCAN_LIMIT);
67-
cy.interceptApi({
68-
alias: 'createZoneApi',
69-
urlPattern: '/api/zones',
70-
triggerFn: () =>
71-
cy
72-
.getFormButtonByTypeWithText({
73-
buttonText: ADD_BUTTON_TEXT,
74-
buttonType: 'submit',
75-
})
76-
.should('be.enabled')
77-
.click(),
78-
onApiResponse: (interception) => {
79-
expect(interception.response.statusCode).to.equal(200);
80-
},
81-
});
82-
return cy.then(() => {
83-
return `Zone: ${INITIAL_ZONE_DESCRIPTION}`;
84-
});
67+
return cy
68+
.interceptApi({
69+
alias: 'createZoneApi',
70+
urlPattern: '/api/zones',
71+
triggerFn: () =>
72+
cy
73+
.getFormButtonByTypeWithText({
74+
buttonText: ADD_BUTTON_TEXT,
75+
buttonType: 'submit',
76+
})
77+
.should('be.enabled')
78+
.click(),
79+
onApiResponse: (interception) => {
80+
expect(interception.response.statusCode).to.equal(200);
81+
},
82+
})
83+
.then(() => {
84+
return `Zone: ${INITIAL_ZONE_DESCRIPTION}`;
85+
});
8586
}
8687

8788
function validateFormElements(isEditForm = false) {

0 commit comments

Comments
 (0)