-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,5 @@ yarn-error.log* | |
*.iml | ||
|
||
docker-compose.https.yaml | ||
|
||
cypress.env.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
function uploadArchive(path_to_ocrdzip: string) { | ||
cy.visit("/") | ||
cy.get("button[id='user-menu-button']").click() | ||
cy.get("input[placeholder='Username']").type("admin") | ||
expect(Cypress.env("PASSWORD"), "PASSWORD not available as ENV").to.exist | ||
cy.get("input[placeholder='Password']").type(Cypress.env("PASSWORD")) | ||
cy.get("button").contains("Login").click() | ||
cy.wait(1500) | ||
cy.get("span").contains("Import").click() | ||
cy.get("input[type=file]").selectFile(path_to_ocrdzip) | ||
cy.wait(500) | ||
cy.get("button").contains("Submit").click() | ||
// It takes about 20 Seconds until the upload is available through search | ||
} | ||
|
||
|
||
describe("Import first Archive", () => { | ||
// The archive is only uploaded if olahd is empty | ||
it("Upload an archive if olahd is empty", () => { | ||
cy.visit("/search").then(() => { | ||
cy.wait(500) | ||
cy.get("p").invoke("text").then((val) => { | ||
if (val.includes("0 of 0 hits")) { | ||
uploadArchive("cypress/fixtures/kant_urtheilskraft.ocrd.zip") | ||
cy.get("h4").filter(":contains(Success!)").should("have.length", 1) | ||
} else if (val.includes("of hits")) { | ||
cy.log("page not fully loaded") | ||
} else { | ||
cy.log("at least one archive is already available: " + val) | ||
} | ||
}) | ||
}) | ||
}) | ||
}); | ||
|
||
describe("Test import validation", () => { | ||
it("Invalid mets should be rejected with appropriate error", () => { | ||
uploadArchive("cypress/fixtures/example_invalid_mets_structure.ocrd.zip") | ||
cy.contains("Failed") | ||
}); | ||
}); |
Binary file not shown.
Binary file not shown.