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-2749] [E2E][HomePage] MC Update available - Force Update #1964

Merged
merged 5 commits into from
Jul 25, 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
52 changes: 52 additions & 0 deletions apps/mudita-center-e2e/src/page-objects/modal-app-update.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* 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 ModalAppUpdate extends Page {
patrycja-paczkowska marked this conversation as resolved.
Show resolved Hide resolved
get modalHeader() {
return $('[data-testid="modal-title"]')
}

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

public get paragraphCurrentVersion() {
return $("p*=Update it to use")
}

public get paragraphPrivacyPolicy() {
return $(
"p*=Please accept the Privacy Policy to start updating Mudita Center."
patrycja-paczkowska marked this conversation as resolved.
Show resolved Hide resolved
)
}

public get linkPrivacyPolicy() {
return $("a=Privacy Policy")
}

public get checkboxPrivacyPolicy() {
return $('[data-testid="privacy-policy-checkbox"]')
}

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

public get paragraphUpdatingMuditaCenter() {
return $("h4*=Updating Mudita Center")
}

public get spinnerLoader() {
return $('[data-testid="loader-spinner"]')
}

public get paragraphPleaseWait() {
return $("p*=Please wait while Mudita Center is being updated.")
}
}

export default new ModalAppUpdate()
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
import { E2EMockClient } from "../../../../../libs/e2e-mock/client/src"
import modalAppUpdatePage from "../../page-objects/modal-app-update.page"
import ModalPage from "../../page-objects/modal.page"
import packageInfo from "../../../../mudita-center/package.json"

describe("Force 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: "999.0.0",
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)

// Header
const modalHeader = await modalAppUpdatePage.modalHeader
await expect(modalHeader).toBeDisplayed()
await expect(modalHeader).toHaveText("Mudita Center")

// Available version
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)

// Current version
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()

// Button: UPDATE
const buttonUpdate = await modalAppUpdatePage.buttonUpdate
await expect(buttonUpdate.isDisplayed())
await expect(buttonUpdate).not.toBeClickable()

// Close modal button
const modalCloseButton = await ModalPage.modalCloseButton
await expect(modalCloseButton).not.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 Updating Mudita Center 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 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 @@ -18,6 +18,7 @@ export enum TestFilesPaths {
privacyPolicyTest = "src/specs/settings/privacy-policy.e2e.ts",
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",
kompaktOverview = "src/specs/overview/kompakt-overview.ts",
}
export const toRelativePath = (path: string) => `./${path}`
4 changes: 3 additions & 1 deletion apps/mudita-center-e2e/wdio.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const config: Options.Testrunner = {
toRelativePath(TestFilesPaths.privacyPolicyTest),
toRelativePath(TestFilesPaths.licenseTest),
toRelativePath(TestFilesPaths.helpWindowCheckOfflineTest),
toRelativePath(TestFilesPaths.kompaktOverview),
toRelativePath(TestFilesPaths.mcHomePageForceUpdateTest),
],
suites: {
standalone: [
Expand All @@ -84,6 +84,7 @@ export const config: Options.Testrunner = {
toRelativePath(TestFilesPaths.helpWindowCheckOfflineTest),
],
mock: [
toRelativePath(TestFilesPaths.mcHomePageForceUpdateTest),
patrycja-paczkowska marked this conversation as resolved.
Show resolved Hide resolved
toRelativePath(TestFilesPaths.newsPageOfflineTest),
toRelativePath(TestFilesPaths.mcCheckForUpdatesOfflineTest),
toRelativePath(TestFilesPaths.e2eMockSample),
Expand Down Expand Up @@ -111,6 +112,7 @@ export const config: Options.Testrunner = {
toRelativePath(TestFilesPaths.privacyPolicyTest),
toRelativePath(TestFilesPaths.licenseTest),
toRelativePath(TestFilesPaths.helpWindowCheckOfflineTest),
toRelativePath(TestFilesPaths.mcHomePageForceUpdateTest),
toRelativePath(TestFilesPaths.kompaktOverview),
],
},
Expand Down
4 changes: 2 additions & 2 deletions libs/e2e-mock/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ To set the response indicating that an update is available and a Mudita Center u
```javascript
E2EMockClient.setMockUpdateState({ available: true, version: "4.0.0" })
E2EMockClient.mockHttpResponse({
url: '/v2-app-configuration',
url: 'v2-app-configuration',
method: 'GET',
status: 200,
data: {
Expand All @@ -113,7 +113,7 @@ To set the response indicating that an update is available and the application i
```javascript
E2EMockClient.setMockUpdateState({ available: true, version: "4.0.0" })
E2EMockClient.mockHttpResponse({
url: '/v2-app-configuration',
url: 'v2-app-configuration',
method: 'GET',
status: 200,
data: {
Expand Down
Loading