diff --git a/acceptanceTests/cypress.json b/acceptanceTests/cypress.json index 44ae98c89..a0fe7f827 100644 --- a/acceptanceTests/cypress.json +++ b/acceptanceTests/cypress.json @@ -8,10 +8,13 @@ "testFiles": ["tests/GuiPort.js", "tests/MultipleNamespaces.js", - "tests/RedactTests.js", + "tests/Redact.js", + "tests/NoRedact.js", "tests/Regex.js"], "env": { - "testUrl": "http://localhost:8899/" + "testUrl": "http://localhost:8899/", + "redactHeaderContent": "User-Header[REDACTED]", + "redactBodyContent": "{ \"User\": \"[REDACTED]\" }" } } diff --git a/acceptanceTests/cypress/integration/page_objects/StatusBar.js b/acceptanceTests/cypress/integration/testHelpers/StatusBarHelper.js similarity index 100% rename from acceptanceTests/cypress/integration/page_objects/StatusBar.js rename to acceptanceTests/cypress/integration/testHelpers/StatusBarHelper.js diff --git a/acceptanceTests/cypress/integration/testHelpers/TrafficHelper.js b/acceptanceTests/cypress/integration/testHelpers/TrafficHelper.js new file mode 100644 index 000000000..e90ec7e11 --- /dev/null +++ b/acceptanceTests/cypress/integration/testHelpers/TrafficHelper.js @@ -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}`) + }); + }); +} diff --git a/acceptanceTests/cypress/integration/tests/MultipleNamespaces.js b/acceptanceTests/cypress/integration/tests/MultipleNamespaces.js index 110f9d13f..96b032e10 100644 --- a/acceptanceTests/cypress/integration/tests/MultipleNamespaces.js +++ b/acceptanceTests/cypress/integration/tests/MultipleNamespaces.js @@ -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')); diff --git a/acceptanceTests/cypress/integration/tests/NoRedact.js b/acceptanceTests/cypress/integration/tests/NoRedact.js new file mode 100644 index 000000000..63bef0335 --- /dev/null +++ b/acceptanceTests/cypress/integration/tests/NoRedact.js @@ -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'); diff --git a/acceptanceTests/cypress/integration/tests/Redact.js b/acceptanceTests/cypress/integration/tests/Redact.js new file mode 100644 index 000000000..47f0c18a6 --- /dev/null +++ b/acceptanceTests/cypress/integration/tests/Redact.js @@ -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'); diff --git a/acceptanceTests/cypress/integration/tests/RedactTests.js b/acceptanceTests/cypress/integration/tests/RedactTests.js deleted file mode 100644 index 7005eeebf..000000000 --- a/acceptanceTests/cypress/integration/tests/RedactTests.js +++ /dev/null @@ -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}`); - }); -}); diff --git a/acceptanceTests/cypress/integration/tests/Regex.js b/acceptanceTests/cypress/integration/tests/Regex.js index b11ef2e58..de449a7a4 100644 --- a/acceptanceTests/cypress/integration/tests/Regex.js +++ b/acceptanceTests/cypress/integration/tests/Regex.js @@ -1,4 +1,4 @@ -import {getExpectedDetailsDict, checkLine} from '../page_objects/StatusBar'; +import {getExpectedDetailsDict, checkLine} from '../testHelpers/StatusBarHelper'; it('opening', function () { diff --git a/acceptanceTests/tap_test.go b/acceptanceTests/tap_test.go index 381c5ed0f..4a61db1ee 100644 --- a/acceptanceTests/tap_test.go +++ b/acceptanceTests/tap_test.go @@ -377,7 +377,7 @@ func TestTapRedact(t *testing.T) { } } - runCypressTests(t, fmt.Sprintf("npx cypress run --spec \"cypress/integration/tests/RedactTests.js\" --env shouldExist=true")) + runCypressTests(t, fmt.Sprintf("npx cypress run --spec \"cypress/integration/tests/Redact.js\"")) } func TestTapNoRedact(t *testing.T) { @@ -429,7 +429,7 @@ func TestTapNoRedact(t *testing.T) { } } - runCypressTests(t, "npx cypress run --spec \"cypress/integration/tests/RedactTests.js\" --env shouldExist=false") + runCypressTests(t, "npx cypress run --spec \"cypress/integration/tests/NoRedact.js\"") } func TestTapRegexMasking(t *testing.T) { diff --git a/ui/src/components/EntriesList.tsx b/ui/src/components/EntriesList.tsx index 532af5ee0..5aa7aac6e 100644 --- a/ui/src/components/EntriesList.tsx +++ b/ui/src/components/EntriesList.tsx @@ -148,7 +148,7 @@ export const EntriesList: React.FC = ({listEntryREF, onSnapBro
-
Displaying {entries?.length} results out of {queriedTotal} total
+
Displaying {entries?.length} results out of {queriedTotal} total
{startTime !== 0 &&
Started listening at {Moment(truncatedTimestamp ? truncatedTimestamp : startTime).utc().format('MM/DD/YYYY, h:mm:ss.SSS A')}
}