Skip to content

Fixed E2E for ISM dash #1295

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

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/actions/run-cypress-tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ runs:
if: ${{ inputs.with-security == 'false' }}
with:
working-directory: OpenSearch-Dashboards/plugins/index-management-dashboards-plugin
command: yarn run cypress run --config-file cypress.config.js
command: yarn run cypress run
wait-on: 'http://localhost:5601'
browser: chrome
- name: Cypress tests
uses: cypress-io/github-action@v5
if: ${{ inputs.with-security == 'true' }}
with:
working-directory: OpenSearch-Dashboards/plugins/index-management-dashboards-plugin
command: yarn run cypress run --config-file cypress.config.js --env SECURITY_ENABLED=true,openSearchUrl=https://localhost:9200,WAIT_FOR_LOADER_BUFFER_MS=500
command: yarn run cypress run --env SECURITY_ENABLED=true,openSearchUrl=https://localhost:9200,WAIT_FOR_LOADER_BUFFER_MS=500
wait-on: 'http://localhost:5601'
browser: chrome
# Screenshots are only captured on failure, will change this once we do visual regression tests
Expand Down
9 changes: 9 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@ module.exports = function (api) {
// Common plugins for all environments
const commonPlugins = [require("@babel/plugin-proposal-nullish-coalescing-operator")];

// Common configuration for all environments
const commonConfig = {
generatorOpts: {
maxSize: 1000000, // Increased size limit to handle larger files
},
};

// Test-specific configuration
if (isTest) {
return {
...commonConfig, // Spread the common configuration
presets: [require("@babel/preset-env"), require("@babel/preset-react"), require("@babel/preset-typescript")],
plugins: [
[require("@babel/plugin-transform-runtime"), { regenerator: true }],
Expand All @@ -27,6 +35,7 @@ module.exports = function (api) {

// Build/dev configuration
return {
...commonConfig, // Spread the common configuration
plugins: commonPlugins,
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import { IM_PLUGIN_NAME, BASE_PATH } from "../../../utils/constants";

const sampleIndex = "index-split";
const sampleAlias = "alias-split";
let splitNumber = 2;
let replicaNumber = 1;

describe("Split Index", () => {
before(() => {
cy.window().then((win) => {
win.localStorage.clear();
win.sessionStorage.clear();
win.localStorage.setItem("home:welcome:show", "false");
});
});

describe("can be created and updated", () => {
beforeEach(() => {
// Clear session data between tests
Cypress.session.clearCurrentSessionData();

cy.visit(`${BASE_PATH}/app/${IM_PLUGIN_NAME}#/indices`, {
timeout: 30000,
onBeforeLoad: (win) => {
win.sessionStorage.clear();
win.localStorage.clear();
},
});

// Wait for page load with proper assertion
cy.contains("Rows per page", { timeout: 20000 }).should("be.visible");
});

it("Create an index successfully", () => {
// enter create page
cy.get('[data-test-subj="Create IndexButton"]').click();
cy.contains("Create index");

// type field name
cy.get('[placeholder="Specify a name for the new index."]').type(sampleIndex).blur();

cy.wait(1000);

cy.get('[data-test-subj="comboBoxSearchInput"]').focus().type(`${sampleAlias}{enter}`).end();

// click create
cy.get('[data-test-subj="createIndexCreateButton"]').click().end();

// The index should exist
cy.get(`#_selection_column_${sampleIndex}-checkbox`).should("have.exist").end();

cy.get(`[data-test-subj="viewIndexDetailButton-${sampleIndex}"]`).click().end();
cy.get("#indexDetailModalSettings").click().end();

cy.get('[data-test-subj="form-name-index.number_of_shards"] .euiText').then(($shardNumber) => {
splitNumber = $shardNumber.attr("title") * 2;
});

cy.get("#indexDetailModalAlias").click().end();
cy.get(`[title="${sampleAlias}"]`).should("exist").end();

// Update Index status to blocks write otherwise we can't apply split operation on it
cy.updateIndexSettings(sampleIndex, {
"index.blocks.write": "true",
}).end();
}); //create the index

it("Split successfully", () => {
const targetIndex = `${sampleIndex}` + "-target";
cy.get(`[data-test-subj="checkboxSelectRow-${sampleIndex}"]`).click().end();

cy.wait(3000);
cy.get('[data-test-subj="moreAction"]').click().end().get('[data-test-subj="Split Action"]').click().end();
// Target Index Name is required
cy.get('[data-test-subj="targetIndexNameInput"]').type(`${targetIndex}`).end();
// Number of shards after split is required
cy.get('[data-test-subj="numberOfShardsInput"]').type(`${splitNumber}{downArrow}{enter}`).end();
cy.get('[data-test-subj="numberOfReplicasInput"]').clear().type(`${replicaNumber}`).end();
cy.get('[data-test-subj="splitButton"]').click().end();

cy.wait(3000);

cy.get(`[data-test-subj="viewIndexDetailButton-${targetIndex}"]`).click().end();
cy.get("#indexDetailModalSettings").click().end();
cy.get('[data-test-subj="form-name-index.number_of_shards"] .euiText').should("have.text", `${splitNumber}`).end();
cy.get('[data-test-subj="form-name-index.number_of_replicas"] input').should("have.value", `${replicaNumber}`).end();
}); // Split
});
});

This file was deleted.

Loading