-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CP-2930 [API Device][Kompakt] Backup - Getting Initial Information (O…
…verview Config Check) (#2069)
- Loading branch information
1 parent
d8a290c
commit 8421d55
Showing
6 changed files
with
383 additions
and
3 deletions.
There are no files selected for viewing
94 changes: 94 additions & 0 deletions
94
apps/mudita-center-e2e/src/page-objects/modal-backup-kompakt.page.ts
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,94 @@ | ||
/** | ||
* Copyright (c) Mudita sp. z o.o. All rights reserved. | ||
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md | ||
*/ | ||
|
||
import { OverviewPage } from "./overview.page" | ||
|
||
class ModalBackupKompaktPage extends OverviewPage { | ||
public get backupInfo() { | ||
return $('//div[@data-testid="block-box-backup"]//p') | ||
} | ||
public get createBackupButton() { | ||
return $('//button[@type="button" and .//span[text()="Create backup"]]') | ||
} | ||
public get createBackupProceedNext() { | ||
return $('[data-testid="backup-features-modal-create-action"]') | ||
} | ||
|
||
public get contactList() { | ||
return $$('[data-testid="backup-features-modal-element-active"]')[0] | ||
} | ||
public get callLog() { | ||
return $$('[data-testid="backup-features-modal-element-active"]')[1] | ||
} | ||
public get backupModalTitle() { | ||
return $('[data-testid="backup-features-modal-title"]') | ||
} | ||
public get backupModalDescription() { | ||
return $('[data-testid="backup-features-modal-description"]') | ||
} | ||
public get backupModalCancel() { | ||
return $('[data-testid="backup-features-modal-cancel-action"]') | ||
} | ||
|
||
public get backupModalClose() { | ||
return $('[data-testid="modal-close-button-icon-button"]') | ||
} | ||
|
||
public get createBackupPasswordModalTitle() { | ||
return $('[data-testid="predefined-backup-password-title"]') | ||
} | ||
|
||
public get createBackupPasswordOptionalText() { | ||
return $('[data-testid="predefined-backup-password-title"] span') | ||
} | ||
public get createBackupPasswordModalDescription() { | ||
return $('[data-testid="predefined-backup-password-description"]') | ||
} | ||
|
||
public get createBackupPasswordModalDescriptionMore() { | ||
return $('[data-testid="predefined-backup-password-description"] span') | ||
} | ||
|
||
public get createBackupPasswordPlaceholder() { | ||
return $('[data-testid="predefined-backup-password-placeholder"]') | ||
} | ||
|
||
public get createBackupPasswordRepeatPlaceholder() { | ||
return $('[data-testid="predefined-backup-password-repeat-placeholder"]') | ||
} | ||
|
||
public get createBackupPasswordConfirm() { | ||
return $('[data-testid="predefined-backup-password-confirm-button"]') | ||
} | ||
|
||
public get createBackupPasswordSkip() { | ||
return $('[data-testid="predefined-backup-password-skip-button"]') | ||
} | ||
|
||
public get createBackupPasswordClose() { | ||
return $('[data-testid="modal-close-button-icon-button"]') | ||
} | ||
|
||
public get inputPassword() { | ||
return $$('[data-testid="interactive-text-input-input"]')[0] | ||
} | ||
|
||
public get repeatInputPassword() { | ||
return $$('[data-testid="interactive-text-input-input"]')[1] | ||
} | ||
|
||
public get unhidePasswordIcon() { | ||
return $('[data-testid="icon-password-hide"]') | ||
} | ||
|
||
public get hidePasswordIcon() { | ||
return $('[data-testid="icon-password-show"]') | ||
} | ||
|
||
public get passwordsDoNotMatch() { | ||
return $('[data-testid="interactive-text-input-error-text"]') | ||
} | ||
} | ||
export default new ModalBackupKompaktPage() |
192 changes: 192 additions & 0 deletions
192
apps/mudita-center-e2e/src/specs/overview/kompakt-backup-getting-initial-info.ts
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,192 @@ | ||
import { E2EMockClient } from "../../../../../libs/e2e-mock/client/src" | ||
import { | ||
overviewConfigForBackup, | ||
overviewDataWithOneSimCard, | ||
} from "../../../../../libs/e2e-mock/responses/src" | ||
import ModalBackupKompaktPage from "../../page-objects/modal-backup-kompakt.page" | ||
|
||
describe("E2E mock sample - overview view", () => { | ||
before(async () => { | ||
E2EMockClient.connect() | ||
//wait for a connection to be established | ||
await browser.waitUntil(() => { | ||
return E2EMockClient.checkConnection() | ||
}) | ||
}) | ||
|
||
after(() => { | ||
E2EMockClient.stopServer() | ||
E2EMockClient.disconnect() | ||
}) | ||
|
||
it("Connect device", async () => { | ||
E2EMockClient.mockResponse({ | ||
path: "path-1", | ||
body: overviewConfigForBackup, | ||
endpoint: "FEATURE_CONFIGURATION", | ||
method: "GET", | ||
status: 200, | ||
}) | ||
E2EMockClient.mockResponse({ | ||
path: "path-1", | ||
body: overviewDataWithOneSimCard, | ||
endpoint: "FEATURE_DATA", | ||
method: "GET", | ||
status: 200, | ||
}) | ||
E2EMockClient.addDevice({ | ||
path: "path-1", | ||
serialNumber: "first-serial-number", | ||
}) | ||
|
||
await browser.pause(6000) | ||
const menuItem = await $(`//a[@href="#/generic/mc-overview"]`) | ||
|
||
await menuItem.waitForDisplayed({ timeout: 10000 }) | ||
await expect(menuItem).toBeDisplayed() | ||
}) | ||
|
||
it("Wait for Overview Page and click Create Backup", async () => { | ||
const createBackupButton = await ModalBackupKompaktPage.createBackupButton | ||
await expect(createBackupButton).toBeDisplayed() | ||
await expect(createBackupButton).toBeClickable() | ||
await createBackupButton.click() | ||
}) | ||
|
||
it("Verify modal in scope of available backup options, verify text and buttons", async () => { | ||
const contactList = await ModalBackupKompaktPage.contactList | ||
await expect(contactList).toBeDisplayed() | ||
const contactListText = await contactList?.getProperty("textContent") | ||
expect(contactListText).toContain("Contact list") | ||
expect(contactListText).not.toContain("Coming soon!") | ||
|
||
const callLog = await ModalBackupKompaktPage.callLog | ||
await expect(callLog).toBeDisplayed() | ||
const callLogText = await callLog?.getProperty("textContent") | ||
expect(callLogText).toContain("Call log") | ||
expect(callLogText).not.toContain("Coming soon!") | ||
|
||
const backupModalTitle = ModalBackupKompaktPage.backupModalTitle | ||
await expect(backupModalTitle).toBeDisplayed() | ||
await expect(backupModalTitle).toHaveText("Create backup") | ||
|
||
const backupModalDescription = ModalBackupKompaktPage.backupModalDescription | ||
await expect(backupModalDescription).toBeDisplayed() | ||
await expect(backupModalDescription).toHaveText( | ||
"All backup data stays on your computer." | ||
) | ||
|
||
const backupModalCancel = ModalBackupKompaktPage.backupModalCancel | ||
await expect(backupModalCancel).toBeClickable() | ||
|
||
const backupModalClose = ModalBackupKompaktPage.backupModalClose | ||
await expect(backupModalClose).toBeClickable() | ||
}) | ||
|
||
it("Click Create backup - verify modal about create password for backup", async () => { | ||
const createBackupProceedNext = | ||
await ModalBackupKompaktPage.createBackupProceedNext | ||
await expect(createBackupProceedNext).toBeClickable() | ||
await createBackupProceedNext.click() | ||
|
||
const createBackupPasswordModalTitle = | ||
ModalBackupKompaktPage.createBackupPasswordModalTitle | ||
await expect(createBackupPasswordModalTitle).toHaveTextContaining( | ||
"Create password for backup" | ||
) | ||
|
||
const createBackupPasswordOptionalText = | ||
ModalBackupKompaktPage.createBackupPasswordOptionalText | ||
await expect(createBackupPasswordOptionalText).toHaveText("(optional)") | ||
|
||
const createBackupPasswordModalDescription = | ||
ModalBackupKompaktPage.createBackupPasswordModalDescription | ||
await expect(createBackupPasswordModalDescription).toHaveTextContaining( | ||
"You can protect backup with a new password." | ||
) | ||
|
||
const createBackupPasswordModalDescriptionMore = | ||
ModalBackupKompaktPage.createBackupPasswordModalDescriptionMore | ||
await expect(createBackupPasswordModalDescriptionMore).toHaveText( | ||
"* You can't change/recover the password later." | ||
) | ||
|
||
const createBackupPasswordPlaceholder = | ||
ModalBackupKompaktPage.createBackupPasswordPlaceholder | ||
await expect(createBackupPasswordPlaceholder).toBeClickable() | ||
|
||
const createBackupPasswordRepeatPlaceholder = | ||
ModalBackupKompaktPage.createBackupPasswordRepeatPlaceholder | ||
await expect(createBackupPasswordRepeatPlaceholder).toBeClickable() | ||
|
||
const createBackupPasswordConfirm = | ||
ModalBackupKompaktPage.createBackupPasswordConfirm | ||
await expect(createBackupPasswordConfirm).not.toBeClickable() | ||
|
||
const createBackupPasswordSkip = | ||
ModalBackupKompaktPage.createBackupPasswordSkip | ||
await expect(createBackupPasswordSkip).toBeClickable() | ||
|
||
const createBackupPasswordClose = | ||
ModalBackupKompaktPage.createBackupPasswordClose | ||
await expect(createBackupPasswordClose).toBeClickable() | ||
}) | ||
|
||
it("Fill password for a backup, unhide it and verify value and design", async () => { | ||
const inputPassword = ModalBackupKompaktPage.inputPassword | ||
await inputPassword.click() | ||
const randomPassword = Math.random().toString(36).substring(2, 10) | ||
await inputPassword.setValue(randomPassword) | ||
|
||
const checkPassword = await inputPassword.getAttribute("type") | ||
await expect(checkPassword).toBe("password") | ||
|
||
const unhidePasswordIcon = ModalBackupKompaktPage.unhidePasswordIcon | ||
await unhidePasswordIcon.click() | ||
|
||
//Verify design, and it's value to check if user can hide password if it was displayed | ||
const hidePasswordIcon = ModalBackupKompaktPage.hidePasswordIcon | ||
await expect(hidePasswordIcon).toBeClickable() | ||
}) | ||
|
||
it("Fill repeat password for a backup, unhide it and verify value and design, verify (passwords do not match)", async () => { | ||
const repeatInputPassword = ModalBackupKompaktPage.repeatInputPassword | ||
await repeatInputPassword.click() | ||
const randomPassword2 = Math.random().toString(36).substring(2, 10) | ||
await repeatInputPassword.setValue(randomPassword2) | ||
|
||
const checkPassword = await repeatInputPassword.getAttribute("type") | ||
await expect(checkPassword).toBe("password") | ||
|
||
const unhidePasswordIcon = ModalBackupKompaktPage.unhidePasswordIcon | ||
await unhidePasswordIcon.click() | ||
|
||
//Verify design and it's value to check if user can hide password if it was displayed | ||
const hidePasswordIcon = ModalBackupKompaktPage.hidePasswordIcon | ||
await expect(hidePasswordIcon).toBeClickable() | ||
|
||
const passwordsDoNotMatch = ModalBackupKompaktPage.passwordsDoNotMatch | ||
await expect(passwordsDoNotMatch).toHaveText("Passwords do not match") | ||
}) | ||
|
||
it("Fill repeat password with first filed password and verify if passwords do not match is gone", async () => { | ||
const inputPassword = ModalBackupKompaktPage.inputPassword | ||
const repeatInputPassword = ModalBackupKompaktPage.repeatInputPassword | ||
const randomPassword = Math.random().toString(36).substring(2, 10) | ||
await inputPassword.click() | ||
await inputPassword.clearValue() | ||
await inputPassword.setValue(randomPassword) | ||
|
||
await repeatInputPassword.click() | ||
await repeatInputPassword.clearValue() | ||
await repeatInputPassword.setValue(randomPassword) | ||
|
||
const passwordsDoNotMatch = ModalBackupKompaktPage.passwordsDoNotMatch | ||
await expect(passwordsDoNotMatch).not.toBeDisplayed() | ||
|
||
const createBackupPasswordConfirm = | ||
ModalBackupKompaktPage.createBackupPasswordConfirm | ||
await expect(createBackupPasswordConfirm).toBeClickable() | ||
await createBackupPasswordConfirm.click() | ||
}) | ||
}) |
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
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
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
Oops, something went wrong.