Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Celiant committed Aug 16, 2024
1 parent 89a77c2 commit e982083
Show file tree
Hide file tree
Showing 41 changed files with 2,097 additions and 18 deletions.
4 changes: 2 additions & 2 deletions e2e-tests/cypress/e2e/api-tests/analytics/compareTools.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ context("Analytics", { tags: ['analytics', 'thirdPool'] }, () => {
})
.then((response) => {
expect(response.status).to.eq(STATUS_CODE.SUCCESS);
toolId1 = response.body.id;
toolId1 = response.body.tool.id;
cy.request({
method: METHOD.POST,
url: API.ApiServer + API.ToolsImportMsg,
Expand All @@ -31,7 +31,7 @@ context("Analytics", { tags: ['analytics', 'thirdPool'] }, () => {
timeout: 180000
}).then((response) => {
expect(response.status).to.eq(STATUS_CODE.SUCCESS);
toolId2 = response.body.id;
toolId2 = response.body.tool.id;
})
})
})
Expand Down
8 changes: 4 additions & 4 deletions e2e-tests/cypress/e2e/api-tests/policies/getPolicies.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ context('Policies', { tags: ['policies', 'secondPool'] }, () => {
timeout: 180000
}).then(response => {
expect(response.status).to.eq(STATUS_CODE.SUCCESS);
let firstPolicyId = response.body.at(-1).id
let firstPolicyStatus = response.body.at(-1).status
let firstPolicyId = response.body.at(0).id
let firstPolicyStatus = response.body.at(0).status
expect(firstPolicyStatus).to.equal('DRAFT')
cy.request({
method: 'PUT',
Expand All @@ -32,8 +32,8 @@ context('Policies', { tags: ['policies', 'secondPool'] }, () => {
timeout: 600000
})
.should((response) => {
let secondPolicyId = response.body.policies.at(-1).id
let policyStatus = response.body.policies.at(-1).status
let secondPolicyId = response.body.policies.at(0).id
let policyStatus = response.body.policies.at(0).status
expect(response.status).to.eq(STATUS_CODE.OK)
expect(firstPolicyId).to.equal(secondPolicyId)
expect(policyStatus).to.equal('PUBLISH')
Expand Down
63 changes: 63 additions & 0 deletions e2e-tests/cypress/e2e/policy-tests/cdm/cdm1.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { METHOD, STATUS_CODE } from "../../../support/api/api-const";
import API from "../../../support/ApiUrls";

context("Policy autotest", { tags: ['policyAT'] }, () => {
const authorization = Cypress.env("authorization");
var policyId, testId;

it("Run test for CDM ACM0001", () => {
//import policy with tests
cy.readFile("../Methodology Library/CDM/CDM ACM0001/ACM0001.policy", "binary")
.then((binary) => Cypress.Blob.binaryStringToBlob(binary))
.then((file) => {
cy.request({
method: METHOD.POST,
url: API.ApiServer + 'policies/import/file?demo=true',
body: file,
headers: {
"content-type": "binary/octet-stream",
authorization,
},
timeout: 180000,
}).then((response) => {
expect(response.status).to.eq(STATUS_CODE.SUCCESS);
});
})

//get policy id and test id
cy.request({
method: METHOD.GET,
url: API.ApiServer + API.Policies,
headers: {
authorization,
},
}).then((response) => {
expect(response.status).to.eq(STATUS_CODE.OK);
policyId = response.body.at(0).id;
testId = response.body.at(0).tests.at(0).id;
cy.request({
method: METHOD.POST,
url: API.ApiServer + API.Policies + policyId + "/test/" + testId + "/start",
headers: {
authorization,
},
}).then((response) => {
expect(response.status).to.eq(STATUS_CODE.OK);
})
cy.wait(90000);
cy.request({
method: METHOD.GET,
url: API.ApiServer + API.Policies,
headers: {
authorization,
},
}).then((response) => {
expect(response.status).to.eq(STATUS_CODE.OK);
expect(response.body.at(0).tests.at(0).status).to.eq("Success");
})
})

//get policy id and test id

})
});
63 changes: 63 additions & 0 deletions e2e-tests/cypress/e2e/policy-tests/cdm/cdm18.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { METHOD, STATUS_CODE } from "../../../support/api/api-const";
import API from "../../../support/ApiUrls";

context("Policy autotest", { tags: ['policyAT'] }, () => {
const authorization = Cypress.env("authorization");
var policyId, testId;

it("Run test for CDM ACM0018", () => {
//import policy with tests
cy.readFile("../Methodology Library/CDM/CDM ACM0018/ACM0018.policy", "binary")
.then((binary) => Cypress.Blob.binaryStringToBlob(binary))
.then((file) => {
cy.request({
method: METHOD.POST,
url: API.ApiServer + 'policies/import/file?demo=true',
body: file,
headers: {
"content-type": "binary/octet-stream",
authorization,
},
timeout: 180000,
}).then((response) => {
expect(response.status).to.eq(STATUS_CODE.SUCCESS);
});
})

//get policy id and test id
cy.request({
method: METHOD.GET,
url: API.ApiServer + API.Policies,
headers: {
authorization,
},
}).then((response) => {
expect(response.status).to.eq(STATUS_CODE.OK);
policyId = response.body.at(0).id;
testId = response.body.at(0).tests.at(0).id;
cy.request({
method: METHOD.POST,
url: API.ApiServer + API.Policies + policyId + "/test/" + testId + "/start",
headers: {
authorization,
},
}).then((response) => {
expect(response.status).to.eq(STATUS_CODE.OK);
})

cy.wait(90000);

cy.request({
method: METHOD.GET,
url: API.ApiServer + API.Policies,
headers: {
authorization,
},
}).then((response) => {
expect(response.status).to.eq(STATUS_CODE.OK);
expect(response.body.at(0).tests.at(0).status).to.eq("Success");
})
})

})
});
63 changes: 63 additions & 0 deletions e2e-tests/cypress/e2e/policy-tests/cdm/cdm2.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { METHOD, STATUS_CODE } from "../../../support/api/api-const";
import API from "../../../support/ApiUrls";

context("Policy autotest", { tags: ['policyAT'] }, () => {
const authorization = Cypress.env("authorization");
var policyId, testId;

it("Run test for CDM ACM0002", () => {
//import policy with tests
cy.readFile("../Methodology Library/CDM/CDM ACM0002/ACM0002.policy", "binary")
.then((binary) => Cypress.Blob.binaryStringToBlob(binary))
.then((file) => {
cy.request({
method: METHOD.POST,
url: API.ApiServer + 'policies/import/file?demo=true',
body: file,
headers: {
"content-type": "binary/octet-stream",
authorization,
},
timeout: 180000,
}).then((response) => {
expect(response.status).to.eq(STATUS_CODE.SUCCESS);
});
})

//get policy id and test id
cy.request({
method: METHOD.GET,
url: API.ApiServer + API.Policies,
headers: {
authorization,
},
}).then((response) => {
expect(response.status).to.eq(STATUS_CODE.OK);
policyId = response.body.at(0).id;
testId = response.body.at(0).tests.at(0).id;
cy.request({
method: METHOD.POST,
url: API.ApiServer + API.Policies + policyId + "/test/" + testId + "/start",
headers: {
authorization,
},
}).then((response) => {
expect(response.status).to.eq(STATUS_CODE.OK);
})

cy.wait(90000);

cy.request({
method: METHOD.GET,
url: API.ApiServer + API.Policies,
headers: {
authorization,
},
}).then((response) => {
expect(response.status).to.eq(STATUS_CODE.OK);
expect(response.body.at(0).tests.at(0).status).to.eq("Success");
})
})

})
});
63 changes: 63 additions & 0 deletions e2e-tests/cypress/e2e/policy-tests/cdm/cdm6.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { METHOD, STATUS_CODE } from "../../../support/api/api-const";
import API from "../../../support/ApiUrls";

context("Policy autotest", { tags: ['policyAT'] }, () => {
const authorization = Cypress.env("authorization");
var policyId, testId;

it("Run test for CDM ACM0006", () => {
//import policy with tests
cy.readFile("../Methodology Library/CDM/CDM ACM0006/ACM0006.policy", "binary")
.then((binary) => Cypress.Blob.binaryStringToBlob(binary))
.then((file) => {
cy.request({
method: METHOD.POST,
url: API.ApiServer + 'policies/import/file?demo=true',
body: file,
headers: {
"content-type": "binary/octet-stream",
authorization,
},
timeout: 180000,
}).then((response) => {
expect(response.status).to.eq(STATUS_CODE.SUCCESS);
});
})

//get policy id and test id
cy.request({
method: METHOD.GET,
url: API.ApiServer + API.Policies,
headers: {
authorization,
},
}).then((response) => {
expect(response.status).to.eq(STATUS_CODE.OK);
policyId = response.body.at(0).id;
testId = response.body.at(0).tests.at(0).id;
cy.request({
method: METHOD.POST,
url: API.ApiServer + API.Policies + policyId + "/test/" + testId + "/start",
headers: {
authorization,
},
}).then((response) => {
expect(response.status).to.eq(STATUS_CODE.OK);
})

cy.wait(90000);

cy.request({
method: METHOD.GET,
url: API.ApiServer + API.Policies,
headers: {
authorization,
},
}).then((response) => {
expect(response.status).to.eq(STATUS_CODE.OK);
expect(response.body.at(0).tests.at(0).status).to.eq("Success");
})
})

})
});
63 changes: 63 additions & 0 deletions e2e-tests/cypress/e2e/policy-tests/cdm/cdm7.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { METHOD, STATUS_CODE } from "../../../support/api/api-const";
import API from "../../../support/ApiUrls";

context("Policy autotest", { tags: ['policyAT'] }, () => {
const authorization = Cypress.env("authorization");
var policyId, testId;

it("Run test for CDM ACM0007", () => {
//import policy with tests
cy.readFile("../Methodology Library/CDM/CDM ACM0007/ACM0007.policy", "binary")
.then((binary) => Cypress.Blob.binaryStringToBlob(binary))
.then((file) => {
cy.request({
method: METHOD.POST,
url: API.ApiServer + 'policies/import/file?demo=true',
body: file,
headers: {
"content-type": "binary/octet-stream",
authorization,
},
timeout: 180000,
}).then((response) => {
expect(response.status).to.eq(STATUS_CODE.SUCCESS);
});
})

//get policy id and test id
cy.request({
method: METHOD.GET,
url: API.ApiServer + API.Policies,
headers: {
authorization,
},
}).then((response) => {
expect(response.status).to.eq(STATUS_CODE.OK);
policyId = response.body.at(0).id;
testId = response.body.at(0).tests.at(0).id;
cy.request({
method: METHOD.POST,
url: API.ApiServer + API.Policies + policyId + "/test/" + testId + "/start",
headers: {
authorization,
},
}).then((response) => {
expect(response.status).to.eq(STATUS_CODE.OK);
})

cy.wait(90000);

cy.request({
method: METHOD.GET,
url: API.ApiServer + API.Policies,
headers: {
authorization,
},
}).then((response) => {
expect(response.status).to.eq(STATUS_CODE.OK);
expect(response.body.at(0).tests.at(0).status).to.eq("Success");
})
})

})
});
Loading

0 comments on commit e982083

Please sign in to comment.