Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CP-2938 [E2E][HomePage] MC Update available - Soft update #2020

Merged
merged 6 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/

import Page from "./page"

class ModalAppUpdateLater extends Page {
get modalHeader() {
return $('[data-testid="modal-title"]')
}

get modalCloseButton() {
return $('[data-testid="close-modal-button"]')
}

get appUpdateFlowContainer() {
return $('[data-testid="app-update-flow-container"]')
}

get paragraphAvailableVersion() {
return $("h4*=Update Mudita Center to")
}

get paragraphUpdateLaterPrivacyPolicy() {
return $(
"p*=To be able to fully use the application, please agree to the Privacy Policy and update Mudita Center."
)
}

get buttonUpdateLater() {
return $('[data-testid="close-bottom-button"]')
}
get buttonUpdate() {
return $('[data-testid="modal-action-button"]')
}
}

export default new ModalAppUpdateLater()
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
import { E2EMockClient } from "../../../../../libs/e2e-mock/client/src"
import ModalAppUpdatePage from "../../page-objects/modal-app-update.page"
import ModalAppUpdateLaterPage from "../../page-objects/modal-app-update-later.page"
import ModalPage from "../../page-objects/modal.page"
import packageInfo from "../../../../mudita-center/package.json"
import { sleep } from "../../helpers/sleep.helper"
import HomePage from "../../page-objects/home.page"
import SettingsPage from "../../page-objects/settings.page"
import NavigationTabs from "../../page-objects/tabs.page"

describe("Soft Update MC - Successful 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,
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()
await modalCloseButton.click()
})
it("Check update later modal", async () => {
const modalHeader = await ModalAppUpdateLaterPage.modalHeader
await expect(modalHeader).toBeDisplayed()
await expect(modalHeader).toHaveText("Mudita Center")
const paragraphAvailableVersion =
await ModalAppUpdateLaterPage.paragraphAvailableVersion
await expect(paragraphAvailableVersion).toBeDisplayed()
await expect(paragraphAvailableVersion).toHaveTextContaining(
"Update Mudita Center to"
)
const paragraphUpdateLaterPrivacyPolicy =
await ModalAppUpdateLaterPage.paragraphUpdateLaterPrivacyPolicy
await expect(paragraphUpdateLaterPrivacyPolicy).toBeDisplayed()
await expect(paragraphUpdateLaterPrivacyPolicy).toHaveTextContaining(
"To be able to fully use the application, please agree to the Privacy Policy and update Mudita Center."
)

const buttonUpdateLater = await ModalAppUpdateLaterPage.buttonUpdateLater
await expect(buttonUpdateLater).toBeDisplayed()
await expect(buttonUpdateLater).toHaveText("UPDATE LATER")
await expect(buttonUpdateLater).toBeClickable()

const modalCloseButton = await ModalAppUpdateLaterPage.modalCloseButton
await expect(modalCloseButton).toBeDisplayed()
await modalCloseButton.click()

const homeHeader = await HomePage.homeHeader
await expect(homeHeader).toBeDisplayed()
await expect(homeHeader).toHaveText("Welcome to Mudita Center")
const notNowButton = await HomePage.notNowButton
await expect(notNowButton).toBeDisplayed()
await notNowButton.click()
})
it("Go back to Soft Update Modal.", async () => {
const settingsTab = await NavigationTabs.settingsTab
await settingsTab.waitForDisplayed()
await settingsTab.click()

const aboutTab = await SettingsPage.aboutTab
await aboutTab.waitForDisplayed()
await aboutTab.click()

const aboutCheckForUpdatesButton =
await SettingsPage.aboutCheckForUpdatesButton
await aboutCheckForUpdatesButton.waitForDisplayed()
await aboutCheckForUpdatesButton.click()
})

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("Soft Update the app", 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 paragraphUpdatingMuditaCenter =
await ModalAppUpdatePage.paragraphUpdatingMuditaCenter
await expect(paragraphUpdatingMuditaCenter).toBeDisplayed()
await expect(paragraphUpdatingMuditaCenter).toHaveText(
"Updating Mudita Center"
)

const spinnerLoader = await ModalAppUpdatePage.spinnerLoader
await expect(spinnerLoader).toBeDisplayed()
const spinnerColor = await spinnerLoader.getCSSProperty("color")
await expect(spinnerColor.value).toBe("rgba(109,155,188,1)")

const spinnerAnimation = await spinnerLoader.getCSSProperty("animation")
await expect(spinnerAnimation.value).toBe(
"chase 2.5s linear 0s infinite normal both running"
)

const paragraphPleaseWait = await ModalAppUpdatePage.paragraphPleaseWait
await expect(paragraphPleaseWait).toBeDisplayed()
await expect(paragraphPleaseWait).toHaveText(
"Please wait while Mudita Center is being updated."
)
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export enum TestFilesPaths {
licenseTest = "src/specs/settings/license.e2e.ts",
helpWindowCheckOfflineTest = "src/specs/help/help-window-check-offline.e2e.ts",
mcHomePageForceUpdateTest = "src/specs/overview/e2e-mock-mc-force-update-available.e2e.ts",
mcHomePageSoftUpdateTest = "src/specs/overview/e2e-mock-mc-soft-update-available.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 @@ -69,6 +69,7 @@ export const config: Options.Testrunner = {
toRelativePath(TestFilesPaths.kompaktOverview),
toRelativePath(TestFilesPaths.kompaktSwitchingDevices),
toRelativePath(TestFilesPaths.mcHomePageForceUpdateTest),
toRelativePath(TestFilesPaths.mcHomePageSoftUpdateTest),
toRelativePath(TestFilesPaths.kompaktAbout),
toRelativePath(TestFilesPaths.kompaktConnectedDevicesModalStressTest),
toRelativePath(TestFilesPaths.kompaktDrawerStressTest),
Expand All @@ -88,6 +89,7 @@ export const config: Options.Testrunner = {
toRelativePath(TestFilesPaths.mcCheckForUpdatesOfflineTest),
toRelativePath(TestFilesPaths.newsPageOfflineTest),
//toRelativePath(TestFilesPaths.helpWindowCheckOfflineTest),
toRelativePath(TestFilesPaths.mcHomePageSoftUpdateTest),
toRelativePath(TestFilesPaths.mcHomePageForceUpdateTest),
toRelativePath(TestFilesPaths.kompaktOverview),
toRelativePath(TestFilesPaths.kompaktSwitchingDevices),
Expand Down Expand Up @@ -118,6 +120,7 @@ export const config: Options.Testrunner = {
toRelativePath(TestFilesPaths.newsPageOfflineTest),
//toRelativePath(TestFilesPaths.helpWindowCheckOfflineTest),
toRelativePath(TestFilesPaths.mcHomePageForceUpdateTest),
toRelativePath(TestFilesPaths.mcHomePageSoftUpdateTest),
toRelativePath(TestFilesPaths.kompaktOverview),
toRelativePath(TestFilesPaths.kompaktSwitchingDevices),
toRelativePath(TestFilesPaths.kompaktAbout),
Expand Down
Loading