Skip to content

Commit 814382b

Browse files
Merge pull request #4849 from linuxfoundation/unicron-v3-apis-test-coverage-dev-4
Unicron v3 apis test coverage dev 4
2 parents cf381bf + ade631a commit 814382b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2237
-45
lines changed

tests/functional/cypress/e2e/v3/docs.cy.ts

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ describe('To Validate & test Documentation APIs via API call (V3)', function ()
1313
timeout: timeout,
1414
failOnStatusCode: allowFail,
1515
}).then((response) => {
16-
validate_200_Status(response);
17-
expect(response.body).to.not.be.null;
16+
return cy.logJson('response', response).then(() => {
17+
validate_200_Status(response);
18+
expect(response.body).to.not.be.null;
19+
});
1820
});
1921
});
2022

@@ -25,11 +27,13 @@ describe('To Validate & test Documentation APIs via API call (V3)', function ()
2527
timeout: timeout,
2628
failOnStatusCode: allowFail,
2729
}).then((response) => {
28-
validate_200_Status(response);
29-
expect(response.body).to.be.an('object');
30-
expect(response.body).to.have.property('swagger');
31-
expect(response.body).to.have.property('info');
32-
expect(response.body).to.have.property('paths');
30+
return cy.logJson('response', response).then(() => {
31+
validate_200_Status(response);
32+
expect(response.body).to.be.an('object');
33+
expect(response.body).to.have.property('swagger');
34+
expect(response.body).to.have.property('info');
35+
expect(response.body).to.have.property('paths');
36+
});
3337
});
3438
});
3539

@@ -77,14 +81,16 @@ describe('To Validate & test Documentation APIs via API call (V3)', function ()
7781
timeout,
7882
})
7983
.then((response) => {
80-
cy.task('log', `Testing: ${c.title}`);
81-
validate_expected_status(
82-
response,
83-
c.expectedStatus,
84-
c.expectedCode,
85-
c.expectedMessage,
86-
c.expectedMessageContains,
87-
);
84+
return cy.logJson('response', response).then(() => {
85+
cy.task('log', `Testing: ${c.title}`);
86+
validate_expected_status(
87+
response,
88+
c.expectedStatus,
89+
c.expectedCode,
90+
c.expectedMessage,
91+
c.expectedMessageContains,
92+
);
93+
});
8894
});
8995
});
9096
});

tests/functional/cypress/e2e/v3/health.cy.ts

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { validate_200_Status, getAPIBaseURL, validate_expected_status } from '../../support/commands';
1+
import {
2+
validate_200_Status,
3+
validateApiResponse,
4+
getAPIBaseURL,
5+
validate_expected_status,
6+
} from '../../support/commands';
27

38
describe('To Validate & test Health APIs via API call (V3)', function () {
49
const claEndpoint = getAPIBaseURL('v3');
@@ -13,10 +18,13 @@ describe('To Validate & test Health APIs via API call (V3)', function () {
1318
timeout: timeout,
1419
failOnStatusCode: allowFail,
1520
}).then((response) => {
16-
validate_200_Status(response);
17-
expect(response.body).to.be.an('object');
18-
expect(response.body).to.have.property('Status');
19-
expect(response.body.Status).to.equal('healthy');
21+
return cy.logJson('response', response).then(() => {
22+
validate_200_Status(response);
23+
expect(response.body).to.be.an('object');
24+
expect(response.body).to.have.property('Status');
25+
expect(response.body.Status).to.equal('healthy');
26+
validateApiResponse('health/getHealth.json', response);
27+
});
2028
});
2129
});
2230

@@ -54,14 +62,16 @@ describe('To Validate & test Health APIs via API call (V3)', function () {
5462
timeout,
5563
})
5664
.then((response) => {
57-
cy.task('log', `Testing: ${c.title}`);
58-
validate_expected_status(
59-
response,
60-
c.expectedStatus,
61-
c.expectedCode,
62-
c.expectedMessage,
63-
c.expectedMessageContains,
64-
);
65+
return cy.logJson('response', response).then(() => {
66+
cy.task('log', `Testing: ${c.title}`);
67+
validate_expected_status(
68+
response,
69+
c.expectedStatus,
70+
c.expectedCode,
71+
c.expectedMessage,
72+
c.expectedMessageContains,
73+
);
74+
});
6575
});
6676
});
6777
});

tests/functional/cypress/e2e/v3/organization.cy.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
validate_200_Status,
33
validate_401_Status,
4+
validateApiResponse,
45
getAPIBaseURL,
56
validate_expected_status,
67
} from '../../support/commands';
@@ -24,6 +25,7 @@ describe('To Validate & test Organization APIs via API call (V3)', function () {
2425
expect(response.body).to.be.an('object');
2526
expect(response.body.list).to.be.an('array');
2627
expect(response.body.list.length).to.be.greaterThan(0);
28+
validateApiResponse('organization/searchOrganization.json', response);
2729
});
2830
});
2931
});

0 commit comments

Comments
 (0)