Skip to content

Commit f5becb6

Browse files
committed
Update Flow Framework tests
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
1 parent 57db1eb commit f5becb6

File tree

1 file changed

+44
-82
lines changed

1 file changed

+44
-82
lines changed

cypress/integration/plugins/dashboards-flow-framework/create_workflow_spec.js

+44-82
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('Creating Workflows Using Various Methods', () => {
4040
cy.visit(FF_URL.WORKFLOWS, { timeout: FF_TIMEOUT });
4141
});
4242

43-
it('create workflow using import', () => {
43+
it('Import workflow with valid configuration', () => {
4444
CURRENT_TENANT.newTenant = 'global';
4545
cy.wait(20000);
4646
cy.getElementByDataTestId('importWorkflowButton', { timeout: FF_TIMEOUT })
@@ -67,7 +67,7 @@ describe('Creating Workflows Using Various Methods', () => {
6767
.click();
6868
});
6969

70-
it('Workflow Creation with Improper Import File', () => {
70+
it('Attempt to import workflow with invalid configuration', () => {
7171
cy.getElementByDataTestId('importWorkflowButton', { timeout: FF_TIMEOUT })
7272
.should('be.visible')
7373
.click();
@@ -82,15 +82,20 @@ describe('Creating Workflows Using Various Methods', () => {
8282
);
8383
});
8484

85-
it('create workflow using Semantic Search template', () => {
85+
it('Create workflow using semantic search template', () => {
8686
cy.getElementByDataTestId('createWorkflowButton', { timeout: FF_TIMEOUT })
8787
.should('be.visible')
8888
.click();
8989
cy.contains('h3', 'Semantic Search', { timeout: FF_TIMEOUT })
9090
.should('be.visible')
9191
.parents('.euiCard')
9292
.within(() => {
93-
cy.contains('button', 'Go').click();
93+
cy.contains('button', 'Create').click();
94+
});
95+
cy.contains('label', 'Name')
96+
.invoke('attr', 'for')
97+
.then((id) => {
98+
cy.get(`#${id}`).clear().type('semantic_search');
9499
});
95100
cy.getElementByDataTestId('optionalConfigurationButton', {
96101
timeout: FF_TIMEOUT,
@@ -100,7 +105,6 @@ describe('Creating Workflows Using Various Methods', () => {
100105
cy.getElementByDataTestId('selectDeployedModel')
101106
.should('be.visible')
102107
.click();
103-
cy.get('.euiSuperSelect__item').should('be.visible');
104108
cy.get('.euiSuperSelect__item').contains('BedRock').click();
105109
cy.contains('label', 'Text field')
106110
.invoke('attr', 'for')
@@ -114,16 +118,14 @@ describe('Creating Workflows Using Various Methods', () => {
114118
cy.getElementByDataTestId('selectDataToImportButton')
115119
.should('be.visible')
116120
.click();
117-
cy.getElementByDataTestId('uploadSourceDataButton')
118-
.should('be.visible')
119-
.click();
121+
cy.get(`[data-text="Upload file"]`).should('be.visible').click();
120122
const filePath = `cypress/fixtures/${FF_FIXTURE_BASE_PATH}semantic_search/source_data.json`;
121123
cy.get('input[type=file]').selectFile(filePath);
122124
cy.getElementByDataTestId('updateSourceDataButton')
123125
.should('be.visible')
124126
.click();
125127
cy.mockIngestion(() => {
126-
cy.getElementByDataTestId('runIngestionButton')
128+
cy.getElementByTestId('updateAndRunIngestButton')
127129
.should('be.visible')
128130
.click();
129131
});
@@ -161,85 +163,21 @@ describe('Creating Workflows Using Various Methods', () => {
161163
cy.getElementByDataTestId('updateSearchQueryButton')
162164
.should('be.visible')
163165
.click();
164-
cy.mockSemanticSearchIndexSearch(() => {
165-
cy.getElementByDataTestId('runQueryButton').should('be.visible').click();
166-
});
167-
// Checking Run query response
168-
cy.sa_getElementByText('button.euiTab', 'Search response')
169-
.should('be.visible')
170-
.click();
171-
172-
cy.fixture(FF_FIXTURE_BASE_PATH + 'semantic_search/search_response').then(
173-
() => {
174-
cy.get('#tools_panel_id').should('be.visible');
175-
}
176-
);
177-
});
178-
179-
it('create workflow using Sentiment Analysis template', () => {
180-
cy.getElementByDataTestId('createWorkflowButton', { timeout: FF_TIMEOUT })
181-
.should('be.visible')
182-
.click();
183-
cy.contains('h3', 'Sentiment Analysis', { timeout: FF_TIMEOUT })
184-
.should('be.visible')
185-
.parents('.euiCard')
186-
.within(() => {
187-
cy.contains('button', 'Go').click();
188-
});
189-
cy.getElementByDataTestId('quickConfigureCreateButton')
190-
.should('be.visible')
191-
.click();
192-
cy.url().should('include', WORKFLOW_DETAIL_URL_SEGMENT);
166+
cy.getElementByTestId('updateSearchButton').should('be.visible').click();
167+
cy.getElementByTestId('searchButton').should('be.visible').click();
168+
// TODO: further search response validation can be completed when the UI is finalized in how it is displayed.
193169
});
194170

195-
it('create workflow using Hybrid Search template', () => {
196-
cy.getElementByDataTestId('createWorkflowButton', { timeout: FF_TIMEOUT })
197-
.should('be.visible')
198-
.click();
199-
cy.contains('h3', 'Hybrid Search', { timeout: FF_TIMEOUT })
200-
.should('be.visible')
201-
.parents('.euiCard')
202-
.within(() => {
203-
cy.contains('button', 'Go').click();
204-
});
205-
cy.getElementByDataTestId('quickConfigureCreateButton')
206-
.should('be.visible')
207-
.click();
208-
cy.url().should('include', WORKFLOW_DETAIL_URL_SEGMENT);
171+
it('Create workflow from hybrid search template', () => {
172+
createPreset('Hybrid Search');
209173
});
210174

211-
it('create workflow using Multimodal Search template', () => {
212-
cy.getElementByDataTestId('createWorkflowButton', { timeout: FF_TIMEOUT })
213-
.should('be.visible')
214-
.click();
215-
cy.contains('h3', 'Multimodal Search', { timeout: FF_TIMEOUT })
216-
.should('be.visible')
217-
.parents('.euiCard')
218-
.within(() => {
219-
cy.contains('button', 'Go').click();
220-
});
221-
cy.getElementByDataTestId('quickConfigureCreateButton')
222-
.should('be.visible')
223-
.click();
224-
cy.url().should('include', WORKFLOW_DETAIL_URL_SEGMENT);
175+
it('Create workflow from multimodal template', () => {
176+
createPreset('Multimodal Search');
225177
});
226178

227-
it('create workflow using Retrieval-Augmented Generation (RAG) template', () => {
228-
cy.getElementByDataTestId('createWorkflowButton', { timeout: FF_TIMEOUT })
229-
.should('be.visible')
230-
.click();
231-
cy.contains('h3', 'Retrieval-Augmented Generation (RAG)', {
232-
timeout: FF_TIMEOUT,
233-
})
234-
.should('be.visible')
235-
.parents('.euiCard')
236-
.within(() => {
237-
cy.contains('button', 'Go').click();
238-
});
239-
cy.getElementByDataTestId('quickConfigureCreateButton')
240-
.should('be.visible')
241-
.click();
242-
cy.url().should('include', WORKFLOW_DETAIL_URL_SEGMENT);
179+
it('Create workflow from custom template', () => {
180+
createPreset('Custom');
243181
});
244182

245183
after(() => {
@@ -249,3 +187,27 @@ describe('Creating Workflows Using Various Methods', () => {
249187
}
250188
});
251189
});
190+
191+
// Reusable fn to check the preset exists, and able to create it, and navigate to its details page.
192+
function createPreset(presetName) {
193+
cy.getElementByDataTestId('createWorkflowButton', { timeout: FF_TIMEOUT })
194+
.should('be.visible')
195+
.click();
196+
cy.contains('h3', presetName, { timeout: FF_TIMEOUT })
197+
.should('be.visible')
198+
.parents('.euiCard')
199+
.within(() => {
200+
cy.contains('button', 'Create').click();
201+
});
202+
cy.contains('label', 'Name')
203+
.invoke('attr', 'for')
204+
.then((id) => {
205+
cy.get(`#${id}`)
206+
.clear()
207+
.type(presetName.toLowerCase().replace(/\s/g, ''));
208+
});
209+
cy.getElementByDataTestId('quickConfigureCreateButton')
210+
.should('be.visible')
211+
.click();
212+
cy.url().should('include', WORKFLOW_DETAIL_URL_SEGMENT);
213+
}

0 commit comments

Comments
 (0)