Skip to content

Commit

Permalink
test: fix test?
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth committed Nov 10, 2023
1 parent a9ce819 commit 882e41e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 26 deletions.
32 changes: 20 additions & 12 deletions apps/consent/cypress/e2e/email-sign-in/login-email.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,28 @@ describe("Account ID Test", () => {
it("Login email Test", () => {
cy.log("login challenge : ", login_challenge)
const email = testData.EMAIL
cy.get("[data-testid=email_id_input]")
.should("exist")
.and("be.visible")
.and("not.be.disabled")
.type(email)
cy.get("[data-testid=email_login_next_btn]").should("exist").and("be.visible").click()

cy.get("[data-testid=email_id_input]").should("exist")
cy.get("[data-testid=email_id_input]").should("be.visible")
cy.get("[data-testid=email_id_input]").should("not.be.disabled")
cy.get("[data-testid=email_id_input]").type(email)

cy.get("[data-testid=email_login_next_btn]").should("exist")
cy.get("[data-testid=email_login_next_btn]").should("be.visible")
cy.get("[data-testid=email_login_next_btn]").click()

cy.getOTP(email).then((otp) => {
const code = otp
cy.get("[data-testid=verification_code_input]")
.should("exist")
.and("be.visible")
.and("not.be.disabled")
.type(code)
cy.get("[data-testid=submit_consent_btn]").should("exist").and("be.visible").click()

cy.get("[data-testid=verification_code_input]").should("exist")
cy.get("[data-testid=verification_code_input]").should("be.visible")
cy.get("[data-testid=verification_code_input]").should("not.be.disabled")
cy.get("[data-testid=verification_code_input]").type(code)

cy.get("[data-testid=submit_consent_btn]").should("exist")
cy.get("[data-testid=submit_consent_btn]").should("be.visible")
cy.get("[data-testid=submit_consent_btn]").should("not.be.disabled")
cy.get("[data-testid=submit_consent_btn]").click()
})
})
})
38 changes: 24 additions & 14 deletions apps/consent/cypress/e2e/phone-sign-in/login-phone.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,20 @@ describe("Account ID Test", () => {

it("Verification Test", () => {
cy.log("login challenge : ", login_challenge)
cy.get("[data-testid=sign_in_with_phone_text]")
.should("exist")
.and("be.visible")
.click()
cy.get("[data-testid=phone_number_input]")
.should("exist")
.and("be.visible")
.type(testData.PHONE_NUMBER)
cy.get("[data-testid=phone_login_next_btn]").should("exist").and("be.visible").click()

cy.get("[data-testid=sign_in_with_phone_text]").should("exist")
cy.get("[data-testid=sign_in_with_phone_text]").should("be.visible")
cy.get("[data-testid=sign_in_with_phone_text]").click()

cy.get("[data-testid=phone_number_input]").should("exist")
cy.get("[data-testid=phone_number_input]").should("be.visible")
cy.get("[data-testid=phone_number_input]").should("not.be.disabled")
cy.get("[data-testid=phone_number_input]").type(testData.PHONE_NUMBER)

cy.get("[data-testid=phone_login_next_btn]").should("exist")
cy.get("[data-testid=phone_login_next_btn]").should("be.visible")
cy.get("[data-testid=phone_login_next_btn]").should("not.be.disabled")
cy.get("[data-testid=phone_login_next_btn]").click()

if (!login_challenge) {
throw new Error("login_challenge does not found")
Expand All @@ -37,10 +42,15 @@ describe("Account ID Test", () => {
})
cy.setCookie(login_challenge, cookieValue, { secure: true })
cy.visit(`/login/verification?login_challenge=${login_challenge}`)
cy.get("[data-testid=verification_code_input]")
.should("exist")
.and("be.visible")
.type(testData.VERIFICATION_CODE)
cy.get("[data-testid=submit_consent_btn]").should("exist").and("be.visible").click()

cy.get("[data-testid=verification_code_input]").should("exist")
cy.get("[data-testid=verification_code_input]").should("be.visible")
cy.get("[data-testid=verification_code_input]").should("not.be.disabled")
cy.get("[data-testid=verification_code_input]").type(testData.VERIFICATION_CODE)

cy.get("[data-testid=submit_consent_btn]").should("exist")
cy.get("[data-testid=submit_consent_btn]").should("be.visible")
cy.get("[data-testid=submit_consent_btn]").should("not.be.disabled")
cy.get("[data-testid=submit_consent_btn]").click()
})
})

0 comments on commit 882e41e

Please sign in to comment.