Fix acceptance test (body size and right side pane changes) (#907)

This commit is contained in:
gadotroee 2022-03-22 09:56:34 +02:00 committed by GitHub
parent 308fa78955
commit 2a31739100
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 25 deletions

View File

@ -142,7 +142,9 @@ function deepCheck(generalDict, protocolDict, methodDict, entry) {
if (value) { if (value) {
if (value.tab === valueTabs.response) if (value.tab === valueTabs.response)
cy.contains('Response').click(); // temporary fix, change to some "data-cy" attribute,
// this will fix the issue that happen because we have "response:" in the header of the right side
cy.get('#rightSideContainer > :nth-child(3)').contains('Response').click();
cy.get(Cypress.env('bodyJsonClass')).then(text => { cy.get(Cypress.env('bodyJsonClass')).then(text => {
expect(text.text()).to.match(value.regex) expect(text.text()).to.match(value.regex)
}); });

View File

@ -40,32 +40,23 @@ it('filtering guide check', function () {
}); });
it('right side sanity test', function () { it('right side sanity test', function () {
cy.get('#entryDetailedTitleBodySize').then(sizeTopLine => { cy.get('#entryDetailedTitleElapsedTime').then(timeInMs => {
const sizeOnTopLine = sizeTopLine.text().replace(' B', ''); const time = timeInMs.text();
cy.contains('Response').click(); if (time < '0ms') {
cy.contains('Body Size (bytes)').parent().next().then(size => { throw new Error(`The time in the top line cannot be negative ${time}`);
const bodySizeByDetails = size.text(); }
expect(sizeOnTopLine).to.equal(bodySizeByDetails, 'The body size in the top line should match the details in the response'); });
if (parseInt(bodySizeByDetails) < 0) { // temporary fix, change to some "data-cy" attribute,
throw new Error(`The body size cannot be negative. got the size: ${bodySizeByDetails}`) // this will fix the issue that happen because we have "response:" in the header of the right side
} cy.get('#rightSideContainer > :nth-child(3)').contains('Response').click();
cy.get('#entryDetailedTitleElapsedTime').then(timeInMs => { cy.get('#rightSideContainer [title="Status Code"]').then(status => {
const time = timeInMs.text(); const statusCode = status.text();
if (time < '0ms') { cy.contains('Status').parent().next().then(statusInDetails => {
throw new Error(`The time in the top line cannot be negative ${time}`); const statusCodeInDetails = statusInDetails.text();
}
cy.get('#rightSideContainer [title="Status Code"]').then(status => { expect(statusCode).to.equal(statusCodeInDetails, 'The status code in the top line should match the status code in details');
const statusCode = status.text();
cy.contains('Status').parent().next().then(statusInDetails => {
const statusCodeInDetails = statusInDetails.text();
expect(statusCode).to.equal(statusCodeInDetails, 'The status code in the top line should match the status code in details');
});
});
});
}); });
}); });
}); });
@ -252,7 +243,9 @@ function deeperChcek(leftSidePath, rightSidePath, filterName, leftSideExpectedTe
} }
function checkRightSideResponseBody() { function checkRightSideResponseBody() {
cy.contains('Response').click(); // temporary fix, change to some "data-cy" attribute,
// this will fix the issue that happen because we have "response:" in the header of the right side
cy.get('#rightSideContainer > :nth-child(3)').contains('Response').click();
clickCheckbox('Decode Base64'); clickCheckbox('Decode Base64');
cy.get(`${Cypress.env('bodyJsonClass')}`).then(value => { cy.get(`${Cypress.env('bodyJsonClass')}`).then(value => {