Skip to content

Commit 442e11e

Browse files
authored
Migrate query enhancement tests from functional repo to main (opensearch-project#9048)
* migrate query enhacenement tests Signed-off-by: abbyhu2000 <[email protected]> * ignore lint in data files Signed-off-by: abbyhu2000 <[email protected]> * remove yarn lock changes Signed-off-by: abbyhu2000 <[email protected]> * add changelog Signed-off-by: abbyhu2000 <[email protected]> --------- Signed-off-by: abbyhu2000 <[email protected]>
1 parent faa6b54 commit 442e11e

30 files changed

+1380507
-40
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
/test/fixtures/scenarios
1313
node_modules
1414
target
15+
cypress/fixtures
1516

1617
!/.eslintrc.js
1718

.github/workflows/cypress_workflow.yml

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ jobs:
7777
- group: 9
7878
config: standard
7979
test_location: ftr
80-
# Query enhanced tests
80+
# Dashboard tests with query enhanced
8181
- group: 10
8282
config: query_enhanced
83-
test_location: ftr
84-
# Dashboard tests
83+
test_location: source
84+
# Dashboard tests with no query enhanced
8585
- group: 11
8686
config: dashboard
8787
test_location: source
@@ -90,7 +90,7 @@ jobs:
9090
options: --user 1001
9191
env:
9292
START_CMD: ${{ matrix.config == 'query_enhanced' &&
93-
'node ../scripts/opensearch_dashboards --dev --no-base-path --no-watch --savedObjects.maxImportPayloadBytes=10485760 --server.maxPayloadBytes=1759977 --logging.json=false --data.search.aggs.shardDelay.enabled=true --csp.warnLegacyBrowsers=false --uiSettings.overrides["query:enhancements:enabled"]=true --uiSettings.overrides[''home:useNewHomePage'']=true --data_source.enabled=true --opensearch.ignoreVersionMismatch=true' ||
93+
'node scripts/opensearch_dashboards --dev --no-base-path --no-watch --savedObjects.maxImportPayloadBytes=10485760 --server.maxPayloadBytes=1759977 --logging.json=false --data.search.aggs.shardDelay.enabled=true --csp.warnLegacyBrowsers=false --uiSettings.overrides["query:enhancements:enabled"]=true --uiSettings.overrides[''home:useNewHomePage'']=true --data_source.enabled=true --opensearch.ignoreVersionMismatch=true' ||
9494
matrix.config == 'dashboard' &&
9595
'node scripts/opensearch_dashboards --dev --no-base-path --no-watch --savedObjects.maxImportPayloadBytes=10485760 --server.maxPayloadBytes=1759977 --logging.json=false --data.search.aggs.shardDelay.enabled=true' ||
9696
'node ../scripts/opensearch_dashboards --dev --no-base-path --no-watch --savedObjects.maxImportPayloadBytes=10485760 --server.maxPayloadBytes=1759977 --logging.json=false --data.search.aggs.shardDelay.enabled=true --csp.warnLegacyBrowsers=false --uiSettings.overrides["query:enhancements:enabled"]=false' }}
@@ -172,18 +172,16 @@ jobs:
172172
FORMATTED_SPEC+="cypress/integration/core-opensearch-dashboards/opensearch-dashboards/${i},"
173173
done
174174
echo "SPEC=${FORMATTED_SPEC}" >> $GITHUB_ENV
175+
echo "SPEC=${FORMATTED_SPEC}"
175176
176177
# Setup spec files for Dashboards in-house cypress tests
177178
- name: Setup spec files for Dashboards tests
178179
if: ${{ inputs.specs == '' && matrix.test_location == 'source' }}
179180
shell: bash
180181
run: |
181-
IFS="," read -a SPEC_ARRAY <<< $(yarn --silent osd:ciGroup${{ matrix.group }})
182-
DASHBOARDS_SPEC=''
183-
for i in "${SPEC_ARRAY[@]}"; do
184-
DASHBOARDS_SPEC+="cypress/integration/core_opensearch_dashboards/${i},"
185-
done
182+
DASHBOARDS_SPEC="$(yarn --silent osd:ciGroup${{ matrix.group }})"
186183
echo "DASHBOARDS_SPEC=${DASHBOARDS_SPEC}" >> $GITHUB_ENV
184+
echo "DASHBOARDS_SPEC=${DASHBOARDS_SPEC}"
187185
188186
- name: Get Cypress version
189187
if: ${{ matrix.test_location == 'ftr' }}
@@ -204,8 +202,8 @@ jobs:
204202
- run: npx cypress cache path
205203

206204
# Run tests based on configuration
207-
- name: Run FT repo tests with no query enhancements
208-
if: matrix.test_location == 'ftr' && matrix.config == 'standard'
205+
- name: Run FT repo tests
206+
if: matrix.test_location == 'ftr'
209207
uses: cypress-io/github-action@v2
210208
with:
211209
working-directory: ${{ env.FTR_PATH }}
@@ -214,48 +212,47 @@ jobs:
214212
command: yarn cypress:run-without-security --browser ${{ env.CYPRESS_BROWSER }} --spec ${{ env.SPEC }}
215213

216214
- name: Download OpenSearch
217-
if: matrix.test_location == 'ftr' && matrix.config == 'query_enhanced'
215+
if: matrix.config == 'query_enhanced'
218216
uses: suisei-cn/[email protected]
219217
with:
220218
url: https://artifacts.opensearch.org/releases/bundle/opensearch/${{ env.LATEST_VERSION }}/opensearch-${{ env.LATEST_VERSION }}-linux-x64.tar.gz
221219

222220
- name: Extract OpenSearch
223-
if: matrix.test_location == 'ftr' && matrix.config == 'query_enhanced'
221+
if: matrix.config == 'query_enhanced'
224222
run: |
225223
tar -xzf opensearch-*.tar.gz
226224
rm -f opensearch-*.tar.gz
227225
shell: bash
228226

229227
- name: Remove security plugin
230-
if: matrix.test_location == 'ftr' && matrix.config == 'query_enhanced'
228+
if: matrix.config == 'query_enhanced'
231229
run: |
232230
/bin/bash -c "yes | ./opensearch-${{ env.LATEST_VERSION }}/bin/opensearch-plugin remove opensearch-security"
233231
shell: bash
234232

235233
- name: Run OpenSearch
236-
if: matrix.test_location == 'ftr' && matrix.config == 'query_enhanced'
234+
if: matrix.config == 'query_enhanced'
237235
run: |
238236
/bin/bash -c "./opensearch-2.17.0/opensearch-tar-install.sh &"
239237
sleep 30
240238
shell: bash
241239

242-
- name: Run FT repo tests with query enhancements
243-
if: matrix.test_location == 'ftr' && matrix.config == 'query_enhanced'
244-
uses: cypress-io/github-action@v2
245-
with:
246-
working-directory: ${{ env.FTR_PATH }}
247-
start: ${{ env.START_CMD }}
248-
wait-on: 'http://localhost:9200, http://localhost:5601'
249-
command: yarn cypress:run-without-security --browser ${{ env.CYPRESS_BROWSER }} --spec ${{ env.SPEC }}
250-
251240
# Clear Cypress Cache before running Dashboards tests
252241
- name: Clear Cypress Cache
253242
if: matrix.test_location == 'source'
254243
run: npx cypress cache clear
255244

256245
# Run Dashboards Cypress tests within the source repo
257-
- name: Run Dashboards Cypress tests
258-
if: matrix.test_location == 'source'
246+
- name: Run Dashboards Cypress tests with query enhancements
247+
if: matrix.test_location == 'source' && matrix.config == 'query_enhanced'
248+
uses: cypress-io/github-action@v6
249+
with:
250+
install-command: npx cypress install --force
251+
start: ${{ env.START_CMD }}
252+
wait-on: 'http://localhost:9200, http://localhost:5601'
253+
command: yarn cypress:run-without-security --browser ${{ env.CYPRESS_BROWSER }} --spec ${{ env.DASHBOARDS_SPEC }}
254+
- name: Run Dashboards Cypress tests without query enhancements
255+
if: matrix.test_location == 'source' && matrix.config == 'dashboard'
259256
uses: cypress-io/github-action@v6
260257
with:
261258
install-command: npx cypress install --force

.github/workflows/links_checker.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ name: Link Checker
55

66
on:
77
push:
8-
branches: [ main ]
8+
branches: [main]
99
pull_request:
10-
branches: [ main ]
10+
branches: [main]
1111

1212
jobs:
1313
linkchecker:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v4
17-
- name: Lychee Link Checker
18-
uses: lycheeverse/lychee-action@v1
19-
with:
20-
fail: true
21-
args: --accept=200,403,429 --base . --retry-wait-time=15 --max-retries=5 "**/*.html" "**/*.md" "**/*.txt" "**/*.json" "**/*.js" "**/*.ts" "**/*.tsx"
22-
env:
23-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
16+
- uses: actions/checkout@v4
17+
- name: Lychee Link Checker
18+
uses: lycheeverse/lychee-action@v1
19+
with:
20+
fail: true
21+
args: --accept=200,403,429 --base . --retry-wait-time=15 --max-retries=5 --exclude-path cypress/fixtures "**/*.html" "**/*.md" "**/*.txt" "**/*.json" "**/*.js" "**/*.ts" "**/*.tsx"
22+
env:
23+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ target
2626
/test/*/screenshots/failure
2727
/test/*/screenshots/session
2828
/test/*/screenshots/visual_regression_gallery.html
29+
cypress/videos/*
30+
cypress/screenshots/*
2931
/html_docs
3032
.eslintcache
3133
/data

changelogs/fragments/9048.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
feat:
2+
- Migrate query enhancement cypress tests to OSD repo ([#9048](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9048))

cypress.config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ module.exports = defineConfig({
1313
viewportWidth: 2000,
1414
viewportHeight: 1320,
1515
env: {
16+
ENGINE: {
17+
name: 'default',
18+
url: 'http://localhost:9200',
19+
},
20+
SECONDARY_ENGINE: {
21+
name: 'test_cluster',
22+
url: 'http://localhost:9200',
23+
},
1624
openSearchUrl: 'http://localhost:9200',
1725
SECURITY_ENABLED: false,
1826
AGGREGATION_VIEW: false,
@@ -27,7 +35,7 @@ module.exports = defineConfig({
2735
},
2836
e2e: {
2937
baseUrl: 'http://localhost:5601',
30-
specPattern: 'cypress/integration/**/*_spec.{js,jsx,ts,tsx}',
38+
specPattern: 'cypress/integration/**/*.spec.{js,jsx,ts,tsx}',
3139
testIsolation: false,
3240
setupNodeEvents,
3341
},

0 commit comments

Comments
 (0)