Skip to content

Commit

Permalink
Merge branch 'develop' into CP-3012
Browse files Browse the repository at this point in the history
  • Loading branch information
mkurczewski authored Aug 14, 2024
2 parents d592a88 + 469c28e commit 3d83542
Show file tree
Hide file tree
Showing 44 changed files with 788 additions and 843 deletions.
15 changes: 0 additions & 15 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,6 @@ FEATURE_TOGGLE_RELEASE_ENVIRONMENT=
# [Optional] Enable Mudita Center prerelease feature. Disabled by default, set "1" to enable
MUDITA_CENTER_PRERELEASE_ENABLED=

# [Optional] Path to your Google service account key file. Required for authentication with the Google Sheets API.
MATOMO_TO_GSHEET_KEYFILEPATH=

# [Optional] The ID of the Google Sheet where Matomo data will be written. Found in the URL of your Google Sheet.
MATOMO_TO_GSHEET_SPREADSHEET_ID=

# [Optional] The base URL for the Matomo API. This is where API requests will be sent to fetch analytics data.
MATOMO_TO_GSHEET_API_URL=

# [Optional] Your Matomo API token. Required for accessing data from your Matomo account through the API.
MATOMO_TO_GSHEET_TOKEN=

# [Optional] The site ID for your website as registered in Matomo. Used to specify which site's data to fetch.
MATOMO_TO_GSHEET_SITE_ID=

# [Optional] Set 1 run application with mock server
MOCK_SERVICE_ENABLED=

Expand Down
1 change: 1 addition & 0 deletions apps/mudita-center-e2e/src/consts/regex-const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export const kompaktImageRegex: RegExp = /(^data:image\/png;base64)/
export const newsDateRegex: RegExp =
/^(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)(\s{1})([1-9]|[12][0-9]|3[01])(,{1})(\s{1})([2-9][0-9][0-9][0-9])$/
export const commentsRegex: RegExp = /^(\d+)(\s{1})(COMMENTS|COMMENT)$/
export const kompaktImeiRegex: RegExp = /^[0-9]{1,15}$/
1 change: 1 addition & 0 deletions apps/mudita-center-e2e/src/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
*/

