Skip to content

Commit 6a0c453

Browse files
committed
update tests to first type in combo box so option is visible
Signed-off-by: Amit Galitzky <amgalitz@amazon.com>
1 parent dbf086e commit 6a0c453

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

cypress/integration/plugins/anomaly-detection-dashboards-plugin/create_remote_detector_spec.js

+28-15
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ context('Create remote detector workflow', () => {
1717
const TEST_TIMESTAMP_NAME = 'timestamp'; // coming from single_index_response.json fixture
1818
const TEST_INDEX_NAME = 'sample-ad-index';
1919
const TEST_SECOND_INDEX_NAME = 'sample-ad-index-two';
20-
const TEST_REMOTE_INDEX = 'followCluster:sample-ad-index';
20+
//const TEST_REMOTE_INDEX = 'followCluster:sample-ad-index';
2121

2222
// Clean up created resources
2323
afterEach(() => {
@@ -97,6 +97,8 @@ context('Create remote detector workflow', () => {
9797
// Index some sample data in local and follower cluster (remote)
9898
beforeEach(() => {
9999
cy.visit(AD_URL.OVERVIEW, { timeout: 10000 });
100+
cy.deleteAllIndices();
101+
cy.deleteADSystemIndices();
100102
const remoteEndpointTestData = `${Cypress.env(
101103
'remoteDataSourceNoAuthUrl'
102104
)}/${TEST_INDEX_NAME}/_bulk`;
@@ -178,10 +180,10 @@ context('Create remote detector workflow', () => {
178180

179181
cy.getElementByTestId('indicesFilter').click();
180182
cy.wait(1000);
181-
cy.contains(
182-
'.euiComboBoxOption__content',
183+
184+
cy.getElementByTestId('indicesFilter').type(
183185
`${remoteClusterName}:sample-ad-index`
184-
).click();
186+
);
185187

186188
selectTopItemFromFilter('timestampFilter', false);
187189

@@ -213,7 +215,9 @@ context('Create remote detector workflow', () => {
213215
cy.getElementByTestId('detectorDescriptionCell').contains(
214216
TEST_DETECTOR_DESCRIPTION
215217
);
216-
cy.getElementByTestId('indexNameCell').contains(TEST_REMOTE_INDEX);
218+
cy.getElementByTestId('indexNameCell').contains(
219+
`${remoteClusterName}:sample-ad-index`
220+
);
217221
cy.getElementByTestId('timestampNameCell').contains(TEST_TIMESTAMP_NAME);
218222
cy.getElementByTestId('featureTable').contains(TEST_FEATURE_NAME);
219223

@@ -250,19 +254,28 @@ context('Create remote detector workflow', () => {
250254

251255
cy.wait(3000);
252256

257+
// Open the combo box
253258
cy.getElementByTestId('indicesFilter').click();
254-
cy.wait(1000);
259+
cy.wait(500);
255260

256-
cy.contains(
257-
'.euiComboBoxOption__content',
258-
`${remoteClusterName}:sample-ad-index`
259-
).click();
260-
cy.contains('.euiComboBoxOption__content', 'sample-ad-index').click();
261+
// Type and select the first option
262+
cy.getElementByTestId('indicesFilter').type(`sample-ad-index`);
263+
cy.wait(500); // Wait for the dropdown to populate
264+
cy.get('.euiComboBoxOption__content')
265+
.contains(`${remoteClusterName}:sample-ad-index`)
266+
.click();
261267

262-
cy.contains(
263-
'.euiComboBoxOption__content',
264-
`${remoteClusterName}:sample-ad-index-two`
265-
).click();
268+
// Type and select the second option
269+
cy.getElementByTestId('indicesFilter').type('sample-ad-index');
270+
cy.wait(500);
271+
cy.get('.euiComboBoxOption__content').contains('sample-ad-index').click();
272+
273+
// Type and select the third option
274+
cy.getElementByTestId('indicesFilter').type(`sample-ad-index-two`);
275+
cy.wait(500);
276+
cy.get('.euiComboBoxOption__content')
277+
.contains(`${remoteClusterName}:sample-ad-index-two`)
278+
.click();
266279

267280
selectTopItemFromFilter('timestampFilter', false);
268281

0 commit comments

Comments
 (0)