Skip to content

Commit

Permalink
Reindex operation
Browse files Browse the repository at this point in the history
Signed-off-by: Hailong Cui <[email protected]>
  • Loading branch information
Hailong-am committed Nov 9, 2022
1 parent 3e79127 commit f04c235
Show file tree
Hide file tree
Showing 93 changed files with 9,945 additions and 973 deletions.
86 changes: 78 additions & 8 deletions cypress/integration/create_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,44 @@
*/
import { PLUGIN_NAME } from "../support/constants";

const SAMPLE_INDEX = "index_simple_index";
const SAMPLE_INDEX = "index-specific-index";

describe("Create Index", () => {
before(() => {
// Set welcome screen tracking to false
localStorage.setItem("home:welcome:show", "false");
cy.deleteAllIndices();
cy.deleteTemplate("index-common-template");
cy.deleteTemplate("index-specific-template");
cy.createIndexTemplate("index-common-template", {
index_patterns: ["index-*"],
template: {
aliases: {
alias_for_common_1: {},
alias_for_common_2: {},
},
settings: {
number_of_shards: 2,
number_of_replicas: 1,
},
},
});
cy.createIndexTemplate("index-specific-template", {
index_patterns: ["index-specific-*"],
priority: 1,
template: {
aliases: {
alias_for_specific_1: {},
},
mappings: {
properties: {
text: {
type: "text",
},
},
},
},
});
});

describe("can be created and updated", () => {
Expand All @@ -26,7 +57,10 @@ describe("Create Index", () => {
cy.contains("Create index");

// type field name
cy.get('[placeholder="Please enter the name for your index"]').type(SAMPLE_INDEX);
cy.get('[placeholder="Please enter the name for your index"]').type(SAMPLE_INDEX).blur();

cy.get('[data-test-subj="comboBoxSearchInput"]').get('[title="alias_for_specific_1"]').should("exist");

cy.get('[data-test-subj="comboBoxSearchInput"]').type("some_test_alias{enter}");
// add a field
cy.get('[data-test-subj="create index add field button"]').click().end();
Expand Down Expand Up @@ -68,7 +102,10 @@ describe("Create Index", () => {
.click()
.end()
.get('[data-test-subj="createIndexCreateButton"]')
.click({ force: true });
.click({ force: true })
.end()
.get('[data-test-subj="change_diff_confirm-confirm"]')
.click();

// check the index
cy.get(`[data-test-subj="view-index-detail-button-${SAMPLE_INDEX}"]`)
Expand Down Expand Up @@ -97,11 +134,37 @@ describe("Create Index", () => {
.get('[data-test-subj="detail-modal-edit"]')
.click();

cy.get('[placeholder="The number of replica shards each primary shard should have."]')
.type(2)
cy.get('[aria-controls="accordion_for_create_index_settings"]')
.click()
.end()
.get('[data-test-subj="createIndexCreateButton"]')
.click({ force: true });
.get('[data-test-subj="codeEditorContainer"] textarea')
.focus()
.clear()
.type('{ "index.blocks.write": true, "index.number_of_shards": 2 }', { parseSpecialCharSequences: false })
.blur();

cy.get('[data-test-subj="createIndexCreateButton"]')
.click({ force: true })
.get('[data-test-subj="change_diff_confirm-confirm"]')
.click();

cy.contains(`Can't update non dynamic settings`).should("exist");

cy.get('[data-test-subj="codeEditorContainer"] textarea')
.focus()
.clear()
.type('{ "index.blocks.write": true }', { parseSpecialCharSequences: false })
.blur()
.end()
.wait(1000)
.get('[placeholder="The number of replica shards each primary shard should have."]')
.type(2)
.end();

cy.get('[data-test-subj="createIndexCreateButton"]')
.click({ force: true })
.get('[data-test-subj="change_diff_confirm-confirm"]')
.click();

cy.get(`[data-test-subj="view-index-detail-button-${SAMPLE_INDEX}"]`)
.click()
Expand All @@ -125,7 +188,9 @@ describe("Create Index", () => {
.click()
.end()
.get('[data-test-subj="createIndexCreateButton"]')
.click({ force: true });
.click({ force: true })
.get('[data-test-subj="change_diff_confirm-confirm"]')
.click();

cy.get(`[data-test-subj="view-index-detail-button-${SAMPLE_INDEX}"]`)
.click()
Expand All @@ -137,4 +202,9 @@ describe("Create Index", () => {
cy.get('[data-test-subj="mapping-visual-editor-1-field-type"]').should("have.value", "text").end();
});
});

after(() => {
cy.deleteTemplate("index-common-template");
cy.deleteTemplate("index-specific-template");
});
});
Loading

0 comments on commit f04c235

Please sign in to comment.