Skip to content

Commit

Permalink
Add response code check instead of wait
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Liang <[email protected]>
  • Loading branch information
RyanL1997 committed Nov 27, 2023
1 parent 88b1e65 commit 57db33e
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions .cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,33 +46,37 @@ Cypress.Commands.add('createTenant', (tenantID, tenantJson) => {
'PUT',
`${Cypress.env('openSearchUrl')}${SEC_API.TENANTS_BASE}/${tenantID}`,
tenantJson
);
cy.wait(10000);
).then((response) => {
expect(response.status).to.eq(200);
});
});

Cypress.Commands.add('createInternalUser', (userID, userJson) => {
cy.request(
'PUT',
`${Cypress.env('openSearchUrl')}${SEC_API.INTERNALUSERS_BASE}/${userID}`,
userJson
);
cy.wait(10000);
).then((response) => {
expect(response.status).to.eq(200);
});
});

Cypress.Commands.add('createRole', (roleID, roleJson) => {
cy.request(
'PUT',
`${Cypress.env('openSearchUrl')}${SEC_API.ROLE_BASE}/${roleID}`,
roleJson
);
cy.wait(10000);
).then((response) => {
expect(response.status).to.eq(200);
});
});

Cypress.Commands.add('createRoleMapping', (roleID, rolemappingJson) => {
cy.request(
'PUT',
`${Cypress.env('openSearchUrl')}${SEC_API.ROLE_MAPPING_BASE}/${roleID}`,
rolemappingJson
);
cy.wait(10000);
).then((response) => {
expect(response.status).to.eq(200);
});
});

0 comments on commit 57db33e

Please sign in to comment.