-
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.
feat: add function test for IM plugin (opensearch-project#443)
* feat: add function test for IM plugin on v2.5 Signed-off-by: suzhou <suzhou@amazon.com> * feat: remove snapshot_spec Signed-off-by: suzhou <suzhou@amazon.com> * feat: remove duplicate commands Signed-off-by: suzhou <suzhou@amazon.com> * feat: remove duplicate commands Signed-off-by: suzhou <suzhou@amazon.com> * feat: remove some useless test case Signed-off-by: suzhou <suzhou@amazon.com> * feat: remove snapshot_spec and duplicate commands (opensearch-project#450) * feat: remove snapshot spec and update commands Signed-off-by: suzhou <suzhou@amazon.com> * feat: make actions to run again Signed-off-by: suzhou <suzhou@amazon.com> * feat: change to addIndexAlias & removeIndexAlias Signed-off-by: suzhou <suzhou@amazon.com> Signed-off-by: suzhou <suzhou@amazon.com> * feat: lint Signed-off-by: suzhou <suzhou@amazon.com> * feat: fix workflow bug Signed-off-by: suzhou <suzhou@amazon.com> * feat: use 2.5.0 version Signed-off-by: suzhou <suzhou@amazon.com> * feat: revert version to 3.0.0 Signed-off-by: suzhou <suzhou@amazon.com> --------- Signed-off-by: suzhou <suzhou@amazon.com>
- Loading branch information
1 parent
a0cd71c
commit 95edebc
Showing
8 changed files
with
1,427 additions
and
7 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
119 changes: 119 additions & 0 deletions
119
cypress/integration/plugins/index-management-dashboards-plugin/aliases.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,119 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import { IM_PLUGIN_NAME, BASE_PATH } from '../../../utils/constants'; | ||
|
||
const SAMPLE_INDEX_PREFIX = 'index-for-alias-test'; | ||
const SAMPLE_ALIAS_PREFIX = 'alias-for-test'; | ||
const CREATE_ALIAS = 'create-alias'; | ||
const EDIT_INDEX = 'index-edit-index-for-alias-test'; | ||
|
||
describe('Aliases', () => { | ||
before(() => { | ||
// Set welcome screen tracking to false | ||
localStorage.setItem('home:welcome:show', 'false'); | ||
cy.deleteAllIndices(); | ||
for (let i = 0; i < 11; i++) { | ||
cy.createIndex(`${SAMPLE_INDEX_PREFIX}-${i}`, null); | ||
} | ||
cy.createIndex(EDIT_INDEX, null); | ||
for (let i = 0; i < 30; i++) { | ||
cy.addIndexAlias( | ||
`${SAMPLE_ALIAS_PREFIX}-${i}`, | ||
`${SAMPLE_INDEX_PREFIX}-${i % 11}` | ||
); | ||
} | ||
cy.removeIndexAlias(`${SAMPLE_ALIAS_PREFIX}-0`); | ||
cy.addIndexAlias(`${SAMPLE_ALIAS_PREFIX}-0`, `${SAMPLE_INDEX_PREFIX}-*`); | ||
}); | ||
|
||
beforeEach(() => { | ||
// Visit ISM OSD | ||
cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/aliases`); | ||
|
||
// Common text to wait for to confirm page loaded, give up to 60 seconds for initial load | ||
cy.contains('Rows per page', { timeout: 60000 }); | ||
}); | ||
|
||
describe('can be searched / sorted / paginated', () => { | ||
it('successfully', () => { | ||
cy.get('[data-test-subj="pagination-button-1"]').should('exist'); | ||
cy.get('[placeholder="Search..."]').type('alias-for-test-0{enter}'); | ||
cy.contains('alias-for-test-0'); | ||
cy.get('.euiTableRow').should('have.length', 1); | ||
cy.get('[data-test-subj="comboBoxSearchInput"]').type('closed{enter}'); | ||
|
||
cy.contains( | ||
'There are no aliases matching your applied filters. Reset your filters to view your aliases.' | ||
); | ||
}); | ||
}); | ||
|
||
describe('shows more modal', () => { | ||
it('successfully', () => { | ||
cy.get('[placeholder="Search..."]').type('alias-for-test-0{enter}'); | ||
cy.contains('alias-for-test-0'); | ||
cy.get('.euiTableRow').should('have.length', 1); | ||
cy.get('.euiTableRowCell [data-test-subj="8 more"]') | ||
.click() | ||
.get('[data-test-subj="indices-table"] .euiTableRow') | ||
.should('have.length', 10); | ||
}); | ||
}); | ||
|
||
describe('can create a alias with wildcard and specific name', () => { | ||
it('successfully', () => { | ||
cy.get('[data-test-subj="Create AliasButton"]').click(); | ||
cy.get('[data-test-subj="form-name-alias"]').type(CREATE_ALIAS); | ||
cy.get( | ||
'[data-test-subj="form-name-indexArray"] [data-test-subj="comboBoxSearchInput"]' | ||
).type(`${EDIT_INDEX}{enter}${SAMPLE_INDEX_PREFIX}-*{enter}`); | ||
cy.get('.euiModalFooter .euiButton--fill') | ||
.click({ force: true }) | ||
.get('[data-test-subj="9 more"]') | ||
.should('exist'); | ||
}); | ||
}); | ||
|
||
describe('can edit / delete a alias', () => { | ||
it('successfully', () => { | ||
cy.get('[placeholder="Search..."]').type( | ||
`${SAMPLE_ALIAS_PREFIX}-0{enter}` | ||
); | ||
cy.contains(`${SAMPLE_ALIAS_PREFIX}-0`); | ||
cy.get('[data-test-subj="moreAction"] button') | ||
.click() | ||
.get('[data-test-subj="editAction"]') | ||
.should('be.disabled') | ||
.get(`#_selection_column_${SAMPLE_ALIAS_PREFIX}-0-checkbox`) | ||
.click() | ||
.get('[data-test-subj="moreAction"] button') | ||
.click() | ||
.get('[data-test-subj="editAction"]') | ||
.click() | ||
.get( | ||
'[data-test-subj="form-name-indexArray"] [data-test-subj="comboBoxInput"]' | ||
) | ||
.click() | ||
.type(`${EDIT_INDEX}{enter}`) | ||
.get(`[title="${SAMPLE_INDEX_PREFIX}-0"] button`) | ||
.click() | ||
.get(`[title="${SAMPLE_INDEX_PREFIX}-1"] button`) | ||
.click() | ||
.get('.euiModalFooter .euiButton--fill') | ||
.click({ force: true }) | ||
.end(); | ||
|
||
cy.get('[data-test-subj="7 more"]').should('exist'); | ||
}); | ||
}); | ||
|
||
after(() => { | ||
cy.deleteAllIndices(); | ||
for (let i = 0; i < 30; i++) { | ||
cy.removeIndexAlias(`${SAMPLE_ALIAS_PREFIX}-${i}`); | ||
} | ||
cy.removeIndexAlias(CREATE_ALIAS); | ||
}); | ||
}); |
Oops, something went wrong.