mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
refactor(cypress_tests): handle api keys check in api key list call (#5719)
This commit is contained in:
@ -228,10 +228,10 @@ Cypress.Commands.add("apiKeyRetrieveCall", (globalState) => {
|
|||||||
|
|
||||||
Cypress.Commands.add("apiKeyListCall", (globalState) => {
|
Cypress.Commands.add("apiKeyListCall", (globalState) => {
|
||||||
const merchant_id = globalState.get("merchantId");
|
const merchant_id = globalState.get("merchantId");
|
||||||
|
const base_url = globalState.get("baseUrl");
|
||||||
cy.request({
|
cy.request({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: `${globalState.get("baseUrl")}/api_keys/${merchant_id}/list`,
|
url: `${base_url}/api_keys/${merchant_id}/list`,
|
||||||
headers: {
|
headers: {
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@ -244,8 +244,13 @@ Cypress.Commands.add("apiKeyListCall", (globalState) => {
|
|||||||
expect(response.body).to.be.an("array").and.not.empty;
|
expect(response.body).to.be.an("array").and.not.empty;
|
||||||
for (const key in response.body) {
|
for (const key in response.body) {
|
||||||
expect(response.body[key]).to.have.property("name").and.not.empty;
|
expect(response.body[key]).to.have.property("name").and.not.empty;
|
||||||
expect(response.body[key]).to.have.property("key_id").include("snd_").and
|
if (base_url.includes("sandbox") || base_url.includes("integ")) {
|
||||||
.not.empty;
|
expect(response.body[key]).to.have.property("key_id").include("snd_")
|
||||||
|
.and.not.empty;
|
||||||
|
} else if (base_url.includes("localhost")) {
|
||||||
|
expect(response.body[key]).to.have.property("key_id").include("dev_")
|
||||||
|
.and;
|
||||||
|
}
|
||||||
expect(response.body[key].merchant_id).to.equal(merchant_id);
|
expect(response.body[key].merchant_id).to.equal(merchant_id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user