Cypress: new Redact and NoRedact tests (#618)

This commit is contained in:
Adam Kol
2022-01-16 09:57:14 +02:00
committed by GitHub
parent 59fbe4c479
commit 20d69228d3
3 changed files with 28 additions and 107 deletions

View File

@@ -0,0 +1,23 @@
const inHeader = 'User-Header[REDACTED]';
const inBody = '{ "User": "[REDACTED]" }';
const shouldExist = Cypress.env('shouldExist');
it('Loading Mizu', function () {
cy.visit(Cypress.env('testUrl'));
})
it(`should ${shouldExist ? '' : 'not'} include ${inHeader}`, function () {
cy.get('.CollapsibleContainer', { timeout : 15 * 1000}).first().next().then(headerElements => { //TODO change the path and refactor the body and head functions
const allText = headerElements.text();
if (allText.includes(inHeader) !== shouldExist)
throw new Error(`The headers panel doesnt include ${inHeader}`);
});
});
it(`should ${shouldExist ? '' : 'not'} include ${inBody}`, function () {
cy.get('.hljs').then(bodyElement => {
const line = bodyElement.text();
if (line.includes(inBody) !== shouldExist)
throw new Error(`The body panel doesnt include ${inBody}`);
});
});