-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
91 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,23 @@ | ||
import { chatsMainPage } from "./PageObjects/ChatsMain"; | ||
import { loginPinPage } from "./PageObjects/LoginPin"; | ||
import { preLoadingPage } from "./PageObjects/PreLoading"; | ||
|
||
describe("Pin Screen", () => { | ||
beforeEach(() => { | ||
loginPinPage.launchApplication(); | ||
}); | ||
|
||
it("Enter Pin Screen - Enter valid PIN", () => { | ||
cy.visit("/"); | ||
cy.getByTestAttr("pin-keypad", { timeout: 30000 }).should("exist"); | ||
cy.location("href").should("include", "/auth/unlock"); | ||
cy.getByTestAttr("button-pin-1").should("exist").click(); | ||
cy.getByTestAttr("button-pin-2").should("exist").click(); | ||
cy.getByTestAttr("button-pin-3").should("exist").click(); | ||
cy.getByTestAttr("button-pin-4").should("exist").click(); | ||
cy.getByTestAttr("button-confirm-pin").should("exist").click(); | ||
cy.getByTestAttr("button-confirm-pin").should("not.exist"); | ||
cy.location("href").should("include", "/pre"); | ||
cy.location("href").should("include", "/chat"); | ||
loginPinPage.waitUntilPageIsLoaded(); | ||
loginPinPage.enterPin("1234"); | ||
loginPinPage.clickConfirm(); | ||
preLoadingPage.validateURL(); | ||
chatsMainPage.validateURL(); | ||
}); | ||
|
||
it("Enter Pin Screen - Enter PIN with 3 digits", () => { | ||
cy.visit("/"); | ||
cy.location("href").should("include", "/auth/unlock"); | ||
cy.getByTestAttr("button-pin-1").should("exist").click(); | ||
cy.getByTestAttr("button-pin-2").should("exist").click(); | ||
cy.getByTestAttr("button-pin-3").should("exist").click(); | ||
cy.getByTestAttr("button-confirm-pin").should("exist").and("be.disabled"); | ||
loginPinPage.waitUntilPageIsLoaded(); | ||
loginPinPage.enterPin("123"); | ||
loginPinPage.validateConfirmButtonIsDisabled(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class ChatsMainPage { | ||
public validateURL() { | ||
cy.location("href").should("include", "/chat"); | ||
} | ||
} | ||
|
||
export const chatsMainPage: ChatsMainPage = new ChatsMainPage(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
class LoginPinPage { | ||
get pinButton0() { | ||
return cy.getByTestAttr("button-pin-0"); | ||
} | ||
get pinButton1() { | ||
return cy.getByTestAttr("button-pin-1"); | ||
} | ||
get pinButton2() { | ||
return cy.getByTestAttr("button-pin-2"); | ||
} | ||
get pinButton3() { | ||
return cy.getByTestAttr("button-pin-3"); | ||
} | ||
get pinButton4() { | ||
return cy.getByTestAttr("button-pin-4"); | ||
} | ||
get pinButton5() { | ||
return cy.getByTestAttr("button-pin-5"); | ||
} | ||
get pinButton6() { | ||
return cy.getByTestAttr("button-pin-6"); | ||
} | ||
get pinButton7() { | ||
return cy.getByTestAttr("button-pin-7"); | ||
} | ||
get pinButton8() { | ||
return cy.getByTestAttr("button-pin-8"); | ||
} | ||
get pinButton9() { | ||
return cy.getByTestAttr("button-pin-9"); | ||
} | ||
|
||
get pinButtonConfirm() { | ||
return cy.getByTestAttr("button-confirm-pin"); | ||
} | ||
|
||
public clickConfirm() { | ||
this.pinButtonConfirm.should("exist").click(); | ||
} | ||
|
||
public enterPin(pin: string) { | ||
pin.split("").forEach((digit) => { | ||
cy.getByTestAttr(`button-pin-${digit}`).should("exist").click(); | ||
}); | ||
} | ||
|
||
public launchApplication() { | ||
cy.visit("/"); | ||
} | ||
|
||
public validateConfirmButtonIsDisabled() { | ||
this.pinButtonConfirm.should("exist").and("be.disabled"); | ||
} | ||
|
||
public waitUntilPageIsLoaded() { | ||
cy.getByTestAttr("pin-keypad", { timeout: 30000 }).should("exist"); | ||
cy.location("href").should("include", "/auth/unlock"); | ||
} | ||
} | ||
|
||
export const loginPinPage: LoginPinPage = new LoginPinPage(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class PreLoadingPage { | ||
public validateURL() { | ||
cy.location("href").should("include", "/pre"); | ||
} | ||
} | ||
|
||
export const preLoadingPage: PreLoadingPage = new PreLoadingPage(); |