Skip to content

Commit c037914

Browse files
authored
Added Integration Tests Workflow (backport 2.x) (#433)
* Added Integration Tests Workflow Signed-off-by: saimedhi <saimedhi@amazon.com> * Added Integration Tests Workflow Signed-off-by: saimedhi <saimedhi@amazon.com> --------- Signed-off-by: saimedhi <saimedhi@amazon.com>
1 parent 613b818 commit c037914

File tree

5 files changed

+179
-1
lines changed

5 files changed

+179
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
name: FTR E2E FF Workbench Test
2+
3+
on: [pull_request, push]
4+
5+
env:
6+
CI: 1
7+
TERM: xterm
8+
OPENSEARCH_DASHBOARDS_VERSION: '2.x'
9+
10+
jobs:
11+
tests:
12+
name: Run FTR E2E FF Workbench Tests
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [ ubuntu-latest ]
17+
jdk: [ 21 ]
18+
runs-on: ${{ matrix.os }}
19+
20+
steps:
21+
- name: Set up JDK
22+
uses: actions/setup-java@v1
23+
with:
24+
java-version: ${{ matrix.jdk }}
25+
26+
- name: Checkout Flow-Framework
27+
uses: actions/checkout@v2
28+
with:
29+
path: flow-framework
30+
repository: opensearch-project/flow-framework
31+
ref: '${{ github.base_ref }}'
32+
33+
- name: Run OpenSearch with plugin
34+
run: |
35+
cd flow-framework
36+
./gradlew run &
37+
timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9200)" != "200" ]]; do sleep 5; done'
38+
shell: bash
39+
40+
- name: Check OpenSearch Running on Linux
41+
if: ${{ runner.os != 'Windows'}}
42+
run: curl http://localhost:9200/
43+
shell: bash
44+
45+
- name: Checkout OpenSearch Dashboards
46+
uses: actions/checkout@v2
47+
with:
48+
path: OpenSearch-Dashboards
49+
repository: opensearch-project/OpenSearch-Dashboards
50+
ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }}
51+
fetch-depth: 0
52+
filter: |
53+
cypress
54+
test
55+
56+
- name: Checkout FF in OpenSearch Dashboards Plugins Dir
57+
uses: actions/checkout@v2
58+
with:
59+
path: OpenSearch-Dashboards/plugins/dashboards-flow-framework
60+
61+
- id: tool-versions
62+
run: |
63+
echo "node_version=$(cat .node-version)" >> $GITHUB_OUTPUT
64+
echo "yarn_version=$(jq -r '.engines.yarn' package.json)" >> $GITHUB_OUTPUT
65+
working-directory: OpenSearch-Dashboards
66+
shell: bash
67+
68+
- uses: actions/setup-node@v1
69+
with:
70+
node-version: ${{ steps.tool-versions.outputs.node_version }}
71+
registry-url: 'https://registry.npmjs.org'
72+
73+
- name: Setup Opensearch Dashboards
74+
run: |
75+
npm uninstall -g yarn
76+
echo "Installing yarn ${{ steps.tool-versions.outputs.yarn_version }}"
77+
npm i -g yarn@${{ steps.tool-versions.outputs.yarn_version }}
78+
yarn cache clean
79+
yarn add sha.js
80+
working-directory: OpenSearch-Dashboards
81+
shell: bash
82+
83+
- name: Bootstrap Opensearch Dashboards
84+
run: |
85+
yarn osd bootstrap --single-version=loose
86+
working-directory: OpenSearch-Dashboards/plugins/dashboards-flow-framework
87+
88+
- name: Run Opensearch Dashboards with FF Installed
89+
run: |
90+
nohup yarn start --no-base-path --no-watch --server.host="0.0.0.0" | tee dashboard.log &
91+
sleep 60
92+
working-directory: OpenSearch-Dashboards
93+
94+
- name : Check If OpenSearch Dashboards Is Ready
95+
if: ${{ runner.os == 'Linux' }}
96+
run: |
97+
if timeout 600 grep -q "bundles compiled successfully after" <(tail -n0 -f dashboard.log); then
98+
echo "OpenSearch Dashboards compiled successfully."
99+
else
100+
echo "Timeout for 600 seconds reached. OpenSearch Dashboards did not finish compiling."
101+
exit 1
102+
fi
103+
working-directory: OpenSearch-Dashboards
104+
105+
- name: Show OpenSearch Dashboards Logs
106+
if: always()
107+
run: cat dashboard.log
108+
working-directory: OpenSearch-Dashboards
109+
110+
- name: Health check
111+
run: |
112+
timeout 600 bash -c 'while [[ "$(curl -k http://localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do sleep 5; done'
113+
shell: bash
114+
115+
- name: Check OpenSearch Dashboards Running on Linux
116+
if: ${{ runner.os != 'Windows'}}
117+
run: curl http://localhost:5601/api/status
118+
shell: bash
119+
120+
- name: Checkout Dashboards Functional Test Repo
121+
uses: actions/checkout@v2
122+
with:
123+
path: opensearch-dashboards-functional-test
124+
repository: opensearch-project/opensearch-dashboards-functional-test
125+
ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }}
126+
fetch-depth: 0
127+
128+
- name: Install Cypress
129+
run: |
130+
npm install cypress --save-dev
131+
shell: bash
132+
working-directory: opensearch-dashboards-functional-test
133+
134+
- name: Get Cypress version
135+
id: cypress_version
136+
run: |
137+
echo "::set-output name=cypress_version::$(cat ./package.json | jq '.dependencies.cypress' | tr -d '"')"
138+
working-directory: opensearch-dashboards-functional-test
139+
140+
- name: Finding spec files and store to output
141+
id: finding-files
142+
run: |
143+
{
144+
echo 'FILELIST<<EOF'
145+
find cypress/integration/plugins/dashboards-flow-framework -name '*.js' -print
146+
echo EOF
147+
} >> "$GITHUB_ENV"
148+
working-directory: opensearch-dashboards-functional-test
149+
150+
- name: Run spec files from output
151+
run: |
152+
env CYPRESS_NO_COMMAND_LOG=1 yarn cypress:run-without-security --browser chromium --spec 'cypress/integration/plugins/dashboards-flow-framework/*'
153+
working-directory: opensearch-dashboards-functional-test
154+
155+
- name: Capture failure screenshots
156+
uses: actions/upload-artifact@v4
157+
if: failure()
158+
with:
159+
name: cypress-screenshots-${{ matrix.os }}
160+
path: opensearch-dashboards-functional-test/cypress/screenshots
161+
162+
- name: Capture failure test video
163+
uses: actions/upload-artifact@v4
164+
if: failure()
165+
with:
166+
name: cypress-videos-${{ matrix.os }}
167+
path: opensearch-dashboards-functional-test/cypress/videos
168+

