Skip to content

Commit

Permalink
[E2E][Home Page] MC Soft Update - Error handling (#2041)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrycja-paczkowska authored Aug 26, 2024
1 parent 6e0eb2c commit 57e0139
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
import { E2EMockClient } from "../../../../../libs/e2e-mock/client/src"
import ModalAppUpdatePage from "../../page-objects/modal-app-update.page"
import modalAppUpdateErrorPage from "../../page-objects/modal-app-update-error.page"
import ModalPage from "../../page-objects/modal.page"
import packageInfo from "../../../../mudita-center/package.json"

describe("Soft Update MC - Unsuccessful Download", () => {
const newestAvailableVersion = "9.9.9"

before(async function () {
E2EMockClient.connect()
//wait for a connection to be established
await browser.waitUntil(() => {
return E2EMockClient.checkConnection()
})

E2EMockClient.setMockUpdateState({
available: true,
downloaded: false,
version: newestAvailableVersion,
})

E2EMockClient.mockHttpResponse({
url: "v2-app-configuration",
method: "GET",
status: 200,
data: {
centerVersion: "0.0.1",
productVersions: {
MuditaHarmony: "1.0.0",
MuditaPure: "1.0.0",
APIDevice: "1.0.0",
},
},
})
})

it("Check update modal sections ", async () => {
console.log("PACKAGE INFO VERSION:" + packageInfo.version)

const modalHeader = await ModalAppUpdatePage.modalHeader
await expect(modalHeader).toBeDisplayed()
await expect(modalHeader).toHaveText("Mudita Center")

const paragraphAvailableVersion =
await ModalAppUpdatePage.paragraphAvailableVersion
await expect(paragraphAvailableVersion).toBeDisplayed()
await expect(paragraphAvailableVersion).toHaveTextContaining(
"Update Mudita Center to"
)
const textParagraphAvailableVersion =
await paragraphAvailableVersion.getText()
const availableAppVersion = textParagraphAvailableVersion.split("to ").pop()
console.log("AVAILABLE VERSION:" + availableAppVersion)
await expect(availableAppVersion).toBe(newestAvailableVersion)

const paragraphCurrentVersion =
await ModalAppUpdatePage.paragraphCurrentVersion
await expect(paragraphCurrentVersion).toBeDisplayed()
await expect(paragraphCurrentVersion).toHaveTextContaining(
"Update it to use the full version of the Mudita Center. Your current version:"
)
const textParagraphCurrentVersion = await paragraphCurrentVersion.getText()
const currentAppVersion = textParagraphCurrentVersion.split(": ").pop()
console.log("CURRENT VERSION:" + currentAppVersion)

// Privacy policy
const paragraphPrivacyPolicy =
await ModalAppUpdatePage.paragraphPrivacyPolicy
await expect(paragraphPrivacyPolicy).toBeDisplayed()
await expect(paragraphPrivacyPolicy).toHaveText(
"Please accept the Privacy Policy to start updating Mudita Center."
)

const linkPrivacyPolicy = await ModalAppUpdatePage.linkPrivacyPolicy
await expect(linkPrivacyPolicy).toBeDisplayed()
await expect(linkPrivacyPolicy).toHaveText("Privacy Policy")

const linkColor = await linkPrivacyPolicy.getCSSProperty("color")
await expect(linkColor.value).toBe("rgba(109,155,188,1)")
const linkDecoration = await linkPrivacyPolicy.getCSSProperty(
"text-decoration"
)
await expect(linkDecoration.value).toBe(
"underline solid rgb(109, 155, 188)"
)

const checkboxPrivacyPolicy = await ModalAppUpdatePage.checkboxPrivacyPolicy
await expect(checkboxPrivacyPolicy).toBeDisplayed()
await expect(checkboxPrivacyPolicy).not.toBeChecked()

const buttonUpdate = await ModalAppUpdatePage.buttonUpdate
await expect(buttonUpdate.isDisplayed())
await expect(buttonUpdate).not.toBeClickable()

const modalCloseButton = await ModalPage.modalCloseButton
await expect(modalCloseButton).toBeDisplayed()
})

it("Button UPDATE is clickable after selecting the checkbox", async () => {
const checkboxPrivacyPolicy = await ModalAppUpdatePage.checkboxPrivacyPolicy
await expect(checkboxPrivacyPolicy).toBeDisplayed()

const buttonUpdate = await ModalAppUpdatePage.buttonUpdate
await expect(buttonUpdate).toBeDisplayed()
await expect(buttonUpdate).not.toBeClickable()

await checkboxPrivacyPolicy.click()
await expect(checkboxPrivacyPolicy).toBeChecked()

await expect(buttonUpdate).toBeClickable()
})

it("Check Error modal", async () => {
const buttonUpdate = await ModalAppUpdatePage.buttonUpdate
await expect(buttonUpdate).toBeDisplayed()
await buttonUpdate.click()

const modalHeader = await ModalAppUpdatePage.modalHeader
await expect(modalHeader).toBeDisplayed()
await expect(modalHeader).toHaveText("Mudita Center")

const infoIcon = await modalAppUpdateErrorPage.infoIcon
await expect(infoIcon).toBeDisplayed()
const infoIconSize = await infoIcon.getSize()
await expect(infoIconSize.width).toBe(48)
await expect(infoIconSize.height).toBe(48)

const errorLabel = await modalAppUpdateErrorPage.errorLabel
await expect(errorLabel).toBeDisplayed()
await expect(errorLabel).toHaveText("Error")

const paragraphPleaseRestart =
await modalAppUpdateErrorPage.pleaseRestartParagraph
await expect(paragraphPleaseRestart).toBeDisplayed()
await expect(paragraphPleaseRestart).toHaveText(
"Please restart the app or update it manually."
)

const buttonClose = await modalAppUpdateErrorPage.closeButton
await expect(buttonClose).toBeDisplayed()
await expect(buttonClose).toHaveText("CLOSE")
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export enum TestFilesPaths {
mcHomePageForceUpdateTest = "src/specs/overview/e2e-mock-mc-force-update-available.e2e.ts",
mcHomePageForceUpdateErrorTest = "src/specs/overview/e2e-mock-mc-force-update-error.e2e.ts",
mcHomePageSoftUpdateTest = "src/specs/overview/e2e-mock-mc-soft-update-available.e2e.ts",
mcHomePageSoftUpdateErrorTest = "src/specs/overview/e2e-mock-mc-soft-update-error.e2e.ts",
kompaktOverview = "src/specs/overview/kompakt-overview.ts",
kompaktSwitchingDevices = "src/specs/overview/kompakt-switching-devices.ts",
kompaktAbout = "src/specs/overview/kompakt-about.ts",
Expand Down
3 changes: 3 additions & 0 deletions apps/mudita-center-e2e/wdio.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export const config: Options.Testrunner = {
toRelativePath(TestFilesPaths.mcHomePageForceUpdateTest),
toRelativePath(TestFilesPaths.mcHomePageForceUpdateErrorTest),
toRelativePath(TestFilesPaths.mcHomePageSoftUpdateTest),
toRelativePath(TestFilesPaths.mcHomePageSoftUpdateErrorTest),
toRelativePath(TestFilesPaths.kompaktAbout),
toRelativePath(TestFilesPaths.kompaktConnectedDevicesModalStressTest),
toRelativePath(TestFilesPaths.kompaktDrawerStressTest),
Expand All @@ -91,6 +92,7 @@ export const config: Options.Testrunner = {
toRelativePath(TestFilesPaths.newsPageOfflineTest),
//toRelativePath(TestFilesPaths.helpWindowCheckOfflineTest),
toRelativePath(TestFilesPaths.mcHomePageSoftUpdateTest),
toRelativePath(TestFilesPaths.mcHomePageSoftUpdateErrorTest),
toRelativePath(TestFilesPaths.mcHomePageForceUpdateTest),
toRelativePath(TestFilesPaths.mcHomePageForceUpdateErrorTest),
toRelativePath(TestFilesPaths.kompaktOverview),
Expand Down Expand Up @@ -124,6 +126,7 @@ export const config: Options.Testrunner = {
toRelativePath(TestFilesPaths.mcHomePageForceUpdateTest),
toRelativePath(TestFilesPaths.mcHomePageForceUpdateErrorTest),
toRelativePath(TestFilesPaths.mcHomePageSoftUpdateTest),
toRelativePath(TestFilesPaths.mcHomePageSoftUpdateErrorTest),
toRelativePath(TestFilesPaths.kompaktOverview),
toRelativePath(TestFilesPaths.kompaktSwitchingDevices),
toRelativePath(TestFilesPaths.kompaktAbout),
Expand Down

0 comments on commit 57e0139

Please sign in to comment.