From f33e1bb65c9ea9bed782e7f9049fd216db057c6b Mon Sep 17 00:00:00 2001 From: Pa1NarK <69745008+pixincreate@users.noreply.github.com> Date: Wed, 28 Aug 2024 13:10:20 +0530 Subject: [PATCH] refactor(cypress_tests): handle api keys check in api key list call (#5719) --- cypress-tests/cypress/support/commands.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js index 3affe123db..55130ae7c5 100644 --- a/cypress-tests/cypress/support/commands.js +++ b/cypress-tests/cypress/support/commands.js @@ -228,10 +228,10 @@ Cypress.Commands.add("apiKeyRetrieveCall", (globalState) => { Cypress.Commands.add("apiKeyListCall", (globalState) => { const merchant_id = globalState.get("merchantId"); - + const base_url = globalState.get("baseUrl"); cy.request({ method: "GET", - url: `${globalState.get("baseUrl")}/api_keys/${merchant_id}/list`, + url: `${base_url}/api_keys/${merchant_id}/list`, headers: { Accept: "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; for (const key in response.body) { expect(response.body[key]).to.have.property("name").and.not.empty; - expect(response.body[key]).to.have.property("key_id").include("snd_").and - .not.empty; + if (base_url.includes("sandbox") || base_url.includes("integ")) { + 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); } });