public/pages/workflow_detail/workflow_inputs/ingest_inputs/source_data.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,15 @@ export function SourceData(props: SourceDataProps) {
202202
id={SOURCE_OPTIONS.MANUAL}
203203
hasActiveFilters={selectedOption === SOURCE_OPTIONS.MANUAL}
204204
onClick={() => setSelectedOption(SOURCE_OPTIONS.MANUAL)}
205+
data-testid="manualEditSourceDataButton"
205206
>
206207
Manual
207208
</EuiSmallFilterButton>
208209
<EuiSmallFilterButton
209210
id={SOURCE_OPTIONS.UPLOAD}
210211
hasActiveFilters={selectedOption === SOURCE_OPTIONS.UPLOAD}
211212
onClick={() => setSelectedOption(SOURCE_OPTIONS.UPLOAD)}
213+
data-testid="uploadSourceDataButton"
212214
>
213215
Upload
214216
</EuiSmallFilterButton>
@@ -220,6 +222,7 @@ export function SourceData(props: SourceDataProps) {
220222
onClick={() =>
221223
setSelectedOption(SOURCE_OPTIONS.EXISTING_INDEX)
222224
}
225+
data-testid="selectIndexSourceDataButton"
223226
>
224227
Existing index
225228
</EuiSmallFilterButton>
@@ -281,6 +284,7 @@ export function SourceData(props: SourceDataProps) {
281284
onClick={() => setIsEditModalOpen(false)}
282285
fill={false}
283286
color="primary"
287+
data-testid="closeSourceDataButton"
284288
>
285289
Close
286290
</EuiSmallButton>
@@ -306,6 +310,7 @@ export function SourceData(props: SourceDataProps) {
306310
fill={false}
307311
style={{ width: '100px' }}
308312
onClick={() => setIsEditModalOpen(true)}
313+
data-testid="editSourceDataButton"
309314
>
310315
{docsPopulated ? `Edit` : `Select data`}
311316
</EuiSmallButton>

public/pages/workflow_detail/workflow_inputs/search_inputs/edit_query_modal.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,14 @@ export function EditQueryModal(props: EditQueryModalProps) {
4545
<EuiModal
4646
onClose={() => props.setModalOpen(false)}
4747
style={{ width: '70vw' }}
48+
data-testid="editQueryModal"
4849
>
4950
<EuiModalHeader>
5051
<EuiModalHeaderTitle>
5152
<p>{`Edit query`}</p>
5253
</EuiModalHeaderTitle>
5354
</EuiModalHeader>
54-
<EuiModalBody>
55+
<EuiModalBody data-testid="editQueryModalBody">
5556
<EuiPopover
5657
button={
5758
<EuiSmallButton

public/pages/workflows/import_workflow/import_workflow_modal.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ export function ImportWorkflowModal(props: ImportWorkflowModalProps) {
173173
onModalClose();
174174
});
175175
}}
176+
data-testid="importJSONButton"
176177
fill={true}
177178
color="primary"
178179
>

public/pages/workflows/new_workflow/quick_configure_inputs.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ export function QuickConfigureInputs(props: QuickConfigureInputsProps) {
159159
id="optionalConfiguration"
160160
buttonContent="Optional configuration"
161161
initialIsOpen={false}
162+
data-testid="optionalConfigurationButton"
162163
>
163164
<EuiSpacer size="m" />
164165
<EuiCompressedFormRow
@@ -180,6 +181,7 @@ export function QuickConfigureInputs(props: QuickConfigureInputsProps) {
180181
}
181182
>
182183
<EuiCompressedSuperSelect
184+
data-testid="selectDeployedModel"
183185
fullWidth={true}
184186
options={deployedModels.map(
185187
(option) =>
@@ -228,6 +230,7 @@ export function QuickConfigureInputs(props: QuickConfigureInputsProps) {
228230
}`}
229231
>
230232
<EuiCompressedFieldText
233+
data-testid="textFieldQuickConfigure"
231234
fullWidth={true}
232235
value={fieldValues?.textField || ''}
233236
onChange={(e) => {

0 commit comments

Comments
 (0)