Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.x Manual Backport] Backport cypress related work to 2.x and 2 missing backports #9261

Merged
merged 26 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b022bc2
[Discover] Makes caching dataset options optional (#8799)
ashwin-pc Nov 4, 2024
362f3bd
Upgrade Cypress to v12 (#8995)
d-buckner Dec 3, 2024
6e83801
[Discover Test] TestID-69: Filtering. Add data-test-subj tags. (#9027)
ArgusLi Dec 10, 2024
937a480
Migrate query enhancement tests from functional repo to main (#9048)
abbyhu2000 Dec 14, 2024
608a9bc
Add missing data-test-subj tags for discover plugin (#9049)
ananzh Dec 16, 2024
97dfa0c
Add missing data-test-subj tags for data plugin (#9051)
LDrago27 Dec 16, 2024
1f88ecb
Follow up on #9048 by updating data and utilities (#9060)
ananzh Dec 18, 2024
cb73211
refactor some query-enhancement utility functions, add some missing t…
angle943 Dec 19, 2024
564cb23
add queryEditorLanguageOptions data-test-subj on language_selector.ts…
silva-qa Dec 10, 2024
32bb607
Re-enable dataset_selector.spec.js and queries.spec.js under workspac…
ananzh Dec 20, 2024
b9c27fe
Make createWorkspaceIndexPatterns to handle no default cluster and cl…
ananzh Dec 30, 2024
aaf46cd
add data-test-subj (#9135)
silvaf-dev Dec 30, 2024
396ad2c
[Discover] Adding Cypress Tests for S3 Datasets (#9113)
sejli Jan 1, 2025
b6fdb52
[Discover 2.0 Testing] Create Filtering Test (TestId-69: Filtering) (…
ArgusLi Jan 5, 2025
b7ede08
Add tests for saved search creation and loading for query enhancement…
angle943 Jan 6, 2025
b02aea6
fix: 0 rendered in discover when there are no results (#9153)
d-buckner Jan 8, 2025
3c305c5
[Cypress][Fix] Update saved search utilities (#9151)
angle943 Jan 13, 2025
811acb0
chore: use relative paths in cypress (#9079)
d-buckner Jan 13, 2025
812b38c
[Discover 2.0 Testing] Create View List of Saved Queries Test (Test-I…
ArgusLi Jan 16, 2025
a2ae0ba
change casing to folder structures to be compliant with our rules (#9…
angle943 Jan 16, 2025
e417aa0
[Fix] Saved Search Integ Test Update: update saving a new saved searc…
angle943 Jan 17, 2025
ccfb52d
refactor query enhancement tests (#9208)
angle943 Jan 17, 2025
fe867bf
chore: change casing of data-logs to be compliant with our git hook r…
angle943 Jan 21, 2025
6e57cab
chore: remove unused/redundant functions from field_display_filtering…
angle943 Jan 21, 2025
3fde8f4
Create cypress command namespacing util (#9150)
d-buckner Jan 22, 2025
ec8750b
update cy.createInitialWorkspaceWithDataSource -> cy.osd.createInitia…
angle943 Jan 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
/test/fixtures/scenarios
node_modules
target
cypress/fixtures

!/.eslintrc.js

Expand Down
49 changes: 23 additions & 26 deletions .github/workflows/cypress_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ jobs:
- group: 9
config: standard
test_location: ftr
# Query enhanced tests
# Dashboard tests with query enhanced
- group: 10
config: query_enhanced
test_location: ftr
# Dashboard tests
test_location: source
# Dashboard tests with no query enhanced
- group: 11
config: dashboard
test_location: source
Expand All @@ -90,7 +90,7 @@ jobs:
options: --user 1001
env:
START_CMD: ${{ matrix.config == 'query_enhanced' &&
'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' ||
'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 --workspace.enabled=true --opensearch.ignoreVersionMismatch=true --data.savedQueriesNewUI.enabled=true' ||
matrix.config == 'dashboard' &&
'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' ||
'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' }}
Expand Down Expand Up @@ -171,18 +171,16 @@ jobs:
FORMATTED_SPEC+="cypress/integration/core-opensearch-dashboards/opensearch-dashboards/${i},"
done
echo "SPEC=${FORMATTED_SPEC}" >> $GITHUB_ENV
echo "SPEC=${FORMATTED_SPEC}"

# Setup spec files for Dashboards in-house cypress tests
- name: Setup spec files for Dashboards tests
if: ${{ inputs.specs == '' && matrix.test_location == 'source' }}
shell: bash
run: |
IFS="," read -a SPEC_ARRAY <<< $(yarn --silent osd:ciGroup${{ matrix.group }})
DASHBOARDS_SPEC=''
for i in "${SPEC_ARRAY[@]}"; do
DASHBOARDS_SPEC+="cypress/integration/core_opensearch_dashboards/${i},"
done
DASHBOARDS_SPEC="$(yarn --silent osd:ciGroup${{ matrix.group }})"
echo "DASHBOARDS_SPEC=${DASHBOARDS_SPEC}" >> $GITHUB_ENV
echo "DASHBOARDS_SPEC=${DASHBOARDS_SPEC}"

- name: Get Cypress version
id: cypress_version
Expand All @@ -201,8 +199,8 @@ jobs:
- run: npx cypress cache path

# Run tests based on configuration
- name: Run FT repo tests with no query enhancements
if: matrix.test_location == 'ftr' && matrix.config == 'standard'
- name: Run FT repo tests
if: matrix.test_location == 'ftr'
uses: cypress-io/github-action@v2
with:
working-directory: ${{ env.FTR_PATH }}
Expand All @@ -211,48 +209,47 @@ jobs:
command: yarn cypress:run-without-security --browser ${{ env.CYPRESS_BROWSER }} --spec ${{ env.SPEC }}

- name: Download OpenSearch
if: matrix.test_location == 'ftr' && matrix.config == 'query_enhanced'
if: matrix.config == 'query_enhanced'
uses: suisei-cn/actions-download-file@v1.4.0
with:
url: https://artifacts.opensearch.org/releases/bundle/opensearch/${{ env.LATEST_VERSION }}/opensearch-${{ env.LATEST_VERSION }}-linux-x64.tar.gz

- name: Extract OpenSearch
if: matrix.test_location == 'ftr' && matrix.config == 'query_enhanced'
if: matrix.config == 'query_enhanced'
run: |
tar -xzf opensearch-*.tar.gz
rm -f opensearch-*.tar.gz
shell: bash

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

- name: Run OpenSearch
if: matrix.test_location == 'ftr' && matrix.config == 'query_enhanced'
if: matrix.config == 'query_enhanced'
run: |
/bin/bash -c "./opensearch-2.17.0/opensearch-tar-install.sh &"
sleep 30
shell: bash

- name: Run FT repo tests with query enhancements
if: matrix.test_location == 'ftr' && matrix.config == 'query_enhanced'
uses: cypress-io/github-action@v2
with:
working-directory: ${{ env.FTR_PATH }}
start: ${{ env.START_CMD }}
wait-on: 'http://localhost:9200, http://localhost:5601'
command: yarn cypress:run-without-security --browser ${{ env.CYPRESS_BROWSER }} --spec ${{ env.SPEC }}

# Clear Cypress Cache before running Dashboards tests
- name: Clear Cypress Cache
if: matrix.test_location == 'source'
run: npx cypress cache clear

# Run Dashboards Cypress tests within the source repo
- name: Run Dashboards Cypress tests
if: matrix.test_location == 'source'
- name: Run Dashboards Cypress tests with query enhancements
if: matrix.test_location == 'source' && matrix.config == 'query_enhanced'
uses: cypress-io/github-action@v6
with:
install-command: npx cypress install --force
start: ${{ env.START_CMD }}
wait-on: 'http://localhost:9200, http://localhost:5601'
command: yarn cypress:run-without-security --browser ${{ env.CYPRESS_BROWSER }} --spec ${{ env.DASHBOARDS_SPEC }}
- name: Run Dashboards Cypress tests without query enhancements
if: matrix.test_location == 'source' && matrix.config == 'dashboard'
uses: cypress-io/github-action@v6
with:
install-command: npx cypress install --force
Expand Down
148 changes: 148 additions & 0 deletions .github/workflows/cypress_workflow_with_s3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
name: Run cypress tests with S3

# trigger once PR has been merged
on:
push:
branches: ['main', '[0-9]+\.x', '[0-9]+\.[0-9]+']
paths-ignore:
- '**/*.md'
- '.lycheeignore'
- 'changelogs/fragments/**'
workflow_dispatch:
inputs:
test_repo:
description: 'Cypress test repo'
default: 'opensearch-project/opensearch-dashboards-functional-test'
required: true
type: string
test_branch:
description: 'Cypress test branch (default: source branch)'
required: false
type: string
specs:
description: 'Tests to run (default: osd:ciGroup10)'
required: false
type: string
pr_number:
description: 'PR Number (optional)'
required: false
type: number

env:
TEST_REPO: ${{ inputs.test_repo != '' && inputs.test_repo || 'opensearch-project/opensearch-dashboards-functional-test' }}
TEST_BRANCH: "${{ inputs.test_branch != '' && inputs.test_branch || github.base_ref }}"
FTR_PATH: 'ftr'
CYPRESS_BROWSER: 'chromium'
CYPRESS_VISBUILDER_ENABLED: true
CYPRESS_DATASOURCE_MANAGEMENT_ENABLED: false
OSD_SNAPSHOT_SKIP_VERIFY_CHECKSUM: true
NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first'
LATEST_VERSION: '2.17.0'

jobs:
cypress-tests:
runs-on: ubuntu-latest
environment: flint-test
container:
image: docker://opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-dashboards-integtest-v2
options: --user 1001
env:
START_CMD: '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 --workspace.enabled=true --opensearch.ignoreVersionMismatch=true'
OPENSEARCH_SNAPSHOT_CMD: '/bin/bash -c "./opensearch-2.17.0/opensearch-tar-install.sh &"'
name: Run cypress tests (osd:ciGroup10)
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'

- name: Setup Yarn
run: |
npm uninstall -g yarn
npm i -g yarn@1.22.10

- name: Run bootstrap
run: yarn osd bootstrap

- name: Build plugins
run: node scripts/build_opensearch_dashboards_platform_plugins --no-examples --workers 12

- name: Checkout FT repo
uses: actions/checkout@v2
with:
path: ${{ env.FTR_PATH }}
repository: ${{ env.TEST_REPO }}
ref: '${{ env.TEST_BRANCH }}'

- name: Setup spec files
if: ${{ inputs.specs == '' }}
shell: bash
run: |
DASHBOARDS_SPEC="$(yarn --silent osd:ciGroup10)"
echo "DASHBOARDS_SPEC=${DASHBOARDS_SPEC}" >> $GITHUB_ENV
echo "DASHBOARDS_SPEC=${DASHBOARDS_SPEC}"

- name: Download OpenSearch
uses: suisei-cn/actions-download-file@v1.4.0
with:
url: https://artifacts.opensearch.org/releases/bundle/opensearch/${{ env.LATEST_VERSION }}/opensearch-${{ env.LATEST_VERSION }}-linux-x64.tar.gz

- name: Extract OpenSearch
run: |
tar -xzf opensearch-*.tar.gz
rm -f opensearch-*.tar.gz
shell: bash

- name: Remove security plugin
run: |
/bin/bash -c "yes | ./opensearch-${{ env.LATEST_VERSION }}/bin/opensearch-plugin remove opensearch-security"
shell: bash

- name: Run OpenSearch
run: |
/bin/bash -c "./opensearch-2.17.0/opensearch-tar-install.sh &"
sleep 30
shell: bash

- name: Clear Cypress Cache
run: npx cypress cache clear

- name: Run Dashboards Cypress tests with query enhancements
uses: cypress-io/github-action@v6
env:
S3_CONNECTION_URL: ${{ secrets.S3_CONNECTION_URL }}
S3_CONNECTION_USERNAME: ${{ secrets.S3_CONNECTION_USERNAME }}
S3_CONNECTION_PASSWORD: ${{ secrets.S3_CONNECTION_PASSWORD }}
with:
install-command: npx cypress install --force
start: ${{ env.START_CMD }}
wait-on: 'http://localhost:9200, http://localhost:5601'
command: yarn cypress:run-without-security --browser ${{ env.CYPRESS_BROWSER }} --spec ${{ env.DASHBOARDS_SPEC }}

- name: Upload Dashboards screenshots
if: failure()
uses: actions/upload-artifact@v4
with:
name: dashboards-cypress-screenshots-10
path: cypress/screenshots
retention-days: 1

- name: Upload Dashboards repo videos
uses: actions/upload-artifact@v4
if: always()
with:
name: dashboards-cypress-videos-10
path: cypress/videos
retention-days: 1

- name: Upload Dashboards repo results
uses: actions/upload-artifact@v4
if: always()
with:
name: dashboards-cypress-results-10
path: cypress/results
retention-days: 1
20 changes: 10 additions & 10 deletions .github/workflows/links_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ name: Link Checker

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
linkchecker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lychee Link Checker
uses: lycheeverse/lychee-action@v1
with:
fail: true
args: --accept=200,403,429 --base . --retry-wait-time=15 --max-retries=5 "**/*.html" "**/*.md" "**/*.txt" "**/*.json" "**/*.js" "**/*.ts" "**/*.tsx"
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- uses: actions/checkout@v4
- name: Lychee Link Checker
uses: lycheeverse/lychee-action@v1
with:
fail: true
args: --accept=200,403,429 --base . --retry-wait-time=15 --max-retries=5 --exclude-path cypress/fixtures "**/*.html" "**/*.md" "**/*.txt" "**/*.json" "**/*.js" "**/*.ts" "**/*.tsx"
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ target
/test/*/screenshots/failure
/test/*/screenshots/session
/test/*/screenshots/visual_regression_gallery.html
cypress/videos/*
cypress/screenshots/*
/html_docs
.eslintcache
/data
Expand Down
2 changes: 2 additions & 0 deletions changelogs/fragments/8799.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- [Discover] Makes cachign dataset options optional and configurable by the dataset type ([#8799](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8799))
2 changes: 2 additions & 0 deletions changelogs/fragments/8926.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
chore:
- Update cypress to v12 ([#8926](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8926))
2 changes: 2 additions & 0 deletions changelogs/fragments/8993.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Support imports without extensions in cypress webpack build ([#8993](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8993))
2 changes: 2 additions & 0 deletions changelogs/fragments/9048.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- Migrate query enhancement cypress tests to OSD repo ([#9048](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9048))
2 changes: 2 additions & 0 deletions changelogs/fragments/9074.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test:
- Query-enhancements testing utility updates and additions ([#9074](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9074))
2 changes: 2 additions & 0 deletions changelogs/fragments/9079.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
chore:
- Use relative paths in cypress utilities ([#9079](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9079))
2 changes: 2 additions & 0 deletions changelogs/fragments/9082.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test:
- Re-enable dataset_selector.spec.js under workspace in ciGroup10 ([#9082](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9082))
2 changes: 2 additions & 0 deletions changelogs/fragments/9112.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test:
- Add tests for saving search and loading it ([#9112](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9112))
2 changes: 2 additions & 0 deletions changelogs/fragments/9113.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test:
- Adding Cypress Tests for S3 Datasets ([#9113](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9113))
2 changes: 2 additions & 0 deletions changelogs/fragments/9119.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test:
- Add cypress integration test for the new Data Explorer UI's Filtering. ([#9119](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9119))
2 changes: 2 additions & 0 deletions changelogs/fragments/9129.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test:
- Make createWorkspaceIndexPatterns to handle no default cluster and clean up ([#9129](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9129))
2 changes: 2 additions & 0 deletions changelogs/fragments/9150.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
chore:
- Create cypress command namespacing util ([#9150](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9150))
2 changes: 2 additions & 0 deletions changelogs/fragments/9151.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test:
- Add tests for updating a saved search ([#9151](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9151))
2 changes: 2 additions & 0 deletions changelogs/fragments/9153.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- 0 rendered in discover when there are no results ([#9153](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9153))
2 changes: 2 additions & 0 deletions changelogs/fragments/9166.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test:
- Add cypress integration test for the old and new UI view saved queries. ([#9166](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9166))
Loading
Loading