Skip to content

Commit

Permalink
flaky test flush action aliases
Browse files Browse the repository at this point in the history
Signed-off-by: Ramakrishna Chilaka <[email protected]>
  • Loading branch information
RamakrishnaChilaka committed Mar 26, 2024
1 parent bd37b58 commit bf5558d
Showing 1 changed file with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ describe("Aliases", () => {
describe("can flush an alias", () => {
it("successfully flush an index", () => {
let sample_alias = `${SAMPLE_ALIAS_PREFIX}-${1}`;
// Sort all aliases in asc order to make it at first page
cy.contains("Alias name").click();
// Confirm we have our initial alias
cy.contains(sample_alias);
cy.get('[placeholder="Search..."]').type(`${SAMPLE_ALIAS_PREFIX}-1{enter}`);
cy.contains(`${SAMPLE_ALIAS_PREFIX}-10`);
cy.contains(`${SAMPLE_ALIAS_PREFIX}-11`);
cy.contains(`${sample_alias}`);
// index a test doc
cy.request({
method: "POST",
Expand All @@ -170,23 +170,23 @@ describe("Aliases", () => {
expect(num).to.equal(1);
});

cy.get('[data-test-subj="moreAction"]').click();
// Flush btn should be disabled if no items selected
cy.get('[data-test-subj="Flush Action"]').should("have.class", "euiContextMenuItem-isDisabled");
cy.get('[data-test-subj="moreAction"] button').click().get('[data-test-subj="Flush Action"]').should("be.disabled").end();

// Select an alias
cy.get(`[data-test-subj="checkboxSelectRow-${sample_alias}"]`).check({
force: true,
});

cy.get('[data-test-subj="moreAction"]').click();
// Flush btn should be enabled
cy.get('[data-test-subj="Flush Action"]').should("exist").should("not.have.class", "euiContextMenuItem-isDisabled").click();
cy.get(`#_selection_column_${sample_alias}-checkbox`)
.click()
.get('[data-test-subj="moreAction"] button')
.click()
.get('[data-test-subj="Flush Action"]')
.should("not.be.disabled")
.click()
.end();

// Check for flush index modal
cy.contains("Flush alias");

cy.get('[data-test-subj="flushConfirmButton"]').click();
cy.get('[data-test-subj="flushConfirmButton"]').should("not.be.disabled").click();

// Check for success toast
cy.contains(`The alias ${sample_alias} has been successfully flushed.`);
Expand Down

0 comments on commit bf5558d

Please sign in to comment.