Skip to content

Commit

Permalink
test(apps): fix dashboard/voucher auth test
Browse files Browse the repository at this point in the history
  • Loading branch information
dolcalmi committed Oct 20, 2024
1 parent 4994b6e commit d0720d7
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 60 deletions.
2 changes: 1 addition & 1 deletion apps/dashboard/app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const authOptions: AuthOptions = {
},
},
],
debug: true,
debug: process.env.NODE_ENV === "development",
secret: env.NEXTAUTH_SECRET,
callbacks: {
async jwt({ token, account, profile }) {
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ export default defineConfig({
video: false,
retries: {
openMode: 1,
runMode: 2,
runMode: 3,
},
})
76 changes: 47 additions & 29 deletions apps/dashboard/cypress/e2e/consent-integration.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,62 @@ describe("Consent integration Test", () => {
})

it("Consent integration", () => {
cy.contains("button", "Sign in with Blink").should("exist")
cy.contains("button", "Sign in with Blink").should("be.visible")
cy.contains("button", "Sign in with Blink").should("not.be.disabled")
cy.contains("button", "Sign in with Blink").click()
cy.contains("button", "Sign in with Blink")
.should("exist")
.should("be.visible")
.should("not.be.disabled")
.click()

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

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

const email = signInData.EMAIL
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_id_input]")
.should("exist")
.should("be.visible")
.should("be.enabled")
.type(email)
.should("have.value", 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]").should("not.be.disabled")
cy.get("[data-testid=email_login_next_btn]").click()
cy.get("[data-testid=email_login_next_btn]")
.should("exist")
.should("be.visible")
.should("not.be.disabled")
.click()

cy.getOTP(email).then((otp) => {
const code = otp
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=verification_code_input]")
.should("exist")
.should("be.visible")
.should("not.be.disabled")
.type(code)

cy.contains("label", "read").should("exist")
cy.contains("label", "read").should("be.visible")
cy.contains("label", "read").should("not.be.disabled")
cy.contains("label", "read").should("not.be.disabled")
cy.contains("label", "read").click()
cy.contains("label", "read")
.should("exist")
.should("be.visible")
.should("not.be.disabled")
.should("not.be.disabled")
.click()

cy.contains("label", "write").should("exist")
cy.contains("label", "write").should("be.visible")
cy.contains("label", "write").should("not.be.disabled")
cy.contains("label", "write").click()
cy.contains("label", "write")
.should("exist")
.should("be.visible")
.should("not.be.disabled")
.click()

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()
cy.get("[data-testid=submit_consent_btn]")
.should("exist")
.should("be.visible")
.should("not.be.disabled")
.click()

cy.url().should("eq", Cypress.config().baseUrl + "/")
cy.getCookie("next-auth.session-token").then((cookie) => {
Expand Down
76 changes: 47 additions & 29 deletions apps/voucher/cypress/e2e/consent-integration.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,62 @@ describe("Consent integration Test", () => {
})

it("Consent integration", () => {
cy.contains("button", "Sign in with Blink").should("exist")
cy.contains("button", "Sign in with Blink").should("be.visible")
cy.contains("button", "Sign in with Blink").should("not.be.disabled")
cy.contains("button", "Sign in with Blink").click()
cy.contains("button", "Sign in with Blink")
.should("exist")
.should("be.visible")
.should("not.be.disabled")
.click()

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

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

const email = signInData.EMAIL
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_id_input]")
.should("exist")
.should("be.visible")
.should("be.enabled")
.type(email)
.should("have.value", 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]").should("not.be.disabled")
cy.get("[data-testid=email_login_next_btn]").click()
cy.get("[data-testid=email_login_next_btn]")
.should("exist")
.should("be.visible")
.should("not.be.disabled")
.click()

cy.getOTP(email).then((otp) => {
const code = otp
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=verification_code_input]")
.should("exist")
.should("be.visible")
.should("not.be.disabled")
.type(code)

cy.contains("label", "read").should("exist")
cy.contains("label", "read").should("be.visible")
cy.contains("label", "read").should("not.be.disabled")
cy.contains("label", "read").should("not.be.disabled")
cy.contains("label", "read").click()
cy.contains("label", "read")
.should("exist")
.should("be.visible")
.should("not.be.disabled")
.should("not.be.disabled")
.click()

cy.contains("label", "write").should("exist")
cy.contains("label", "write").should("be.visible")
cy.contains("label", "write").should("not.be.disabled")
cy.contains("label", "write").click()
cy.contains("label", "write")
.should("exist")
.should("be.visible")
.should("not.be.disabled")
.click()

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()
cy.get("[data-testid=submit_consent_btn]")
.should("exist")
.should("be.visible")
.should("not.be.disabled")
.click()

cy.url().should("eq", Cypress.config().baseUrl + "/")
cy.getCookie("next-auth.session-token").then((cookie) => {
Expand Down

0 comments on commit d0720d7

Please sign in to comment.