Skip to content

Commit

Permalink
Resolve OSD core test issues observed in 2.15.0
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Zhu <[email protected]>
  • Loading branch information
peterzhuamazon committed Jun 22, 2024
1 parent 25ce4fd commit 6ac6946
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 57 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* -text
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,6 @@ describe('table visualization in embedded mode', () => {
'115',
];

const suppressResizeObserverIssue = () => {
// exception is thrown on loading EuiDataGrid in cypress only, ignore for now
cy.on('uncaught:exception', (err) => {
if (err.message.includes('ResizeObserver loop')) return false;
});
};

before(() => {
CURRENT_TENANT.newTenant = 'global';
cy.fleshTenantSettings();
Expand Down Expand Up @@ -104,75 +97,91 @@ describe('table visualization in embedded mode', () => {

it('Should allow to filter in embedded mode', () => {
commonUI.addFilterRangeRetrySelection('age', 'is between', '10', '30');
cy.wait(2000);
cy.reload();
cy.wait(2000);
cy.tbGetTableDataFromVisualization().then((data) => {
expect(data).to.deep.eq(['0', '1,059', '20', '1,114']);
});
commonUI.removeFilter('age');
cy.wait(2000);
cy.reload();
cy.wait(2000);
cy.tbGetTableDataFromVisualization().then((data) => {
expect(data).to.deep.eq(expectedData);
});
});

it('Should filter for value in embedded mode', () => {
cy.tbClickTableCellAction(2, 0, 0, 'filter for', 0, true);
cy.wait(2000);
cy.reload();
cy.wait(2000);
cy.tbGetTableDataFromVisualization().then((data) => {
expect(data).to.deep.eq(['0', '1,059']);
});
commonUI.removeFilter('age');
cy.wait(2000);
cy.reload();
cy.wait(2000);
cy.tbGetTableDataFromVisualization().then((data) => {
expect(data).to.deep.eq(expectedData);
});
cy.wait(2000);
cy.tbClickTableCellAction(2, 0, 0, 'expand', 0, true);
cy.wait(2000);
cy.tbClickFilterFromExpand('filter for');
cy.wait(2000);
cy.reload();
cy.wait(2000);
cy.tbGetTableDataFromVisualization().then((data) => {
expect(data).to.deep.eq(['0', '1,059']);
});
commonUI.removeFilter('age');
cy.wait(2000);
cy.reload();
cy.wait(2000);
cy.tbGetTableDataFromVisualization().then((data) => {
expect(data).to.deep.eq(expectedData);
});
});

it('Should filter out value in embedded mode', () => {
const expectedFilterOutData = [
'20',
'2,236',
'40',
'2,200',
'60',
'2,211',
'80',
'2,179',
'100',
'115',
];
cy.tbClickTableCellAction(2, 0, 0, 'filter out', 0, true);
cy.reload();
cy.tbGetTableDataFromVisualization().then((data) => {
expect(data).to.deep.eq(expectedFilterOutData);
});
commonUI.removeFilter('age');
cy.reload();
cy.tbGetTableDataFromVisualization().then((data) => {
expect(data).to.deep.eq(expectedData);
});
cy.tbClickTableCellAction(2, 0, 0, 'expand', 0, true);
suppressResizeObserverIssue();
cy.tbClickFilterFromExpand('filter out');
cy.reload();
cy.tbGetTableDataFromVisualization().then((data) => {
expect(data).to.deep.eq(expectedFilterOutData);
});
commonUI.removeFilter('age');
cy.reload();
cy.tbGetTableDataFromVisualization().then((data) => {
expect(data).to.deep.eq(expectedData);
if (!Cypress.env('SECURITY_ENABLED')) {
it('Should filter out value in embedded mode', () => {
const expectedFilterOutData = [
'20',
'2,236',
'40',
'2,200',
'60',
'2,211',
'80',
'2,179',
'100',
'115',
];
cy.tbClickTableCellAction(2, 0, 0, 'filter out', 0, true);
cy.reload();
cy.tbGetTableDataFromVisualization().then((data) => {
expect(data).to.deep.eq(expectedFilterOutData);
});
commonUI.removeFilter('age');
cy.reload();
cy.tbGetTableDataFromVisualization().then((data) => {
expect(data).to.deep.eq(expectedData);
});
cy.tbClickTableCellAction(2, 0, 0, 'expand', 0, true);
cy.wait(2000);
cy.tbClickFilterFromExpand('filter out');
cy.reload();
cy.tbGetTableDataFromVisualization().then((data) => {
expect(data).to.deep.eq(expectedFilterOutData);
});
commonUI.removeFilter('age');
cy.reload();
cy.tbGetTableDataFromVisualization().then((data) => {
expect(data).to.deep.eq(expectedData);
});
});
});
}
});
6 changes: 6 additions & 0 deletions integtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@ if [ "$DISABLE_VIDEO" = "true" ]; then
mv -v cypress_new.json cypress.json
fi

# Windows does not set timezone even when you specify `env TZ=America/Los_Angeles`
# Using powershell to force the timezone change to PST which is same as America/Los_Angeles
if [ "$OSTYPE" = "msys" ] || [ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "win32" ]; then
powershell -Command "Set-TimeZone -Id 'Pacific Standard Time' -PassThru"
fi

if [ "$SECURITY_ENABLED" = "true" ]; then
echo "Running security enabled tests"
yarn cypress:run-with-security --browser "$BROWSER_PATH" --spec "$TEST_FILES"
Expand Down
27 changes: 12 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "opensearch-dashboards-functional-test",
"version": "3.0.0",
"version": "2.15.0",
"description": "Maintains functional tests for OpenSearch Dashboards and Dashboards plugins",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"cypress:open": "cypress open",
"cypress:run-without-security": "env TZ=America/Los_Angeles NO_COLOR=1 cypress run --headless --env SECURITY_ENABLED=false",
"cypress:run-with-security": "env TZ=America/Los_Angeles NO_COLOR=1 cypress run --headless --env SECURITY_ENABLED=true,openSearchUrl=https://localhost:9200,WAIT_FOR_LOADER_BUFFER_MS=500",
"cypress:run-with-security-and-aggregation-view": "env TZ=America/Los_Angeles NO_COLOR=1 cypress run --headless --env SECURITY_ENABLED=true,openSearchUrl=https://localhost:9200,AGGREGATION_VIEW=true,WAIT_FOR_LOADER_BUFFER_MS=500",
"cypress:run-with-security": "env TZ=America/Los_Angeles NO_COLOR=1 cypress run --headless --env SECURITY_ENABLED=true,openSearchUrl=https://localhost:9200,WAIT_FOR_LOADER_BUFFER_MS=3000",
"cypress:run-with-security-and-aggregation-view": "env TZ=America/Los_Angeles NO_COLOR=1 cypress run --headless --env SECURITY_ENABLED=true,openSearchUrl=https://localhost:9200,AGGREGATION_VIEW=true,WAIT_FOR_LOADER_BUFFER_MS=3000",
"cypress:run-plugin-tests-without-security": "yarn cypress:run-without-security --spec 'cypress/integration/plugins/*/*.js'",
"cypress:run-plugin-tests-with-security": "yarn cypress:run-with-security --spec 'cypress/integration/plugins/*/*.js'",
"cypress:release-chrome": "yarn cypress:run-with-security --browser chrome --spec 'cypress/integration/core-opensearch-dashboards/opensearch-dashboards/*.js,cypress/integration/plugins/*/*'",
Expand All @@ -25,15 +25,15 @@
"pkg-version": "./scripts/getpkgversion.sh",
"generate:test-data": "node ./scripts/generate_data/index.js",
"postinstall": "husky install",
"osd:ciGroup1": "echo \"apps/vis_builder/*.js\"",
"osd:ciGroup2": "echo \"apps/vis_type_table/*.js\"",
"osd:ciGroup3": "echo \"apps/vis-augmenter/*.js\"",
"osd:ciGroup4": "echo \"dashboard_sample_data_with_datasource_spec.js,dashboard_sanity_test_spec.js,apps/telemetry/*.js\"",
"osd:ciGroup5": "echo \"datasource-management-plugin/*.js\"",
"osd:ciGroup6": "echo \"apps/data_explorer/aaa_before.spec.js,apps/data_explorer/data_source_selector.spec.js,apps/data_explorer/date_nanos_mixed.spec.js,apps/data_explorer/date_nanos.spec.js,apps/data_explorer/discover_histogram.spec.js,apps/data_explorer/discover.spec.js,apps/data_explorer/zzz_after.spec.js\"",
"osd:ciGroup7": "echo \"apps/data_explorer/aaa_before.spec.js,apps/data_explorer/doc_navigation.spec.js,apps/data_explorer/doc_table.spec.js,apps/data_explorer/errors.spec.js,apps/data_explorer/field_data.spec.js,apps/data_explorer/zzz_after.spec.js\"",
"osd:ciGroup8": "echo \"apps/data_explorer/aaa_before.spec.js,apps/data_explorer/field_visualize.spec.js,apps/data_explorer/filter_editor.spec.js,apps/data_explorer/index_pattern_with_encoded_id.spec.js,apps/data_explorer/index_pattern_without_field.spec.js,apps/data_explorer/zzz_after.spec.js\"",
"osd:ciGroup9": "echo \"apps/data_explorer/aaa_before.spec.js,apps/data_explorer/inspector.spec.js,apps/data_explorer/large_string.spec.js,apps/data_explorer/saved_queries.spec.js,apps/data_explorer/shared_links.spec.js,apps/data_explorer/sidebar.spec.js,apps/data_explorer/source_filter.spec.js,apps/data_explorer/zzz_after.spec.js\"",
"osd:ciGroup1": "echo apps/vis_builder/*.js",
"osd:ciGroup2": "echo apps/vis_type_table/*.js",
"osd:ciGroup3": "echo apps/vis-augmenter/*.js",
"osd:ciGroup4": "echo dashboard_sample_data_with_datasource_spec.js,dashboard_sanity_test_spec.js,apps/telemetry/*.js",
"osd:ciGroup5": "echo datasource-management-plugin/*.js",
"osd:ciGroup6": "echo apps/data_explorer/aaa_before.spec.js,apps/data_explorer/data_source_selector.spec.js,apps/data_explorer/date_nanos_mixed.spec.js,apps/data_explorer/date_nanos.spec.js,apps/data_explorer/discover_histogram.spec.js,apps/data_explorer/discover.spec.js,apps/data_explorer/zzz_after.spec.js",
"osd:ciGroup7": "echo apps/data_explorer/aaa_before.spec.js,apps/data_explorer/doc_navigation.spec.js,apps/data_explorer/doc_table.spec.js,apps/data_explorer/errors.spec.js,apps/data_explorer/field_data.spec.js,apps/data_explorer/zzz_after.spec.js",
"osd:ciGroup8": "echo apps/data_explorer/aaa_before.spec.js,apps/data_explorer/field_visualize.spec.js,apps/data_explorer/filter_editor.spec.js,apps/data_explorer/index_pattern_with_encoded_id.spec.js,apps/data_explorer/index_pattern_without_field.spec.js,apps/data_explorer/zzz_after.spec.js",
"osd:ciGroup9": "echo apps/data_explorer/aaa_before.spec.js,apps/data_explorer/inspector.spec.js,apps/data_explorer/large_string.spec.js,apps/data_explorer/saved_queries.spec.js,apps/data_explorer/shared_links.spec.js,apps/data_explorer/sidebar.spec.js,apps/data_explorer/source_filter.spec.js,apps/data_explorer/zzz_after.spec.js",
"start-dummy-llm-server": "node ./cypress/support/assistant-dummy-llm.js"
},
"repository": {
Expand All @@ -53,8 +53,6 @@
"prettier": "^2.5.1"
},
"devDependencies": {
"@faker-js/faker": "^7.6.0",
"commander": "^9.4.1",
"cypress": "9.5.4",
"cypress-multi-reporters": "^1.5.0",
"cypress-real-events": "1.7.6",
Expand All @@ -65,7 +63,6 @@
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.0.0",
"husky": "^6.0.0",
"luxon": "^3.2.1",
"mocha-junit-reporter": "^2.0.0"
},
"overrides": {
Expand Down

0 comments on commit 6ac6946

Please sign in to comment.