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

[Discover Test] TestID-69: Filtering, Test Suite: Filter actions in table field #9011

Closed
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
073a9ff
Mitigate the incorrect layout of Discover due to a race condition bet…
AMoo-Miki Nov 26, 2024
c24d5bc
[Workspace] feat: optimize recent items and filter out items whose wo…
raintygao Nov 27, 2024
8f58bce
[Auto Suggest] SQL Syntax Highlighting fix (#8951)
paulstn Nov 27, 2024
473c0ae
Bump `@opensearch-project/opensearch` from 2.9.0 to 2.13.0 (#8886)
AMoo-Miki Nov 27, 2024
4dac5a7
[workspace]fix: Change some of the http link in settings page to http…
Qxisylolo Nov 28, 2024
1c744d6
[Workspace]Support search dev tools by its category name (#8920)
Hailong-am Nov 28, 2024
b31206a
[Workspace] Isolate objects based on workspace when calling get/bulkG…
yubonluo Dec 2, 2024
f6d345b
Add utils to select a data source.
ArgusLi Dec 3, 2024
080b0db
[Discover] Fix Initialization if No Saved Query (#8930)
sejli Dec 3, 2024
340326f
[Workspace][Bug] Check if workspaces exists when creating saved objec…
yubonluo Dec 3, 2024
d5e0087
[Discover] fix PPL to not throw error if aggregation query fails (#8992)
joshuali925 Dec 3, 2024
e07680b
Upgrade Cypress to v12 (#8995)
d-rowe Dec 3, 2024
fe616e7
[Query enhancements] use status 503 if search strategy throws 500 (#8…
joshuali925 Dec 3, 2024
4e54e2f
Add support for different languages when creating dataset. Filter Out…
ArgusLi Dec 4, 2024
0d308da
Merge branch 'main' of https://github.com/ArgusLi/OpenSearch-Dashboar…
ArgusLi Dec 4, 2024
98e9042
Revert "[augmenter] do not support datasources with no version (#8915…
ohltyler Dec 4, 2024
5f95d74
Reformat to match OSD-functional-tests.
ArgusLi Dec 4, 2024
6861c54
Merge remote-tracking branch 'origin/main' into testid-69-filtering
ArgusLi Dec 4, 2024
cd6c3d8
Complete test suite filter actions in table field.
ArgusLi Dec 5, 2024
a649b6d
Fix filter_label.test.tsx failing due to added data-test-subj
ArgusLi Dec 5, 2024
36bf5e8
[Workspace] Clear the attribute of error objects (#9003)
yubonluo Dec 5, 2024
41ac8ab
bump `url` to 0.11.4 (#8611)
joshuali925 Dec 5, 2024
025b206
Merge branch 'opensearch-project:main' into testid-69-filtering-suite…
ArgusLi Dec 5, 2024
3f65938
[Discover] use roundUp when converting timestamp for PPL (#8935)
joshuali925 Dec 5, 2024
6118ee5
Address comments.
ArgusLi Dec 5, 2024
2a53a55
Merge branch 'opensearch-project:main' into testid-69-filtering-suite…
ArgusLi Dec 5, 2024
f78b3e5
Reformat to use POM.
ArgusLi Dec 5, 2024
cde2eaf
Remove should be visible as each command should be a simple get.
ArgusLi Dec 6, 2024
fda96ff
Merge branch 'cypress-unification' into testid-69-filtering-suite-tab…
ArgusLi Dec 9, 2024
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
2 changes: 2 additions & 0 deletions changelogs/fragments/8739.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- [Workspace] [Bug] Check if workspaces exists when creating saved objects. ([#8739](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8739))
2 changes: 2 additions & 0 deletions changelogs/fragments/8886.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
chore:
- Bump `@opensearch-project/opensearch` from 2.9.0 to 2.13.0 ([#8886](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8886))
2 changes: 2 additions & 0 deletions changelogs/fragments/8888.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
refactor:
- [Workspace] Isolate objects based on workspace when calling get/bulkGet ([#8888](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8888))
2 changes: 2 additions & 0 deletions changelogs/fragments/8900.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- Optimize recent items and filter out items whose workspace is deleted ([#8900](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8900))
2 changes: 0 additions & 2 deletions changelogs/fragments/8915.yml

This file was deleted.

2 changes: 2 additions & 0 deletions changelogs/fragments/8919.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Change some of the http link in settings page to https link ([#8919](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8919))
2 changes: 2 additions & 0 deletions changelogs/fragments/8920.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- [workspace]support search dev tools by its category name ([#8920](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8920))
2 changes: 2 additions & 0 deletions changelogs/fragments/8930.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Update saved search initialization logic to use current query instead of default query ([#8930](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8930))
2 changes: 2 additions & 0 deletions changelogs/fragments/8951.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- SQL syntax highlighting double quotes ([#8951](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8951))
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))
31 changes: 0 additions & 31 deletions cypress.config.js

This file was deleted.

66 changes: 66 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* 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: {
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,
},
e2e: {
baseUrl: 'http://localhost:5601',
supportFile: 'cypress/support/e2e.{js,jsx,ts,tsx}',
specPattern: 'cypress/integration/**/*_spec.{js,jsx,ts,tsx}',
testIsolation: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a part of the Cypress I saw a couple existing tests that are not written in an isolated manner, which caused failures when I enabled this initially.

If all our tests pass with isolation on now, that's great! Let's just check the cypress tests on this PR when they run to verify that there are no new failures due to this enablement

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that the other tests are running, I will revert the testIsolation to false and change my test to reflect the lack of test isolation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in newest commit.

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;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { MiscUtils } from '@opensearch-dashboards-test/opensearch-dashboards-test-library';

const miscUtils = new MiscUtils(cy);

describe('filter for value spec', () => {
beforeEach(() => {
cy.localLogin(Cypress.env('username'), Cypress.env('password'));
miscUtils.visitPage('app/data-explorer/discover');
cy.getNewSearchButton().click();
});
describe('filter actions in table field', () => {
describe('index pattern dataset', () => {
// filter actions should exist for DQL
it('DQL', () => {
cy.selectIndexPatternDataset('DQL');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fully utilizing utils here across this test file.

cy.setSearchRelativeDateRange('15', 'Years ago');
cy.checkDocTableFirstFieldFilterForAndOutButton(true);
cy.checkDocTableFirstFieldFilterForButtonFiltersCorrectField();
cy.checkDocTableFirstFieldFilterOutButtonFiltersCorrectField();
});
// filter actions should exist for Lucene
it('Lucene', () => {
cy.selectIndexPatternDataset('Lucene');
cy.setSearchRelativeDateRange('15', 'Years ago');
cy.checkDocTableFirstFieldFilterForAndOutButton(true);
cy.checkDocTableFirstFieldFilterForButtonFiltersCorrectField();
cy.checkDocTableFirstFieldFilterOutButtonFiltersCorrectField();
});
// filter actions should not exist for SQL
it('SQL', () => {
cy.selectIndexPatternDataset('OpenSearch SQL');
cy.checkDocTableFirstFieldFilterForAndOutButton(false);
});
// filter actions should not exist for PPL
it('PPL', () => {
cy.selectIndexPatternDataset('PPL');
cy.setSearchRelativeDateRange('15', 'Years ago');
cy.checkDocTableFirstFieldFilterForAndOutButton(false);
});
});
describe('index dataset', () => {
// filter actions should not exist for SQL
it('SQL', () => {
cy.selectIndexDataset('OpenSearch SQL');
cy.checkDocTableFirstFieldFilterForAndOutButton(false);
});
// filter actions should not exist for PPL
it('PPL', () => {
cy.selectIndexDataset('PPL');
cy.checkDocTableFirstFieldFilterForAndOutButton(false);
});
});
});
});
12 changes: 11 additions & 1 deletion cypress/support/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,14 @@
* SPDX-License-Identifier: Apache-2.0
*/

import '../utils/commands';
import '../utils/commands.js';
import '../utils/dashboards/data_explorer/commands.js';

// Alternatively you can use CommonJS syntax:
// require('./commands')

// eslint-disable-next-line no-unused-vars
Cypress.on('uncaught:exception', (_err) => {
// returning false here prevents Cypress from failing the test
return false;
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, there are some uncaught errors that we do want to gracefully ignore. That being said, I feel there are times when bubbling up an uncaught exception would be really useful. For example, if a page fails to render it'd be nice to see the exception in the runner rather than having to run locally and dig for it.

Can we be a bit more selective here and only swallow the error you were seeing needed to be handled gracefully?

Ex.

const resizeObserverLoopErr = /^[^(ResizeObserver loop limit exceeded)]/;
Cypress.on('uncaught:exception', (err) => {
  /* returning false here prevents Cypress from failing the test */
  if (resizeObserverLoopErr.test(err.message)) {
    return false;
  }
});

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I added this as I was getting a specific navigation error. Keeping the ignore selective makes a lot of sense to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in newest commit.

36 changes: 35 additions & 1 deletion cypress/utils/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,47 @@
* SPDX-License-Identifier: Apache-2.0
*/

// --- Typed commands --
import {
MiscUtils,
LoginPage,
} from '@opensearch-dashboards-test/opensearch-dashboards-test-library';

const miscUtils = new MiscUtils(cy);
const loginPage = new LoginPage(cy);

/**
* Get DOM element by data-test-subj id.
*/
Cypress.Commands.add('getElementByTestId', (testId, options = {}) => {
return cy.get(`[data-test-subj="${testId}"]`, options);
});

/**
* Get multiple DOM elements by data-test-subj ids.
*/
Cypress.Commands.add('getElementsByTestIds', (testIds, options = {}) => {
const selectors = [testIds].flat(Infinity).map((testId) => `[data-test-subj="${testId}"]`);
return cy.get(selectors.join(','), options);
});

/**
* Find element from previous chained element by data-test-subj id.
*/
Cypress.Commands.add(
'findElementByTestId',
{ prevSubject: true },
(subject, testId, options = {}) => {
return cy.wrap(subject).find(`[data-test-subj="${testId}"]`, options);
}
);

/**
* Go to the local instance of OSD's home page and login.
*/
Cypress.Commands.add('localLogin', (username, password) => {
miscUtils.visitPage('/app/home');
loginPage.enterUserName(username);
loginPage.enterPassword(password);
loginPage.submit();
cy.url().should('contain', '/app/home');
});
Loading
Loading