Skip to content

Commit

Permalink
Use data-test-id for better encapsulation of dropdown testing
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Nov 29, 2024
1 parent 05b143b commit 7b3dabd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions webapp/cypress/e2e/editPage.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,12 @@ describe("Edit Page", () => {
cy.findByText("editable_sample").click();

cy.findByText("Add a block").click();
cy.get(".dropdown-menu").findByText("Comment").click();
cy.get('[data-testid="add-block-dropdown"]').findByText("Comment").click();

cy.contains("Unsaved changes").should("not.exist");

cy.findByText("Add a block").click();
cy.get(".dropdown-menu").findByText("Comment").click();
cy.get('[data-testid="add-block-dropdown"]').findByText("Comment").click();

cy.contains("Unsaved changes").should("not.exist");

Expand Down Expand Up @@ -267,7 +267,7 @@ describe("Edit Page", () => {
cy.findByText("editable_sample").click();

cy.findByText("Add a block").click();
cy.get(".dropdown-menu").findByText("Powder XRD").click();
cy.get('[data-testid="add-block-dropdown"]').findByText("Powder XRD").click();

cy.findByText("Select a file:").should("exist");
cy.get("select.file-select-dropdown").select("example_data_XRD_example_bmb.xye");
Expand All @@ -284,7 +284,7 @@ describe("Edit Page", () => {
cy.findByText("editable_sample").click();

cy.findByText("Add a block").click();
cy.get(".dropdown-menu").findByText("Media").click();
cy.get('[data-testid="add-block-dropdown"]').findByText("Media").click();
cy.findAllByText("Select a file:").eq(1).should("exist");
cy.get("select.file-select-dropdown").eq(1).select(test_fname);

Expand Down
1 change: 1 addition & 0 deletions webapp/src/views/EditPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
v-if="blockInfoLoaded"
v-show="isMenuDropdownVisible"
class="dropdown-menu"
data-testid="add-block-dropdown"
style="display: block"
aria-labelledby="navbarDropdown"
>
Expand Down

0 comments on commit 7b3dabd

Please sign in to comment.