Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
joschrew committed Jan 10, 2024
2 parents 18385e6 + 1161861 commit b4015be
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/deploy-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,5 @@ jobs:
uses: cypress-io/github-action@v6
with:
config: baseUrl=${{ secrets.BASE_URL_TESTS_DEVELOP }}
env:
CYPRESS_PASSWORD: ${{ secrets.OLAHD_LOGIN_PASSWORD }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ yarn-error.log*
*.iml

docker-compose.https.yaml

cypress.env.json
42 changes: 42 additions & 0 deletions cypress/e2e/import_archive.cy.ts
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 added cypress/fixtures/kant_urtheilskraft.ocrd.zip
Binary file not shown.

0 comments on commit b4015be

Please sign in to comment.