-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/opensearch-project/opensear…
…ch-dashboards-functional-test into feature-anywhere # Conflicts: # cypress/utils/dashboards/commands.js
- Loading branch information
Showing
23 changed files
with
21,910 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20,000 changes: 20,000 additions & 0 deletions
20,000
cypress/fixtures/dashboard/opensearch_dashboards/vis_type_table/table.data.txt
Large diffs are not rendered by default.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
cypress/fixtures/dashboard/opensearch_dashboards/vis_type_table/table_saved_objects.ndjson
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{"id":"index-pattern-vis-table","type":"index-pattern","namespaces":["default"],"updated_at":"2022-12-05T21:14:35.148Z","version":"WzUwLDFd","attributes":{"title":"vis-table","timeFieldName":"timestamp"},"references":[],"migrationVersion":{"index-pattern":"7.6.0"}} | ||
{"id":"f3f0a6f0-74de-11ed-9a2e-2509e8c9c014","type":"visualization","namespaces":["default"],"updated_at":"2022-12-05T20:54:04.254Z","version":"WzQ0LDFd","attributes":{"title":"TABLE: Basic","visState":"{\"title\":\"TABLE: Basic\",\"type\":\"table\",\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"params\":{},\"schema\":\"metric\"}],\"params\":{\"perPage\":10,\"showPartialRows\":false,\"showMetricsAtAllLevels\":false,\"showTotal\":false,\"totalFunc\":\"sum\",\"percentageCol\":\"\"}}","uiStateJSON":"{}","description":"A basic table visualization","version":1,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[],\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}"}},"references":[{"name":"kibanaSavedObjectMeta.searchSourceJSON.index","type":"index-pattern","id":"index-pattern-vis-table"}],"migrationVersion":{"visualization":"7.10.0"}} | ||
{"exportedCount":1,"missingRefCount":0,"missingReferences":[]} |
2 changes: 1 addition & 1 deletion
2
cypress/fixtures/plugins/security-dashboards-plugin/users/testUser.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"password": "password" | ||
"password": "testUserPassword123" | ||
} |
112 changes: 112 additions & 0 deletions
112
...ration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_type_table/basic.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { | ||
TABLE_INDEX_ID, | ||
TABLE_INDEX_PATTERN, | ||
TABLE_PATH_INDEX_DATA, | ||
TABLE_INDEX_START_TIME, | ||
TABLE_INDEX_END_TIME, | ||
TABLE_CREATE_URL, | ||
TABLE_VIS_APP_PATH, | ||
TABLE_VIS_TYPE, | ||
} from '../../../../../utils/constants'; | ||
|
||
/** | ||
* Basic test suite description: | ||
* Create a new table visualization from index pattern. | ||
* Set the time range and Histogram Aggregation. | ||
* Test that global header and side bar function correctly. | ||
* Test that table visualization can be saved. | ||
* Test inspector is enabled and contains correct data. | ||
*/ | ||
|
||
describe('table visualization basic functions', () => { | ||
before(() => { | ||
cy.deleteIndex(TABLE_INDEX_ID); | ||
cy.deleteIndexPattern(TABLE_INDEX_PATTERN); | ||
cy.bulkUploadDocs(TABLE_PATH_INDEX_DATA); | ||
cy.createIndexPattern(TABLE_INDEX_PATTERN, { | ||
title: TABLE_INDEX_ID, | ||
timeFieldName: 'timestamp', | ||
}); | ||
|
||
cy.log('create a new table visualization: ', TABLE_CREATE_URL); | ||
cy.visit(TABLE_CREATE_URL); | ||
cy.url().should('contain', TABLE_VIS_APP_PATH); | ||
// Select index pattern and load table visualization | ||
cy.setTopNavDate(TABLE_INDEX_START_TIME, TABLE_INDEX_END_TIME); | ||
// Wait for page to load | ||
cy.waitForLoader(); | ||
}); | ||
|
||
it('Should apply changed params and allow to reset', () => { | ||
// Set a Histogram Aggregation | ||
cy.tbAddBucketsAggregation(); | ||
cy.tbSplitRows(); | ||
cy.tbSetupHistogramAggregation('age', '20', 2); | ||
// Update Historgram interval | ||
cy.tbSetHistogramInterval('201', 2); | ||
cy.tbIsUpdateAggregationSettingsEnabled(); | ||
// Discard the updated interval | ||
cy.tbDiscardAggregationSettings(); | ||
cy.tbIsHistogramIntervalSet('20', 2); | ||
}); | ||
|
||
it('Should be able to save and load', () => { | ||
const cleanupKey = Date.now(); | ||
const title = `table${cleanupKey}`; | ||
// Save | ||
cy.log('Save this table visualization with title ', title); | ||
cy.getElementByTestId('visualizeSaveButton') | ||
.should('not.be.disabled') | ||
.click(); | ||
cy.getElementByTestId('savedObjectTitle').type(title); | ||
cy.getElementByTestId('confirmSaveSavedObjectButton').click(); | ||
// Verify save | ||
cy.getElementByTestId('breadcrumb last') | ||
.invoke('attr', 'title') | ||
.should('equal', title); | ||
// Cleanup | ||
cy.log('Remove saved table visualization with title ', title); | ||
cy.deleteSavedObjectByType(TABLE_VIS_TYPE, title); | ||
}); | ||
|
||
it('Should have inspector enabled', () => { | ||
cy.getElementByTestId('openInspectorButton') | ||
.invoke('attr', 'class') | ||
.should( | ||
'equal', | ||
'euiButtonEmpty euiButtonEmpty--primary euiButtonEmpty--xSmall euiHeaderLink' | ||
); | ||
}); | ||
|
||
it('Should show correct data in inspector', () => { | ||
const expectedData = [ | ||
'0', | ||
'1,059', | ||
'20', | ||
'2,236', | ||
'40', | ||
'2,200', | ||
'60', | ||
'2,211', | ||
'80', | ||
'2,179', | ||
'100', | ||
'115', | ||
]; | ||
cy.tbOpenInspector(); | ||
cy.tbGetTableDataFromInspectPanel().then((data) => { | ||
expect(data).to.deep.eq(expectedData); | ||
}); | ||
cy.tbCloseInspector(); | ||
}); | ||
|
||
after(() => { | ||
cy.deleteIndex(TABLE_INDEX_ID); | ||
cy.deleteIndexPattern(TABLE_INDEX_PATTERN); | ||
}); | ||
}); |
Oops, something went wrong.