Skip to content

Commit

Permalink
Update for cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hannyle committed Dec 16, 2021
1 parent eba0a98 commit 99d4522
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 10 deletions.
1 change: 1 addition & 0 deletions cypress/integration/draft.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ describe("Draft operations", function () {
.then($el => $el.click())

// Fill
cy.get("input[name='descriptor.studyTitle']").should("be.visible")
cy.get("input[name='descriptor.studyTitle']").type("New title")
cy.get("input[name='descriptor.studyTitle']").should("have.value", "New title")
cy.get("select[name='descriptor.studyType']").select("Metagenomics")
Expand Down
5 changes: 4 additions & 1 deletion cypress/integration/editForm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ describe("Populate form and render form elements by object data", function () {

// Clear object in state
cy.get("button[type=button]", { timeout: 10000 }).contains("New form").should("exist")
cy.get("button[type=button]").contains("New form").click()
cy.get("button[type=button]")
.contains("New form")
.should("be.visible")
.then($el => $el.click())

// Test updated title
cy.get(".MuiListItem-container", { timeout: 10000 }).should("have.length", 1)
Expand Down
5 changes: 4 additions & 1 deletion cypress/integration/emptyForm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ describe("empty form should not be alerted or saved", function () {
cy.get("textarea[data-testid='description']").should("have.value", "Test experiment description")

// Click Clear form button and expect the form is empty
cy.get("button[type='button']").contains("Clear form").click({ force: true })
cy.get("button[type='button']")
.contains("Clear form")
.should("be.visible")
.then($el => $el.click())
cy.get("input[data-testid='title']").should("have.value", "")
cy.get("textarea[data-testid='description']").should("have.value", "")

Expand Down
3 changes: 1 addition & 2 deletions cypress/integration/i18n.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ describe("Internationalization", function () {
cy.get("#lang-selector").click()
cy.get("li[role=menuitem]").contains("Fi").click()

cy.get('[alt="CSC Login"]').click()
cy.wait(1000)
cy.login()

cy.get("[data-testid='logged-in-as'").contains("Kirjautuneena")
})
Expand Down
3 changes: 1 addition & 2 deletions cypress/integration/linkingAccessionIds.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ describe("Linking Accession Ids", function () {

it("should link correct accessionIds to the related objects", () => {
cy.visit(baseUrl)
cy.get('[alt="CSC Login"]').click()
cy.wait(1000)
cy.login()
cy.get("button", { timeout: 10000 }).contains("Create Submission").click()

// Add folder name & description, navigate to submissions
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Cypress.on("uncaught:exception", () => {

Cypress.Commands.add("login", () => {
cy.visit(baseUrl)
cy.get('[alt="CSC Login"]').click()
cy.get('a[data-testid="login-button"]').click()
cy.wait(1000)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const useStyles = makeStyles(theme => ({
},
},
viewButton: {
color: theme.palette.button.edit,
color: theme.palette.primary.main,
margin: theme.spacing(1.5, 0),
float: "right",
},
Expand All @@ -69,7 +69,7 @@ const useStyles = makeStyles(theme => ({
justifyContent: "space-between",
position: "sticky",
zIndex: 1,
backgroundColor: theme.palette.background.default,
backgroundColor: theme.palette.background.paper,
bottom: 0,
},
}))
Expand Down
1 change: 1 addition & 0 deletions src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const palette = {
},
background: {
default: "#e5eff1",
paper: "#fff",
},
success: {
main: "#51a808",
Expand Down
2 changes: 1 addition & 1 deletion src/views/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const Login = (): React$Element<typeof Container> => {
SD Submit
</Typography>
<Typography sx={{ mt: "2.25em", color: "secondary.main" }}>Tool for submitting metadata.</Typography>
<LoginButton variant="contained" color="primary" href={loginRoute}>
<LoginButton variant="contained" color="primary" href={loginRoute} data-testid="login-button">
Login
</LoginButton>
</LoginBanner>
Expand Down

0 comments on commit 99d4522

Please sign in to comment.