forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI][BWC] add BWC tests to github actions (opensearch-project#1624)
* [CI][BWC] add BWC tests to github actions Add backwards compatibility tests to github workflow for PRs. Also, fix for checking status of OpenSearch Dashboards since api/status/ is not protected. Also, enable ability to create test data since migration from 1.0.0 to 3.0.0 is not supported for OpenSearch currently. Issue: opensearch-project#1465 opensearch-project#1651 Signed-off-by: Kawika Avilla <kavilla414@gmail.com> * Address comments Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
- Loading branch information
Showing
13 changed files
with
322 additions
and
20 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
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
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
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
86 changes: 86 additions & 0 deletions
86
cypress/integration/with-security/helpers/generate_data.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,86 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { | ||
MiscUtils, | ||
LoginPage, | ||
} from '@opensearch-dashboards-test/opensearch-dashboards-test-library'; | ||
|
||
const miscUtils = new MiscUtils(cy); | ||
const loginPage = new LoginPage(cy); | ||
|
||
describe('Generating BWC test data with security', () => { | ||
beforeEach(() => { | ||
miscUtils.visitPage('app/management/opensearch-dashboards/settings'); | ||
loginPage.enterUserName('admin'); | ||
loginPage.enterPassword('admin'); | ||
loginPage.submit(); | ||
}); | ||
|
||
afterEach(() => { | ||
cy.clearCookies(); | ||
}); | ||
|
||
it('tenant-switch-modal page should show and be clicked', () => { | ||
cy.get('[data-test-subj="tenant-switch-modal"]'); | ||
cy.get('[data-test-subj="confirm"]').click(); | ||
}); | ||
|
||
it('adds advanced settings', () => { | ||
miscUtils.visitPage('app/management/opensearch-dashboards/settings'); | ||
cy.get('[data-test-subj="advancedSetting-editField-theme:darkMode"]').click(); | ||
cy.get('[data-test-subj="advancedSetting-editField-timeline:default_columns"]').type( | ||
'{selectAll}4' | ||
); | ||
cy.get('[data-test-subj="advancedSetting-editField-timeline:max_buckets"]').type( | ||
'{selectAll}4' | ||
); | ||
cy.get('[data-test-subj="advancedSetting-editField-defaultRoute"]') | ||
.clear() | ||
.type('/app/opensearch_dashboards_overview#/'); | ||
cy.get('[data-test-subj="advancedSetting-saveButton"]').click({ force: true }); | ||
cy.reload(); | ||
}); | ||
|
||
it('adds sample data', () => { | ||
miscUtils.addSampleData(); | ||
}); | ||
|
||
it('adds filters and queries', () => { | ||
miscUtils.visitPage('app/dashboards#'); | ||
cy.get('[data-test-subj="dashboardListingTitleLink-[Logs]-Web-Traffic"]').click(); | ||
cy.get('[data-test-subj="queryInput"]').clear().type('resp=200'); | ||
cy.get('[data-test-subj="addFilter"]').click(); | ||
cy.get('[data-test-subj="filterFieldSuggestionList"]') | ||
.find('[data-test-subj="comboBoxInput"]') | ||
.type('machine.os{downArrow}{enter}'); | ||
cy.get('[data-test-subj="filterOperatorList"]') | ||
.find('[data-test-subj="comboBoxInput"]') | ||
.type('{downArrow}{enter}'); | ||
cy.get('[data-test-subj="filterParams"]') | ||
.find('input.euiFieldText[placeholder="Enter a value"]') | ||
.type('osx'); | ||
cy.get('[data-test-subj="createCustomLabel"]').click(); | ||
cy.get('[class="globalFilterItem__editorForm"]').find('input').last().type('osx filter'); | ||
cy.get('[data-test-subj="saveFilter"]').click(); | ||
cy.get('[data-test-subj="saved-query-management-popover-button"]').click(); | ||
cy.get('[data-test-subj="saved-query-management-popover"]') | ||
.find('[data-test-subj="saved-query-management-save-button"]') | ||
.click(); | ||
cy.get('[data-test-subj="saveQueryFormTitle"]').type('test-query'); | ||
cy.get('[data-test-subj="savedQueryFormSaveButton"]').click(); | ||
}); | ||
|
||
it('adds Timeline visualization', () => { | ||
miscUtils.visitPage('app/visualize#'); | ||
cy.get('[data-test-subj="visualizationLandingPage"]') | ||
.find('[data-test-subj="newItemButton"]') | ||
.click(); | ||
cy.get('[data-test-subj="visType-timelion"]').click(); | ||
cy.get('[data-test-subj="visualizeSaveButton"]').click(); | ||
cy.get('[data-test-subj="savedObjectTitle"]').type('test-timeline'); | ||
cy.get('[data-test-subj="confirmSaveSavedObjectButton"]').click(); | ||
}); | ||
}); |
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
69 changes: 69 additions & 0 deletions
69
cypress/integration/without-security/helpers/generate_data.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,69 @@ | ||
/* | ||
* 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('Generating BWC test data without security', () => { | ||
before(() => { | ||
miscUtils.visitPage('app'); | ||
}); | ||
it('adds advanced settings', () => { | ||
miscUtils.visitPage('app/management/opensearch-dashboards/settings'); | ||
cy.get('[data-test-subj="advancedSetting-editField-theme:darkMode"]').click(); | ||
cy.get('[data-test-subj="advancedSetting-editField-timeline:default_columns"]').type( | ||
'{selectAll}4' | ||
); | ||
cy.get('[data-test-subj="advancedSetting-editField-timeline:max_buckets"]').type( | ||
'{selectAll}4' | ||
); | ||
cy.get('[data-test-subj="advancedSetting-editField-defaultRoute"]') | ||
.clear() | ||
.type('/app/opensearch_dashboards_overview#/'); | ||
cy.get('[data-test-subj="advancedSetting-saveButton"]').click({ force: true }); | ||
cy.reload(); | ||
}); | ||
|
||
it('adds sample data', () => { | ||
miscUtils.addSampleData(); | ||
}); | ||
|
||
it('adds filters and queries', () => { | ||
miscUtils.visitPage('app/dashboards#'); | ||
cy.get('[data-test-subj="dashboardListingTitleLink-[Logs]-Web-Traffic"]').click(); | ||
cy.get('[data-test-subj="queryInput"]').clear().type('resp=200'); | ||
cy.get('[data-test-subj="addFilter"]').click(); | ||
cy.get('[data-test-subj="filterFieldSuggestionList"]') | ||
.find('[data-test-subj="comboBoxInput"]') | ||
.type('machine.os{downArrow}{enter}'); | ||
cy.get('[data-test-subj="filterOperatorList"]') | ||
.find('[data-test-subj="comboBoxInput"]') | ||
.type('{downArrow}{enter}'); | ||
cy.get('[data-test-subj="filterParams"]') | ||
.find('input.euiFieldText[placeholder="Enter a value"]') | ||
.type('osx'); | ||
cy.get('[data-test-subj="createCustomLabel"]').click(); | ||
cy.get('[class="globalFilterItem__editorForm"]').find('input').last().type('osx filter'); | ||
cy.get('[data-test-subj="saveFilter"]').click(); | ||
cy.get('[data-test-subj="saved-query-management-popover-button"]').click(); | ||
cy.get('[data-test-subj="saved-query-management-popover"]') | ||
.find('[data-test-subj="saved-query-management-save-button"]') | ||
.click(); | ||
cy.get('[data-test-subj="saveQueryFormTitle"]').type('test-query'); | ||
cy.get('[data-test-subj="savedQueryFormSaveButton"]').click(); | ||
}); | ||
|
||
it('adds Timeline visualization', () => { | ||
miscUtils.visitPage('app/visualize#'); | ||
cy.get('[data-test-subj="visualizationLandingPage"]') | ||
.find('[data-test-subj="newItemButton"]') | ||
.click(); | ||
cy.get('[data-test-subj="visType-timelion"]').click(); | ||
cy.get('[data-test-subj="visualizeSaveButton"]').click(); | ||
cy.get('[data-test-subj="savedObjectTitle"]').type('test-timeline'); | ||
cy.get('[data-test-subj="confirmSaveSavedObjectButton"]').click(); | ||
}); | ||
}); |
Binary file not shown.
Binary file not shown.
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,22 @@ | ||
#!/bin/bash | ||
|
||
# Copyright OpenSearch Contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set -e | ||
|
||
function run_generate_data_spec() { | ||
echo "[ Generating test data ]" | ||
cd "$TEST_DIR" | ||
[ "$CI" == '1' ] && cypress_args="--browser chromium" || cypress_args="" | ||
SPEC_FILE="$TEST_DIR/cypress/integration/$DASHBOARDS_TYPE/helpers/generate_data.js" | ||
env NO_COLOR=1 npx cypress run $cypress_args --headless --spec $SPEC_FILE || true | ||
} | ||
|
||
function archive_data() { | ||
echo "[ Archiving test data. Beep boo-boo, boo-boo bop ]" | ||
PACKAGE_VERSION=$(get_dashboards_package_version) | ||
cd "$OPENSEARCH_DIR" && tar -zcvf "osd-$PACKAGE_VERSION.tar.gz" data | ||
cp "osd-$PACKAGE_VERSION.tar.gz" "$CWD/cypress/test-data/$DASHBOARDS_TYPE" | ||
echo "[ Archive complete. Location: $CWD/cypress/test-data/$DASHBOARDS_TYPE/osd-$PACKAGE_VERSION.tar.gz' ]" | ||
} |
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
Oops, something went wrong.