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

Backport/backport lots of prs for discover 2.0 #9218

Closed
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
48 changes: 22 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 @@ -177,12 +177,9 @@ jobs:
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
if: ${{ matrix.test_location == 'ftr' }}
Expand All @@ -203,8 +200,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 @@ -213,48 +210,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
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}}
4 changes: 3 additions & 1 deletion .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 Expand Up @@ -70,4 +72,4 @@ snapshots.js
.yarn-local-mirror

# Ignore the generated antlr files
/src/plugins/data/public/antlr/**/grammar/.antlr/
/src/plugins/data/public/antlr/**/grammar/.antlr/
2 changes: 2 additions & 0 deletions changelogs/fragments/8912.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Ensure query editor cursor is aligned with text ([#8912](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8912))
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/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/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))
2 changes: 1 addition & 1 deletion config/opensearch_dashboards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@

# Set the backend roles in groups or users, whoever has the backend roles or exactly match the user ids defined in this config will be regard as dashboard admin.
# Dashboard admin will have the access to all the workspaces(workspace.enabled: true) and objects inside OpenSearch Dashboards.
# The default config is [], and no one will be dashboard admin.
# The default config is [], and no one will be dashboard admin.
# If the user config is set to wildcard ["*"], anyone will be dashboard admin.
# opensearchDashboards.dashboardAdmin.groups: ["dashboard_admin"]
# opensearchDashboards.dashboardAdmin.users: ["dashboard_admin"]
Expand Down
80 changes: 80 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { defineConfig } from 'cypress';
import webpackPreprocessor from '@cypress/webpack-preprocessor';

module.exports = defineConfig({
defaultCommandTimeout: 60000,
requestTimeout: 60000,
responseTimeout: 60000,
viewportWidth: 2000,
viewportHeight: 1320,
env: {
ENGINE: {
name: 'default',
url: 'http://localhost:9200',
},
SECONDARY_ENGINE: {
name: 'test_cluster',
url: 'http://localhost:9200',
},
S3_ENGINE: {
name: 'BasicS3Connection',
url: process.env.S3_CONNECTION_URL,
username: process.env.S3_CONNECTION_USERNAME,
password: process.env.S3_CONNECTION_PASSWORD,
},
openSearchUrl: 'http://localhost:9200',
SECURITY_ENABLED: false,
AGGREGATION_VIEW: false,
username: 'admin',
password: 'myStrongPassword123!',
ENDPOINT_WITH_PROXY: false,
MANAGED_SERVICE_ENDPOINT: false,
VISBUILDER_ENABLED: true,
DATASOURCE_MANAGEMENT_ENABLED: false,
ML_COMMONS_DASHBOARDS_ENABLED: true,
WAIT_FOR_LOADER_BUFFER_MS: 0,
DISABLE_LOCAL_CLUSTER: false,
},
e2e: {
baseUrl: 'http://localhost:5601',
specPattern: 'cypress/integration/**/*.spec.{js,jsx,ts,tsx}',
testIsolation: false,
setupNodeEvents,
},
});

function setupNodeEvents(
on: Cypress.PluginEvents,
config: Cypress.PluginConfigOptions
): Cypress.PluginConfigOptions {
const { webpackOptions } = webpackPreprocessor.defaultOptions;

/**
* By default, cypress' internal webpack preprocessor doesn't allow imports without file extensions.
* This makes our life a bit hard since if any file in our testing dependency graph has an import without
* the .js extension our cypress build will fail.
*
* This extra rule relaxes this a bit by allowing imports without file extension
* ex. import module from './module'
*/
webpackOptions!.module!.rules.unshift({
test: /\.m?js/,
resolve: {
enforceExtension: false,
},
});

on(
'file:preprocessor',
webpackPreprocessor({
webpackOptions,
})
);

return config;
}
Loading
Loading