Skip to content

Commit

Permalink
Complete e2e tests for file upload and block creation
Browse files Browse the repository at this point in the history
- Small fix for e2e test

- Fix example_data path for e2e test

- Tweak test cases for XRD plot
  • Loading branch information
BenjaminCharmes authored and ml-evs committed Oct 24, 2024
1 parent 6ffef53 commit 675906d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions webapp/cypress/e2e/editPage.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,25 +251,28 @@ describe("Edit Page", () => {
cy.findByText("editable_sample").click();

cy.findByText("Upload files...").click();
cy.findByText("Drop files here, browse files or import from:").should("exist");
cy.get(".uppy-Dashboard-AddFiles-title").should("contain.text", "Drop files here,");
cy.get(".uppy-Dashboard-AddFiles-title").should("contain.text", "browse files");
cy.get(".uppy-Dashboard-AddFiles-title").should("contain.text", "or import from:");
cy.findByLabelText("Close Modal").click();

cy.findByText("Add files from server...").click();
cy.findByText("Select files to add").should("exist");
cy.findByLabelText("Close").click();
cy.findAllByLabelText("Close").eq(1).click();
});

it("Uploads an XRD file, makes an XRD block and checks that the plot works", () => {
cy.uploadFileViaAPI("editable_sample", "XRD/example_bmb.xye");
cy.uploadFileViaAPI("editable_sample", "example_data/XRD/example_bmb.xye");

cy.get('[data-testid="search-input"]').type("editable_sample");
cy.findByText("editable_sample").click();

cy.findByText("Add a block").click();
cy.get(".dropdown-menu").findByText("Powder XRD").click();

cy.findByLabelText("Select a file:").click();
cy.get(".file-select-dropdown").findByText("example_bmb.xye").click();
cy.findByText("X axis").should("exist");
cy.findByText("Select a file:").should("exist");
cy.get("select.file-select-dropdown").select("example_data_XRD_example_bmb.xye");
cy.contains("label", "X axis").should("exist");
cy.contains("label", "Y axis").should("exist");
});
});
2 changes: 1 addition & 1 deletion webapp/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Cypress.Commands.add("uploadFileViaAPI", (itemId, path) => {
url: API_URL + "/upload-file/",
body: formData,
headers: { "Content-Type": "multipart/form-data" },
form: true,
form: false,
});
});
});
Expand Down

0 comments on commit 675906d

Please sign in to comment.