export * from "./sleep.helper"
export * from "./add-device.helper"
61 changes: 61 additions & 0 deletions apps/mudita-center-e2e/src/page-objects/about-kompakt.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/**
* 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 AboutKompaktPage extends Page {
public get aboutHeader() {
return $("h3*=About your device")
}

public get aboutSubtitle() {
return $("p*=Device details")
}

public get backToOverviewIcon() {
return $('[data-testid="icon-ArrowLongLeft"]')
}

public get backToOverviewLabel() {
return $('[data-testid="location"]')
}

public get serialNumberLabel() {
return $('[data-testid="about-data-box-label-serial-number"]')
}

public get serialNumberValue() {
return $('[data-testid="about-data-box-value-serial-number"]')
}

public get imei1Label() {
return $('[data-testid="about-data-box-label-imei-(sim-slot-1)"]')
}

public get imei1Value() {
return $('[data-testid="about-data-box-value-imei-(sim-slot-1)"]')
}

public get imei2Label() {
return $('[data-testid="about-data-box-label-imei-(sim-slot-2)"]')
}

public get imei2Value() {
return $('[data-testid="about-data-box-value-imei-(sim-slot-2)"]')
}

public get sarLabel() {
return $('[data-testid="about-data-box-label-sar"]')
}

public get sarButton() {
return $('[data-testid="button-text_sarmodal-button"]')
}

public get sarHeader() {
return $("h3*=SAR")
}
}
export default new AboutKompaktPage()
34 changes: 34 additions & 0 deletions apps/mudita-center-e2e/src/page-objects/menu.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* 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"

export class Menu extends Page {
public get newsLink() {
return $(`//a[@href="#/news"]`)
}

public get kompaktLabel() {
return $('[data-testid="Kompakt"]')
}

public get overviewLink() {
return $(`//a[@href="#/generic/mc-overview"]`)
}

public get muditaCenterLabel() {
return $('[data-testid="component.menuHeaderDesktopApp"]')
}

public get settingsLink() {
return $(`//a[@href="#/settings"]`)
}

public get helpLink() {
return $(`//a[@href="#/help"]`)
}
}

export default new Menu()
17 changes: 17 additions & 0 deletions apps/mudita-center-e2e/src/page-objects/modal-sar.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* 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 AboutKompaktPage extends Page {
public get sarHeader() {
return $("h3*=SAR")
}

public get modalCloseButton() {
return $('[data-testid="icon-close"]')
}
}
export default new AboutKompaktPage()
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
import { OverviewPage } from "./overview.page"

class OverviewKompaktPage extends OverviewPage {
public get header() {
return $('[data-testid="location"]')
}

public get aboutYourDevice() {
return $('[data-testid="button-text_summary-about"]')
}
Expand Down
29 changes: 29 additions & 0 deletions apps/mudita-center-e2e/src/page-objects/select-device.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/

import { index } from "@orama/orama/dist/components"
import Page from "./page"

class SelectDevicePage extends Page {
public get devicesList() {
return $("[data-testid='devices-list']")
}
public get availableDevices() {
return $$('[data-testid="available-device"]')
}
public get selectDeviceSerialNumber() {
return $$('[data-testid="available-device-serial-number"]')
}
public get selectDeviceName() {
return $$('[data-testid="available-device-name"]')
}
public get selectADeviceToContinueTitle() {
return $("h1*=Select a device to continue")
}
public getDeviceOnSelectModal(index: number) {
return $(`(//p[@data-testid="available-device-serial-number"])[${index}]`)
}
}
export default new SelectDevicePage()
48 changes: 48 additions & 0 deletions apps/mudita-center-e2e/src/specs/overview/e2e-mock-sample.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,54 @@ describe("E2E mock sample - overview view", () => {
await expect(drawerHeader).toBeDisplayed()
})

it("Add third device", async () => {
E2EMockClient.addDevice({
path: "path-3",
serialNumber: "third-serial-number",
})
await browser.pause(6000)

const drawerHeader = $(`//*[text()='Select a device']`)
await drawerHeader.waitForDisplayed()
await expect(drawerHeader).toBeDisplayed()
})

it("Add fourth device", async () => {
E2EMockClient.addDevice({
path: "path-4",
serialNumber: "fourth-serial-number",
})
await browser.pause(6000)

const drawerHeader = $(`//*[text()='Select a device']`)
await drawerHeader.waitForDisplayed()
await expect(drawerHeader).toBeDisplayed()
})

it("Add fifth device", async () => {
E2EMockClient.addDevice({
path: "path-5",
serialNumber: "fifth-serial-number",
})
await browser.pause(6000)

const drawerHeader = $(`//*[text()='Select a device']`)
await drawerHeader.waitForDisplayed()
await expect(drawerHeader).toBeDisplayed()
})

it("Add sixth device", async () => {
E2EMockClient.addDevice({
path: "path-6",
serialNumber: "sixth-serial-number",
})
await browser.pause(6000)

const drawerHeader = $(`//*[text()='Select a device']`)
await drawerHeader.waitForDisplayed()
await expect(drawerHeader).toBeDisplayed()
})

it("Remove first device", async () => {
E2EMockClient.removeDevice("path-1")
await browser.pause(6000)
Expand Down
128 changes: 128 additions & 0 deletions apps/mudita-center-e2e/src/specs/overview/kompakt-about.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
import { E2EMockClient } from "../../../../../libs/e2e-mock/client/src"
import { overviewDataWithOneSimCard } from "../../../../../libs/e2e-mock/responses/src"
import homePage from "../../page-objects/home.page"
import menu from "../../page-objects/menu.page"
import overviewKompaktPage from "../../page-objects/overview-kompakt.page"
import aboutKompaktPage from "../../page-objects/about-kompakt.page"
import modalSarPage from "../../page-objects/modal-sar.page"
import { kompaktImeiRegex } from "../../consts/regex-const"

describe("Checking About your Kompakt", () => {
before(async () => {
E2EMockClient.connect()
//wait for a connection to be established
await browser.waitUntil(() => {
return E2EMockClient.checkConnection()
})
})

it("Connect device", async () => {
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 menuOverviewLink = await menu.overviewLink
await menuOverviewLink.waitForDisplayed({ timeout: 10000 })
await expect(menuOverviewLink).toBeDisplayed()
})

it("Check SN", async () => {
const serialNumberValue = await overviewKompaktPage.serialNumberValue
await expect(serialNumberValue).toHaveText(
overviewDataWithOneSimCard.summary.about.serialNumber.text
)
})

it("Go to ABOUT YOUR DEVICE", async () => {
const aboutYourDevice = await overviewKompaktPage.aboutYourDevice
await aboutYourDevice.waitForClickable()
await aboutYourDevice.click()

// Header
const aboutHeader = await aboutKompaktPage.aboutHeader
await expect(aboutHeader).toBeDisplayed()
await expect(aboutHeader).toHaveText("About your device")
})

it("Verify About Your Device page", async () => {
// Subtitle
const aboutSubtitle = await aboutKompaktPage.aboutSubtitle
await expect(aboutSubtitle).toHaveText("Device details")
// SN
const serialNumberLabel = await aboutKompaktPage.serialNumberLabel
await expect(serialNumberLabel).toHaveText("Serial number")
const serialNumberValue = await aboutKompaktPage.serialNumberValue
await expect(serialNumberValue).toHaveText(
overviewDataWithOneSimCard.summary.about.serialNumber.text
)
// IMEI 1
const imei1Label = await aboutKompaktPage.imei1Label
await expect(imei1Label).toHaveText("IMEI (sim slot 1)")
const imei1Value = await aboutKompaktPage.imei1Value
const imei1 = await imei1Value.getText()
await expect(imei1Value).toHaveText(kompaktImeiRegex)
// IMEI 2
const imei2Label = await aboutKompaktPage.imei2Label
await expect(imei2Label).toHaveText("IMEI (sim slot 2)")
const imei2Value = await aboutKompaktPage.imei2Value
const imei2 = await imei2Value.getText()
await expect(imei2Value).toHaveText(kompaktImeiRegex)
//SAR
const sarLabel = await aboutKompaktPage.sarLabel
await expect(sarLabel).toHaveText("SAR")
const sarButton = await aboutKompaktPage.sarButton
await expect(sarButton).toHaveText("Check SAR information")
await expect(sarButton).toBeClickable()
})

it("Go to SAR information", async () => {
const sarButton = await aboutKompaktPage.sarButton
await sarButton.waitForClickable()
await sarButton.click()
const sarHeader = await aboutKompaktPage.sarHeader
await expect(sarHeader).toHaveText("SAR")
// TBD: SAR content + scroll
})

it("Close SAR information", async () => {
const modalCloseButton = await modalSarPage.modalCloseButton
await expect(modalCloseButton).toBeDisplayed()
await modalCloseButton.click()
})

it("Go to Overview", async () => {
const backToOverviewIcon = await aboutKompaktPage.backToOverviewIcon
await backToOverviewIcon.isDisplayed()

const backToOverviewLabel = await aboutKompaktPage.backToOverviewLabel
await backToOverviewLabel.isDisplayed()
backToOverviewLabel.click()

const header = await overviewKompaktPage.header
await header.isDisplayed()

const menuOverviewLink = await menu.overviewLink
await expect(menuOverviewLink).not.toBeClickable()
})

it("Disconnect the device and check if Welcome screen is present", async () => {
E2EMockClient.removeDevice("path-1")
const homeHeader = await homePage.homeHeader
await expect(homeHeader).toBeDisplayed()
})

after(() => {
E2EMockClient.stopServer()
E2EMockClient.disconnect()
})
})
Loading

0 comments on commit 3d83542

Please sign in to comment.