Skip to content

Commit

Permalink
[8.15] [Cloud Security]Fix for flaky FTRs caused by duplicate names (#…
Browse files Browse the repository at this point in the history
…187784) (#187916)

# Backport

This will backport the following commits from `main` to `8.15`:
- [[Cloud Security]Fix for flaky FTRs caused by duplicate names
(#187784)](#187784)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Rickyanto
Ang","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-07-09T20:01:00Z","message":"[Cloud
Security]Fix for flaky FTRs caused by duplicate names (#187784)\n\n##
Summary\r\n\r\nThis PR is to address the following flaky
FTRs\r\nhttps://github.com//issues/186302\r\nhttps://github.com//issues/186315\r\nhttps://github.com//issues/186387\r\nhttps://github.com//issues/186389\r\n\r\nThe
flakiness are being caused by having duplicate names for
the\r\nintegration when adding them. We tried adding wait before
clicking on\r\nthe Save button however that doesn't seem to work as it
starts failing\r\nin the flaky test runner\r\n\r\nThis PR gives the
Integration a specific name (not relying on
auto\r\nnaming)","sha":"45b0c251913b6978195291a5d317972fe8c83ddb","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Cloud
Security","v8.15.0","v8.16.0"],"title":"[Cloud Security]Fix for flaky
FTRs caused by duplicate
names","number":187784,"url":"https://github.com/elastic/kibana/pull/187784","mergeCommit":{"message":"[Cloud
Security]Fix for flaky FTRs caused by duplicate names (#187784)\n\n##
Summary\r\n\r\nThis PR is to address the following flaky
FTRs\r\nhttps://github.com//issues/186302\r\nhttps://github.com//issues/186315\r\nhttps://github.com//issues/186387\r\nhttps://github.com//issues/186389\r\n\r\nThe
flakiness are being caused by having duplicate names for
the\r\nintegration when adding them. We tried adding wait before
clicking on\r\nthe Save button however that doesn't seem to work as it
starts failing\r\nin the flaky test runner\r\n\r\nThis PR gives the
Integration a specific name (not relying on
auto\r\nnaming)","sha":"45b0c251913b6978195291a5d317972fe8c83ddb"}},"sourceBranch":"main","suggestedTargetBranches":["8.15"],"targetPullRequestStates":[{"branch":"8.15","label":"v8.15.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/187784","number":187784,"mergeCommit":{"message":"[Cloud
Security]Fix for flaky FTRs caused by duplicate names (#187784)\n\n##
Summary\r\n\r\nThis PR is to address the following flaky
FTRs\r\nhttps://github.com//issues/186302\r\nhttps://github.com//issues/186315\r\nhttps://github.com//issues/186387\r\nhttps://github.com//issues/186389\r\n\r\nThe
flakiness are being caused by having duplicate names for
the\r\nintegration when adding them. We tried adding wait before
clicking on\r\nthe Save button however that doesn't seem to work as it
starts failing\r\nin the flaky test runner\r\n\r\nThis PR gives the
Integration a specific name (not relying on
auto\r\nnaming)","sha":"45b0c251913b6978195291a5d317972fe8c83ddb"}}]}]
BACKPORT-->

Co-authored-by: Rickyanto Ang <[email protected]>
  • Loading branch information
kibanamachine and animehart authored Jul 9, 2024
1 parent 1e231f8 commit 85619da
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import { v4 as uuidv4 } from 'uuid';
import type { FtrProviderContext } from '../ftr_provider_context';

export function AddCisIntegrationFormPageProvider({
Expand Down Expand Up @@ -282,6 +283,12 @@ export function AddCisIntegrationFormPageProvider({
return await testSubjects.find(`button-replace-${secretField}`);
};

const inputUniqueIntegrationName = async () => {
const flyout = await testSubjects.find('createPackagePolicy_page');
const nameField = await flyout.findAllByCssSelector('input[id="name"]');
await nameField[0].type(uuidv4());
};

return {
cisAzure,
cisAws,
Expand Down Expand Up @@ -316,5 +323,6 @@ export function AddCisIntegrationFormPageProvider({
isOptionChecked,
checkIntegrationPliAuthBlockExists,
getReplaceSecretButton,
inputUniqueIntegrationName,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ export default function (providerContext: FtrProviderContext) {
await cisIntegration.navigateToAddIntegrationCspmPage();
});

// FLAKY: https://github.com/elastic/kibana/issues/186302
describe.skip('CNVM AWS', () => {
describe('CNVM AWS', () => {
it('Hyperlink on PostInstallation Modal should have the correct URL', async () => {
await cisIntegration.navigateToAddIntegrationCnvmPage();
await cisIntegration.inputUniqueIntegrationName();
await pageObjects.header.waitUntilLoadingHasFinished();
await cisIntegration.clickSaveButton();
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
expect(
(await cisIntegration.getUrlOnPostInstallModal()) ===
'https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-whatis-howdoesitwork.html'
Expand All @@ -50,8 +51,10 @@ export default function (providerContext: FtrProviderContext) {

it('Clicking on Launch CloudFormation on post intall modal should lead user to Cloud Formation page', async () => {
await cisIntegration.navigateToAddIntegrationCnvmPage();
await cisIntegration.inputUniqueIntegrationName();
await pageObjects.header.waitUntilLoadingHasFinished();
await cisIntegration.clickSaveButton();
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
expect(
(
await cisIntegration.clickLaunchAndGetCurrentUrl(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ export default function (providerContext: FtrProviderContext) {
it('Hyperlink on PostInstallation Modal should have the correct URL', async () => {
await cisIntegration.clickOptionButton(CIS_AWS_OPTION_TEST_ID);
await cisIntegration.clickSaveButton();
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
expect((await cisIntegrationAws.getPostInstallCloudFormationModal()) !== undefined).to.be(
true
);
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
expect(
(await cisIntegration.getUrlOnPostInstallModal()) ===
'https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-whatis-howdoesitwork.html'
Expand All @@ -73,7 +73,7 @@ export default function (providerContext: FtrProviderContext) {
it('Clicking on Launch CloudFormation on post intall modal should lead user to Cloud Formation page', async () => {
await cisIntegration.clickOptionButton(CIS_AWS_OPTION_TEST_ID);
await cisIntegration.clickSaveButton();
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
expect(
(
await cisIntegration.clickLaunchAndGetCurrentUrl(
Expand All @@ -92,7 +92,7 @@ export default function (providerContext: FtrProviderContext) {
await cisIntegration.clickOptionButton(AWS_MANUAL_TEST_ID);
await cisIntegration.fillInTextField(ROLE_ARN_TEST_ID, roleArn);
await cisIntegration.clickSaveButton();
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
expect((await cisIntegration.getPostInstallModal()) !== undefined).to.be(true);
await cisIntegration.navigateToIntegrationCspList();
expect((await cisIntegration.getFieldValueInEditPage(ROLE_ARN_TEST_ID)) === roleArn).to.be(
Expand All @@ -109,15 +109,15 @@ export default function (providerContext: FtrProviderContext) {
await cisIntegration.clickOptionButton(AWS_MANUAL_TEST_ID);
await cisIntegration.clickOptionButton(AWS_CREDENTIAL_SELECTOR);
await cisIntegration.selectValue(AWS_CREDENTIAL_SELECTOR, 'direct_access_keys');
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
await cisIntegration.clickOptionButton(AWS_MANUAL_TEST_ID);
await cisIntegration.fillInTextField(DIRECT_ACCESS_KEY_ID_TEST_ID, directAccessKeyId);
await cisIntegration.fillInTextField(
DIRECT_ACCESS_SECRET_KEY_TEST_ID,
directAccessSecretKey
);
await cisIntegration.clickSaveButton();
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
expect((await cisIntegration.getPostInstallModal()) !== undefined).to.be(true);
await cisIntegration.navigateToIntegrationCspList();
expect(
Expand All @@ -137,7 +137,7 @@ export default function (providerContext: FtrProviderContext) {
await cisIntegration.clickOptionButton(AWS_MANUAL_TEST_ID);
await cisIntegration.clickOptionButton(AWS_CREDENTIAL_SELECTOR);
await cisIntegration.selectValue(AWS_CREDENTIAL_SELECTOR, 'temporary_keys');
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
await cisIntegration.clickOptionButton(AWS_MANUAL_TEST_ID);
await cisIntegration.fillInTextField(TEMP_ACCESS_KEY_ID_TEST_ID, accessKeyId);
await cisIntegration.fillInTextField(
Expand All @@ -149,7 +149,7 @@ export default function (providerContext: FtrProviderContext) {
tempAccessSessionToken
);
await cisIntegration.clickSaveButton();
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
expect((await cisIntegration.getPostInstallModal()) !== undefined).to.be(true);
await cisIntegration.navigateToIntegrationCspList();
await cisIntegration.clickFirstElementOnIntegrationTable();
Expand All @@ -172,15 +172,15 @@ export default function (providerContext: FtrProviderContext) {
await cisIntegration.clickOptionButton(AWS_MANUAL_TEST_ID);
await cisIntegration.clickOptionButton(AWS_CREDENTIAL_SELECTOR);
await cisIntegration.selectValue(AWS_CREDENTIAL_SELECTOR, 'shared_credentials');
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
await cisIntegration.clickOptionButton(AWS_MANUAL_TEST_ID);
await cisIntegration.fillInTextField(SHARED_CREDENTIALS_FILE_TEST_ID, sharedCredentialFile);
await cisIntegration.fillInTextField(
SHARED_CREDETIALS_PROFILE_NAME_TEST_ID,
sharedCredentialProfileName
);
await cisIntegration.clickSaveButton();
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
expect((await cisIntegration.getPostInstallModal()) !== undefined).to.be(true);
await cisIntegration.navigateToIntegrationCspList();
await cisIntegration.clickFirstElementOnIntegrationTable();
Expand All @@ -200,7 +200,7 @@ export default function (providerContext: FtrProviderContext) {
await cisIntegration.clickOptionButton(CIS_AWS_OPTION_TEST_ID);
await cisIntegration.clickOptionButton(AWS_SINGLE_ACCOUNT_TEST_ID);
await cisIntegration.clickSaveButton();
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
expect(
(await cisIntegration.getUrlOnPostInstallModal()) ===
'https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-whatis-howdoesitwork.html'
Expand All @@ -216,7 +216,7 @@ export default function (providerContext: FtrProviderContext) {
await cisIntegration.clickOptionButton(AWS_MANUAL_TEST_ID);
await cisIntegration.fillInTextField(ROLE_ARN_TEST_ID, roleArn);
await cisIntegration.clickSaveButton();
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
expect((await cisIntegration.getPostInstallModal()) !== undefined).to.be(true);
await cisIntegration.navigateToIntegrationCspList();
expect((await cisIntegration.getFieldValueInEditPage(ROLE_ARN_TEST_ID)) === roleArn).to.be(
Expand All @@ -234,15 +234,15 @@ export default function (providerContext: FtrProviderContext) {
await cisIntegration.clickOptionButton(AWS_MANUAL_TEST_ID);
await cisIntegration.clickOptionButton(AWS_CREDENTIAL_SELECTOR);
await cisIntegration.selectValue(AWS_CREDENTIAL_SELECTOR, 'direct_access_keys');
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
await cisIntegration.clickOptionButton(AWS_MANUAL_TEST_ID);
await cisIntegration.fillInTextField(DIRECT_ACCESS_KEY_ID_TEST_ID, directAccessKeyId);
await cisIntegration.fillInTextField(
DIRECT_ACCESS_SECRET_KEY_TEST_ID,
directAccessSecretKey
);
await cisIntegration.clickSaveButton();
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
expect((await cisIntegration.getPostInstallModal()) !== undefined).to.be(true);
await cisIntegration.navigateToIntegrationCspList();
expect(
Expand All @@ -263,7 +263,7 @@ export default function (providerContext: FtrProviderContext) {
await cisIntegration.clickOptionButton(AWS_MANUAL_TEST_ID);
await cisIntegration.clickOptionButton(AWS_CREDENTIAL_SELECTOR);
await cisIntegration.selectValue(AWS_CREDENTIAL_SELECTOR, 'temporary_keys');
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
await cisIntegration.clickOptionButton(AWS_MANUAL_TEST_ID);
await cisIntegration.fillInTextField(TEMP_ACCESS_KEY_ID_TEST_ID, accessKeyId);
await cisIntegration.fillInTextField(
Expand All @@ -275,7 +275,7 @@ export default function (providerContext: FtrProviderContext) {
tempAccessSessionToken
);
await cisIntegration.clickSaveButton();
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
expect((await cisIntegration.getPostInstallModal()) !== undefined).to.be(true);
await cisIntegration.navigateToIntegrationCspList();
await cisIntegration.clickFirstElementOnIntegrationTable();
Expand All @@ -299,15 +299,15 @@ export default function (providerContext: FtrProviderContext) {
await cisIntegration.clickOptionButton(AWS_MANUAL_TEST_ID);
await cisIntegration.clickOptionButton(AWS_CREDENTIAL_SELECTOR);
await cisIntegration.selectValue(AWS_CREDENTIAL_SELECTOR, 'shared_credentials');
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
await cisIntegration.clickOptionButton(AWS_MANUAL_TEST_ID);
await cisIntegration.fillInTextField(SHARED_CREDENTIALS_FILE_TEST_ID, sharedCredentialFile);
await cisIntegration.fillInTextField(
SHARED_CREDETIALS_PROFILE_NAME_TEST_ID,
sharedCredentialProfileName
);
await cisIntegration.clickSaveButton();
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
expect((await cisIntegration.getPostInstallModal()) !== undefined).to.be(true);
await cisIntegration.navigateToIntegrationCspList();
await cisIntegration.clickFirstElementOnIntegrationTable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default function (providerContext: FtrProviderContext) {
await cisIntegration.clickOptionButton(CIS_AZURE_OPTION_TEST_ID);
await cisIntegration.clickOptionButton(CIS_AZURE_SETUP_FORMAT_TEST_SUBJECTS.ARM_TEMPLATE);
await cisIntegration.clickSaveButton();
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
expect((await cisIntegrationAzure.getPostInstallArmTemplateModal()) !== undefined).to.be(
true
);
Expand All @@ -70,7 +70,7 @@ export default function (providerContext: FtrProviderContext) {
await cisIntegration.clickOptionButton(CIS_AZURE_SETUP_FORMAT_TEST_SUBJECTS.MANUAL);
await cisIntegration.selectValue(AZURE_CREDENTIAL_SELECTOR, 'managed_identity');
await cisIntegration.clickSaveButton();
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
expect((await cisIntegration.getPostInstallModal()) !== undefined).to.be(true);
});
});
Expand All @@ -83,7 +83,7 @@ export default function (providerContext: FtrProviderContext) {
AZURE_CREDENTIAL_SELECTOR,
'service_principal_with_client_secret'
);
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
await cisIntegration.fillInTextField(
CIS_AZURE_INPUT_FIELDS_TEST_SUBJECTS.CLIENT_ID,
clientId
Expand All @@ -97,7 +97,7 @@ export default function (providerContext: FtrProviderContext) {
clientSecret
);
await cisIntegration.clickSaveButton();
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
expect((await cisIntegration.getPostInstallModal()) !== undefined).to.be(true);
await cisIntegration.navigateToIntegrationCspList();
await cisIntegration.clickFirstElementOnIntegrationTable();
Expand All @@ -123,7 +123,7 @@ export default function (providerContext: FtrProviderContext) {
AZURE_CREDENTIAL_SELECTOR,
'service_principal_with_client_certificate'
);
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
await cisIntegration.fillInTextField(
CIS_AZURE_INPUT_FIELDS_TEST_SUBJECTS.CLIENT_ID,
clientId
Expand All @@ -137,7 +137,7 @@ export default function (providerContext: FtrProviderContext) {
clientCertificatePath
);
await cisIntegration.clickSaveButton();
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
expect((await cisIntegration.getPostInstallModal()) !== undefined).to.be(true);
await cisIntegration.navigateToIntegrationCspList();
await cisIntegration.clickFirstElementOnIntegrationTable();
Expand All @@ -164,7 +164,7 @@ export default function (providerContext: FtrProviderContext) {
await cisIntegration.clickOptionButton(CIS_AZURE_OPTION_TEST_ID);
await cisIntegration.clickOptionButton(CIS_AZURE_SINGLE_SUB_TEST_ID);
await cisIntegration.clickSaveButton();
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
expect((await cisIntegrationAzure.getPostInstallArmTemplateModal()) !== undefined).to.be(
true
);
Expand All @@ -182,7 +182,7 @@ export default function (providerContext: FtrProviderContext) {
await cisIntegration.clickOptionButton(CIS_AZURE_SETUP_FORMAT_TEST_SUBJECTS.MANUAL);
await cisIntegration.selectValue(AZURE_CREDENTIAL_SELECTOR, 'managed_identity');
await cisIntegration.clickSaveButton();
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
expect((await cisIntegration.getPostInstallModal()) !== undefined).to.be(true);
});
});
Expand All @@ -195,7 +195,7 @@ export default function (providerContext: FtrProviderContext) {
AZURE_CREDENTIAL_SELECTOR,
'service_principal_with_client_secret'
);
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
await cisIntegration.fillInTextField(
CIS_AZURE_INPUT_FIELDS_TEST_SUBJECTS.CLIENT_ID,
clientId
Expand All @@ -209,7 +209,7 @@ export default function (providerContext: FtrProviderContext) {
clientSecret
);
await cisIntegration.clickSaveButton();
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
expect((await cisIntegration.getPostInstallModal()) !== undefined).to.be(true);
await cisIntegration.navigateToIntegrationCspList();
await cisIntegration.clickFirstElementOnIntegrationTable();
Expand All @@ -235,7 +235,7 @@ export default function (providerContext: FtrProviderContext) {
AZURE_CREDENTIAL_SELECTOR,
'service_principal_with_client_certificate'
);
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
await cisIntegration.fillInTextField(
CIS_AZURE_INPUT_FIELDS_TEST_SUBJECTS.CLIENT_ID,
clientId
Expand All @@ -249,7 +249,7 @@ export default function (providerContext: FtrProviderContext) {
clientCertificatePath
);
await cisIntegration.clickSaveButton();
pageObjects.header.waitUntilLoadingHasFinished();
await pageObjects.header.waitUntilLoadingHasFinished();
expect((await cisIntegration.getPostInstallModal()) !== undefined).to.be(true);
await cisIntegration.navigateToIntegrationCspList();
await cisIntegration.clickFirstElementOnIntegrationTable();
Expand Down
Loading

0 comments on commit 85619da

Please sign in to comment.