mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-05 04:23:09 +00:00
Cypress: refactor for Redact and NoRedact tests (#656)
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
export function isValueExistsInElement(shouldInclude, content, domPathToContainer){
|
||||
it(`should ${shouldInclude ? '' : 'not'} include '${content}'`, function () {
|
||||
cy.get(domPathToContainer).then(htmlText => {
|
||||
const allTextString = htmlText.text();
|
||||
if (allTextString.includes(content) !== shouldInclude)
|
||||
throw new Error(`One of the containers part contains ${content}`)
|
||||
});
|
||||
});
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
import {findLineAndCheck, getExpectedDetailsDict} from '../page_objects/StatusBar';
|
||||
import {findLineAndCheck, getExpectedDetailsDict} from '../testHelpers/StatusBarHelper';
|
||||
|
||||
it('opening', function () {
|
||||
cy.visit(Cypress.env('testUrl'));
|
||||
|
8
acceptanceTests/cypress/integration/tests/NoRedact.js
Normal file
8
acceptanceTests/cypress/integration/tests/NoRedact.js
Normal file
@@ -0,0 +1,8 @@
|
||||
import {isValueExistsInElement, isValueExistsInElement} from '../testHelpers/TrafficHelper';
|
||||
|
||||
it('Loading Mizu', function () {
|
||||
cy.visit(Cypress.env('testUrl'));
|
||||
})
|
||||
|
||||
isValueExistsInElement(false, Cypress.env('redactHeaderContent'), '#tbody-Headers');
|
||||
isValueExistsInElement(false, Cypress.env('redactBodyContent'), '.hljs');
|
8
acceptanceTests/cypress/integration/tests/Redact.js
Normal file
8
acceptanceTests/cypress/integration/tests/Redact.js
Normal file
@@ -0,0 +1,8 @@
|
||||
import {isValueExistsInElement, isValueExistsInElement} from '../testHelpers/TrafficHelper';
|
||||
|
||||
it('Loading Mizu', function () {
|
||||
cy.visit(Cypress.env('testUrl'));
|
||||
})
|
||||
|
||||
isValueExistsInElement(true, Cypress.env('redactHeaderContent'), '#tbody-Headers');
|
||||
isValueExistsInElement(true, Cypress.env('redactBodyContent'), '.hljs');
|
@@ -1,23 +0,0 @@
|
||||
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}`);
|
||||
});
|
||||
});
|
@@ -1,4 +1,4 @@
|
||||
import {getExpectedDetailsDict, checkLine} from '../page_objects/StatusBar';
|
||||
import {getExpectedDetailsDict, checkLine} from '../testHelpers/StatusBarHelper';
|
||||
|
||||
|
||||
it('opening', function () {
|
||||
|
Reference in New Issue
Block a user