From 7ca18bd0c863b9519331e325719463bb5c08779e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Carden=CC=83a?= <35935591+luisecm@users.noreply.github.com> Date: Fri, 24 May 2024 16:10:21 -0600 Subject: [PATCH 1/2] test(add): add tests for pin input --- cypress/e2e/01-pin-input.cy.ts | 21 ++++++++++++++++++--- cypress/e2e/PageObjects/ChatsMain.ts | 2 +- cypress/e2e/PageObjects/LoginPin.ts | 24 ++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/01-pin-input.cy.ts b/cypress/e2e/01-pin-input.cy.ts index c5eb17ab..8e4badef 100644 --- a/cypress/e2e/01-pin-input.cy.ts +++ b/cypress/e2e/01-pin-input.cy.ts @@ -2,12 +2,12 @@ import { chatsMainPage } from "./PageObjects/ChatsMain"; import { loginPinPage } from "./PageObjects/LoginPin"; import { preLoadingPage } from "./PageObjects/PreLoading"; -describe("Pin Screen", () => { +describe("Create Account and Login", () => { beforeEach(() => { loginPinPage.launchApplication(); }); - it("Enter Pin Screen - Enter valid PIN", () => { + it("Create Account and Login - Enter valid PIN redirects to Main Page", () => { loginPinPage.launchApplication(); loginPinPage.waitUntilPageIsLoaded(); loginPinPage.enterPin("1234"); @@ -19,13 +19,28 @@ describe("Pin Screen", () => { chatsMainPage.validateURL(); }); - it("Enter Pin Screen - Enter PIN with 3 digits", () => { + it("Create Account and Login - Pin should have at least 4 digits", () => { loginPinPage.launchApplication(); loginPinPage.waitUntilPageIsLoaded(); loginPinPage.enterPin("123"); loginPinPage.validateConfirmButtonIsDisabled(); }); + it("Create Account and Login - Pin cannot have more than 8 digits", () => { + loginPinPage.launchApplication(); + loginPinPage.waitUntilPageIsLoaded(); + loginPinPage.enterPin("12345678901234"); + loginPinPage.pinDotFilled.should("have.length", 8); + }); + + it("Create Account and Login - Clicking red reset button should erase any inputs made", () => { + loginPinPage.launchApplication(); + loginPinPage.waitUntilPageIsLoaded(); + loginPinPage.enterPin("12345678"); + loginPinPage.clickClearPin(); + loginPinPage.pinDotFilled.should("have.length", 0); + }); + it("Enter Pin Screen - Scramble Keypad", () => { loginPinPage.launchApplication(); loginPinPage.waitUntilPageIsLoaded(); diff --git a/cypress/e2e/PageObjects/ChatsMain.ts b/cypress/e2e/PageObjects/ChatsMain.ts index 7ed39124..1b2c22bd 100644 --- a/cypress/e2e/PageObjects/ChatsMain.ts +++ b/cypress/e2e/PageObjects/ChatsMain.ts @@ -1,6 +1,6 @@ class ChatsMainPage { get addSomeone() { - return cy.get(".add-someone"); + return cy.get(".add-someone", { timeout: 30000 }); } public validateAddSomeoneIsShown() { diff --git a/cypress/e2e/PageObjects/LoginPin.ts b/cypress/e2e/PageObjects/LoginPin.ts index 0345e612..5e73aa4e 100644 --- a/cypress/e2e/PageObjects/LoginPin.ts +++ b/cypress/e2e/PageObjects/LoginPin.ts @@ -1,4 +1,12 @@ class LoginPinPage { + get clearInputButton() { + return cy.getByTestAttr("button-clear-input"); + } + + get labelChooseEnterPin() { + return cy.getByTestAttr("label-choose-enter-pin"); + } + get pinButton0() { return cy.getByTestAttr("button-pin-0"); } @@ -43,6 +51,18 @@ class LoginPinPage { return cy.getByTestAttr("button-confirm-pin"); } + get pinDisplay() { + return cy.getByTestAttr("pin-display"); + } + + get pinDot() { + return cy.getByTestAttr("pin-dot-filled"); + } + + get pinDotFilled() { + return cy.getByTestAttr("pin-dot-filled"); + } + get pinKeypad() { return cy.getByTestAttr("pin-keypad", { timeout: 30000 }); } @@ -67,6 +87,10 @@ class LoginPinPage { return cy.getByTestAttr("button-settings"); } + public clickClearPin() { + this.clearInputButton.click(); + } + public clickConfirm() { this.pinButtonConfirm.click(); } From e1b5fb99905735856e44b5d3abe3c757cad20893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Carden=CC=83a?= <35935591+luisecm@users.noreply.github.com> Date: Fri, 24 May 2024 18:43:38 -0600 Subject: [PATCH 2/2] test(add): add tests for pin screen --- cypress/e2e/01-pin-input.cy.ts | 24 ++++++++++++++++++------ cypress/e2e/PageObjects/PreLoading.ts | 2 +- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/cypress/e2e/01-pin-input.cy.ts b/cypress/e2e/01-pin-input.cy.ts index 8e4badef..95974eb6 100644 --- a/cypress/e2e/01-pin-input.cy.ts +++ b/cypress/e2e/01-pin-input.cy.ts @@ -2,12 +2,12 @@ import { chatsMainPage } from "./PageObjects/ChatsMain"; import { loginPinPage } from "./PageObjects/LoginPin"; import { preLoadingPage } from "./PageObjects/PreLoading"; -describe("Create Account and Login", () => { +describe("Create Account and Login Tests", () => { beforeEach(() => { loginPinPage.launchApplication(); }); - it("Create Account and Login - Enter valid PIN redirects to Main Page", () => { + it("Enter valid PIN redirects to Main Page", () => { loginPinPage.launchApplication(); loginPinPage.waitUntilPageIsLoaded(); loginPinPage.enterPin("1234"); @@ -19,21 +19,21 @@ describe("Create Account and Login", () => { chatsMainPage.validateURL(); }); - it("Create Account and Login - Pin should have at least 4 digits", () => { + it("Pin should have at least 4 digits", () => { loginPinPage.launchApplication(); loginPinPage.waitUntilPageIsLoaded(); loginPinPage.enterPin("123"); loginPinPage.validateConfirmButtonIsDisabled(); }); - it("Create Account and Login - Pin cannot have more than 8 digits", () => { + it("Pin cannot have more than 8 digits", () => { loginPinPage.launchApplication(); loginPinPage.waitUntilPageIsLoaded(); loginPinPage.enterPin("12345678901234"); loginPinPage.pinDotFilled.should("have.length", 8); }); - it("Create Account and Login - Clicking red reset button should erase any inputs made", () => { + it("Clicking red reset button should erase any inputs made", () => { loginPinPage.launchApplication(); loginPinPage.waitUntilPageIsLoaded(); loginPinPage.enterPin("12345678"); @@ -41,7 +41,19 @@ describe("Create Account and Login", () => { loginPinPage.pinDotFilled.should("have.length", 0); }); - it("Enter Pin Screen - Scramble Keypad", () => { + it("Settings dropdown should show option to Scramble numberpad and option to stay unlocked", () => { + loginPinPage.launchApplication(); + loginPinPage.waitUntilPageIsLoaded(); + loginPinPage.goToSettings(); + loginPinPage.scrambleKeypadLabel + .should("exist") + .and("contain", "Scramble keypad?"); + loginPinPage.stayUnlockedLabel + .should("exist") + .and("contain", "Stay unlocked?"); + }); + + it("Scramble Keypad will change the order of pin input buttons", () => { loginPinPage.launchApplication(); loginPinPage.waitUntilPageIsLoaded(); loginPinPage.goToSettings(); diff --git a/cypress/e2e/PageObjects/PreLoading.ts b/cypress/e2e/PageObjects/PreLoading.ts index 76b2167e..2cc7a6ef 100644 --- a/cypress/e2e/PageObjects/PreLoading.ts +++ b/cypress/e2e/PageObjects/PreLoading.ts @@ -1,6 +1,6 @@ class PreLoadingPage { get loadingHeader() { - return cy.get(".small"); + return cy.get(".small", { timeout: 30000 }); } get loadingMessage() {