From 63d0248c40fc2fde037204fea44e67f1b5aeccac Mon Sep 17 00:00:00 2001 From: Celiant Date: Mon, 29 Jul 2024 13:33:43 +0400 Subject: [PATCH] update contracts tab and fixes for pipeline --- .../api-tests/contracts/getContracts.cy.js | 4 +- .../api-tests/contracts/getPermissions.cy.js | 40 +++++++++---------- .../e2e/api-tests/contracts/getPools.cy.js | 2 +- .../e2e/api-tests/contracts/getRequests.cy.js | 8 ++-- .../contracts/setAndRemovePermissions.cy.js | 10 +++-- e2e-tests/cypress/support/e2e.js | 2 +- 6 files changed, 34 insertions(+), 32 deletions(-) diff --git a/e2e-tests/cypress/e2e/api-tests/contracts/getContracts.cy.js b/e2e-tests/cypress/e2e/api-tests/contracts/getContracts.cy.js index 6ffe815c8..a65ac0253 100644 --- a/e2e-tests/cypress/e2e/api-tests/contracts/getContracts.cy.js +++ b/e2e-tests/cypress/e2e/api-tests/contracts/getContracts.cy.js @@ -139,8 +139,8 @@ context("Contracts", { tags: ['contracts', 'firstPool'] }, () => { }, failOnStatusCode: false, }).then((response) => { - expect(response.status).eql(STATUS_CODE.ERROR); - //expect(response.status).eql(STATUS_CODE.FORBIDDEN); + //expect(response.status).eql(STATUS_CODE.ERROR); + expect(response.status).eql(STATUS_CODE.UNPROCESSABLE); }); }); }); diff --git a/e2e-tests/cypress/e2e/api-tests/contracts/getPermissions.cy.js b/e2e-tests/cypress/e2e/api-tests/contracts/getPermissions.cy.js index 21d1e6e5c..ccb439e28 100644 --- a/e2e-tests/cypress/e2e/api-tests/contracts/getPermissions.cy.js +++ b/e2e-tests/cypress/e2e/api-tests/contracts/getPermissions.cy.js @@ -39,39 +39,39 @@ context("Contracts", { tags: ['contracts', 'firstPool'] }, () => { contractIdW = response.body.id; contractIdHedW = response.body.contractId; }); + cy.request({ - method: METHOD.POST, - url: API.ApiServer + API.AccountsLogin, - body: { - username: username, - password: "test" - } + method: METHOD.GET, + url: API.ApiServer + API.RandomKey, + headers: { + authorization + }, }).then((response) => { + cy.wait(3000) + let hederaAccountId = response.body.id + let hederaAccountKey = response.body.key cy.request({ method: METHOD.POST, - url: API.ApiServer + API.AccessToken, + url: API.ApiServer + API.AccountsLogin, body: { - refreshToken: response.body.refreshToken + username: username, + password: "test" } }).then((response) => { - let accessToken = "Bearer " + response.body.accessToken cy.request({ - method: METHOD.GET, - url: API.ApiServer + API.RandomKey, - headers: { - authorization - }, + method: METHOD.POST, + url: API.ApiServer + API.AccessToken, + body: { + refreshToken: response.body.refreshToken + } }).then((response) => { - cy.wait(3000) - let hederaAccountId = response.body.id - let hederaAccountKey = response.body.key + let accessToken = "Bearer " + response.body.accessToken cy.request({ method: METHOD.PUT, url: API.ApiServer + API.Profiles + username, body: { - parent: SRDid, - hederaAccountId: response.body.id, - hederaAccountKey: response.body.key, + hederaAccountId: hederaAccountId, + hederaAccountKey: hederaAccountKey, useFireblocksSigning: false, fireblocksConfig: { diff --git a/e2e-tests/cypress/e2e/api-tests/contracts/getPools.cy.js b/e2e-tests/cypress/e2e/api-tests/contracts/getPools.cy.js index f1357c2bd..0f255b3c1 100644 --- a/e2e-tests/cypress/e2e/api-tests/contracts/getPools.cy.js +++ b/e2e-tests/cypress/e2e/api-tests/contracts/getPools.cy.js @@ -168,7 +168,7 @@ context("Contracts", { tags: ['contracts', 'firstPool'] }, () => { }, failOnStatusCode: false, }).then((response) => { - expect(response.status).eql(STATUS_CODE.ERROR); + expect(response.status).eql(STATUS_CODE.UNPROCESSABLE); //expect(response.status).eql(STATUS_CODE.FORBIDDEN); }); }); diff --git a/e2e-tests/cypress/e2e/api-tests/contracts/getRequests.cy.js b/e2e-tests/cypress/e2e/api-tests/contracts/getRequests.cy.js index 5bbab5eb1..70a9496a1 100644 --- a/e2e-tests/cypress/e2e/api-tests/contracts/getRequests.cy.js +++ b/e2e-tests/cypress/e2e/api-tests/contracts/getRequests.cy.js @@ -4,11 +4,11 @@ import * as Checks from "../../../support/checkingMethods"; context("Contracts", { tags: ['contracts', 'firstPool'] },() => { const authorization = Cypress.env("authorization"); - const username = Math.floor(Math.random() * 999) + "User"; - const contractNameR = Math.floor(Math.random() * 999) + "RCon4RequestsTests"; - const contractNameW = Math.floor(Math.random() * 999) + "WCon4RequestsTests"; + let username = Math.floor(Math.random() * 999) + "User"; + let contractNameR = Math.floor(Math.random() * 999) + "RCon4RequestsTests"; + let contractNameW = Math.floor(Math.random() * 999) + "WCon4RequestsTests"; const optionKey = "option" - let wContractId, rContractId, tokenId, policyId, hederaId, rConractUuid + let wContractId, rContractId, tokenId, tokenid2, policyId, hederaId, rConractUuid let waitForApproveApplicationBlockId, deviceGridBlockId, issueRequestGridBlockId, approveRegistrantBtnBlockId describe("Flow for one NFT token and get requests", () => { diff --git a/e2e-tests/cypress/e2e/api-tests/contracts/setAndRemovePermissions.cy.js b/e2e-tests/cypress/e2e/api-tests/contracts/setAndRemovePermissions.cy.js index 59e8a138b..a7067d35c 100644 --- a/e2e-tests/cypress/e2e/api-tests/contracts/setAndRemovePermissions.cy.js +++ b/e2e-tests/cypress/e2e/api-tests/contracts/setAndRemovePermissions.cy.js @@ -318,7 +318,7 @@ context("Contracts", { tags: ['contracts', 'firstPool'] }, () => { }, }).then((response) => { expect(response.status).eql(STATUS_CODE.OK); - expect(response.body).eql("14"); + expect(response.body).eql(14); }); }) }); @@ -349,7 +349,7 @@ context("Contracts", { tags: ['contracts', 'firstPool'] }, () => { }, }).then((response) => { expect(response.status).eql(STATUS_CODE.OK); - expect(response.body).eql("2"); + expect(response.body).eql(2); }); }) }); @@ -552,6 +552,7 @@ context("Contracts", { tags: ['contracts', 'firstPool'] }, () => { }); it("Verify roles(wipe)", () => { + cy.wait(60000) cy.request({ method: METHOD.POST, url: API.ApiServer + API.AccountsLogin, @@ -576,13 +577,14 @@ context("Contracts", { tags: ['contracts', 'firstPool'] }, () => { }, }).then((response) => { expect(response.status).eql(STATUS_CODE.OK); - expect(response.body).eql("0"); + expect(response.body).eql(0); }); }) }); }); it("Verify roles(retire)", () => { + cy.wait(60000) cy.request({ method: METHOD.POST, url: API.ApiServer + API.AccountsLogin, @@ -607,7 +609,7 @@ context("Contracts", { tags: ['contracts', 'firstPool'] }, () => { }, }).then((response) => { expect(response.status).eql(STATUS_CODE.OK); - expect(response.body).eql("0"); + expect(response.body).eql(0); }); }) }); diff --git a/e2e-tests/cypress/support/e2e.js b/e2e-tests/cypress/support/e2e.js index 7ca723642..0e5a9acf0 100644 --- a/e2e-tests/cypress/support/e2e.js +++ b/e2e-tests/cypress/support/e2e.js @@ -76,7 +76,7 @@ before(() => { "@context": [], }, }, - timeout: 200000, + timeout: 400000, }).then(() => { cy.log("hedera credentials was created"); });