diff --git a/apps/mudita-center-e2e/src/page-objects/modal-backup-kompakt.page.ts b/apps/mudita-center-e2e/src/page-objects/modal-backup-kompakt.page.ts new file mode 100644 index 0000000000..de4baace23 --- /dev/null +++ b/apps/mudita-center-e2e/src/page-objects/modal-backup-kompakt.page.ts @@ -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() diff --git a/apps/mudita-center-e2e/src/specs/overview/kompakt-backup-getting-initial-info.ts b/apps/mudita-center-e2e/src/specs/overview/kompakt-backup-getting-initial-info.ts new file mode 100644 index 0000000000..f4ce089902 --- /dev/null +++ b/apps/mudita-center-e2e/src/specs/overview/kompakt-backup-getting-initial-info.ts @@ -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() + }) +}) diff --git a/apps/mudita-center-e2e/src/test-filenames/consts/test-filenames.const.ts b/apps/mudita-center-e2e/src/test-filenames/consts/test-filenames.const.ts index 05a5095550..116d2b4357 100644 --- a/apps/mudita-center-e2e/src/test-filenames/consts/test-filenames.const.ts +++ b/apps/mudita-center-e2e/src/test-filenames/consts/test-filenames.const.ts @@ -27,5 +27,6 @@ export enum TestFilesPaths { kompaktAbout = "src/specs/overview/kompakt-about.ts", kompaktConnectedDevicesModalStressTest = "src/specs/stress-tests/connected-devices-stress-test.ts", kompaktDrawerStressTest = "src/specs/stress-tests/device-drawer-stress-test.ts", + kompaktBackupModalGettingInitialInfo = "src/specs/overview/kompakt-backup-getting-initial-info.ts", } export const toRelativePath = (path: string) => `./${path}` diff --git a/apps/mudita-center-e2e/wdio.conf.ts b/apps/mudita-center-e2e/wdio.conf.ts index 1f5caa6115..bed55add4f 100644 --- a/apps/mudita-center-e2e/wdio.conf.ts +++ b/apps/mudita-center-e2e/wdio.conf.ts @@ -76,6 +76,7 @@ export const config: Options.Testrunner = { toRelativePath(TestFilesPaths.kompaktAbout), toRelativePath(TestFilesPaths.kompaktConnectedDevicesModalStressTest), toRelativePath(TestFilesPaths.kompaktDrawerStressTest), + toRelativePath(TestFilesPaths.kompaktBackupModalGettingInitialInfo), ], suites: { standalone: [ @@ -101,6 +102,7 @@ export const config: Options.Testrunner = { toRelativePath(TestFilesPaths.kompaktAbout), toRelativePath(TestFilesPaths.kompaktConnectedDevicesModalStressTest), toRelativePath(TestFilesPaths.kompaktDrawerStressTest), + toRelativePath(TestFilesPaths.kompaktBackupModalGettingInitialInfo), ], multidevicePureHarmony: [], multideviceSingleHarmony: [], @@ -133,6 +135,7 @@ export const config: Options.Testrunner = { toRelativePath(TestFilesPaths.kompaktAbout), toRelativePath(TestFilesPaths.kompaktConnectedDevicesModalStressTest), toRelativePath(TestFilesPaths.kompaktDrawerStressTest), + toRelativePath(TestFilesPaths.kompaktBackupModalGettingInitialInfo), ], }, // Patterns to exclude. diff --git a/libs/e2e-mock/responses/src/lib/default-responses.ts b/libs/e2e-mock/responses/src/lib/default-responses.ts index 743b979c64..e9b4fe9db8 100644 --- a/libs/e2e-mock/responses/src/lib/default-responses.ts +++ b/libs/e2e-mock/responses/src/lib/default-responses.ts @@ -179,9 +179,9 @@ export const DEFAULT_RESPONSES: MockResponsesMap = { ], restoreFeatures: [ { - label: "Contacts list", - feature: "CONTACTS_LIST", - keys: ["CONTACTS_LIST"], + label: "Contact list", + feature: "CONTACT_LIST", + keys: ["CONTACT_LIST"], }, { label: "Call log", feature: "CALL_LOG", keys: ["CALL_LOG"] }, { label: "Messages", feature: "MESSAGES", keys: ["MESSAGES"] }, diff --git a/libs/e2e-mock/responses/src/lib/overview-responses.ts b/libs/e2e-mock/responses/src/lib/overview-responses.ts index f9fb72dd07..a7edba2edc 100644 --- a/libs/e2e-mock/responses/src/lib/overview-responses.ts +++ b/libs/e2e-mock/responses/src/lib/overview-responses.ts @@ -172,3 +172,93 @@ export const overviewDataWithOneSimCard6th = { }, }, } +export const overviewConfigForBackup = { + title: "Overview", + summary: { + show: true, + showImg: true, + imgVariant: "black", + showSerialNumber: true, + serialNumberLabel: "Serial number", + showAbout: true, + aboutTitle: "About your device", + aboutIcon: "device", + aboutSubtitle: "Device details", + aboutFields: [ + { + dataKey: "serialNumber", + type: "detail-list-text", + title: "Serial number", + }, + { + dataKey: "imei1", + type: "detail-list-text", + title: "IMEI (sim slot 1)", + }, + { + dataKey: "imei2", + type: "detail-list-text", + title: "IMEI (sim slot 2)", + }, + { + dataKey: "sar", + type: "detail-list-modal", + title: "SAR", + buttonText: "Check SAR information", + }, + ], + }, + sections: [ + { + title: "Status", + type: "tile-list", + dataKey: "status", + fields: [ + { dataKey: "battery", type: "icon-text" }, + { dataKey: "airplane-mode", type: "icon-text" }, + ], + }, + { + dataKey: "update", + type: "mc-overview-update", + title: "Android OS", + currentVersionKey: "version", + showBadge: false, + versionLabel: "Current version:", + }, + { + dataKey: "backup", + type: "mc-overview-backup", + title: "Backup", + backupFeatures: [ + { label: "Contact list", key: "CONTACT_LIST" }, + { label: "Call log", key: "CALL_LOG" }, + ], + restoreFeatures: [ + { + label: "Contact list", + feature: "CONTACT_LIST", + keys: ["CONTACT_LIST"], + }, + { label: "Call log", feature: "CALL_LOG", keys: ["CALL_LOG"] }, + { label: "Messages", feature: "MESSAGES", keys: ["MESSAGES"] }, + { label: "Notes", feature: "NOTES", keys: ["NOTES"] }, + { + label: "Calendar events", + feature: "CALENDAR_EVENTS", + keys: ["CALENDAR_EVENTS"], + }, + { + label: "OS version & OS settings", + feature: "OS_VERSION_AND_SETTINGS", + keys: ["OS_VERSION_AND_SETTINGS"], + }, + { + label: "App settings: Phone, Messages", + feature: "APP_SETTINGS", + keys: ["APP_SETTINGS"], + }, + ], + }, + ], +}