mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
# Backport This will backport the following commits from `main` to `8.10`: - [[Security Solution] Fix Related integrations Cypress test (#165481)](https://github.com/elastic/kibana/pull/165481) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Juan Pablo Djeredjian","email":"jpdjeredjian@gmail.com"},"sourceCommit":{"committedDate":"2023-09-01T16:32:13Z","message":"[Security Solution] Fix Related integrations Cypress test (#165481)","sha":"d2381149fdaae6070fa007953f3969924916a6e9","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["test","release_note:skip","Team:Detections and Resp","Team: SecuritySolution","Team:Detection Rule Management","Feature:Related Integrations","v8.10.0","v8.11.0"],"number":165481,"url":"https://github.com/elastic/kibana/pull/165481","mergeCommit":{"message":"[Security Solution] Fix Related integrations Cypress test (#165481)","sha":"d2381149fdaae6070fa007953f3969924916a6e9"}},"sourceBranch":"main","suggestedTargetBranches":["8.10"],"targetPullRequestStates":[{"branch":"8.10","label":"v8.10.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/165481","number":165481,"mergeCommit":{"message":"[Security Solution] Fix Related integrations Cypress test (#165481)","sha":"d2381149fdaae6070fa007953f3969924916a6e9"}}]}] BACKPORT--> Co-authored-by: Juan Pablo Djeredjian <jpdjeredjian@gmail.com>
This commit is contained in:
parent
181820026a
commit
de6c207632
1 changed files with 34 additions and 8 deletions
|
@ -222,14 +222,29 @@ describe('Related integrations', { tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] },
|
|||
openTable();
|
||||
filterBy(RELATED_INTEGRATION_FIELD);
|
||||
|
||||
RULE_RELATED_INTEGRATIONS.forEach((integration) => {
|
||||
cy.contains(
|
||||
FIELD(RELATED_INTEGRATION_FIELD),
|
||||
`{"package":"${integration.package}"${
|
||||
integration.integration ? `,"integration":"${integration.integration}"` : ''
|
||||
},"version":"${integration.version}"}`
|
||||
);
|
||||
});
|
||||
cy.get(FIELD(RELATED_INTEGRATION_FIELD))
|
||||
.invoke('text')
|
||||
.then((stringValue) => {
|
||||
// Integrations are displayed in the flyout as a string with a format like so:
|
||||
// '{"package":"aws","version":"1.17.0","integration":"unknown"}{"package":"mock","version":"1.1.0"}{"package":"system","version":"1.17.0"}'
|
||||
// We need to parse it to an array of valid objects before we can compare it to the expected value
|
||||
// Otherwise, the test might fail because of the order of the properties in the objects in the string
|
||||
const jsonStringArray = stringValue.split('}{');
|
||||
|
||||
const validJsonStringArray = createValidJsonStringArray(jsonStringArray);
|
||||
|
||||
const parsedIntegrations = validJsonStringArray.map((jsonString) =>
|
||||
JSON.parse(jsonString)
|
||||
);
|
||||
|
||||
RULE_RELATED_INTEGRATIONS.forEach((integration) => {
|
||||
expect(parsedIntegrations).to.deep.include({
|
||||
package: integration.package,
|
||||
version: integration.version,
|
||||
...(integration.integration ? { integration: integration.integration } : {}),
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -408,3 +423,14 @@ const AWS_PACKAGE_POLICY: PackagePolicyWithoutAgentPolicyId = {
|
|||
},
|
||||
},
|
||||
};
|
||||
|
||||
const createValidJsonStringArray = (jsonStringArray: string[]) =>
|
||||
jsonStringArray.map((jsonString, index) => {
|
||||
if (index === 0) {
|
||||
return `${jsonString}}`;
|
||||
} else if (index === jsonStringArray.length - 1) {
|
||||
return `{${jsonString}`;
|
||||
} else {
|
||||
return `{${jsonString}}`;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue