-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of github.com:mudita/mudita-center into CP-3097
- Loading branch information
Showing
51 changed files
with
1,449 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { E2EMockClient } from "../../../../libs/e2e-mock/client/src" | ||
|
||
// Helper function to mock PRE_BACKUP responses | ||
export function mockPreBackupResponses(path: string) { | ||
// Mock initial PRE_BACKUP response with status 202 (processing) | ||
E2EMockClient.mockResponse({ | ||
path, | ||
endpoint: "PRE_BACKUP", | ||
method: "POST", | ||
status: 202, | ||
body: {}, | ||
}) | ||
|
||
// After 10 seconds, update the response to status 200 (completed) | ||
// setTimeout(() => { | ||
// E2EMockClient.mockResponse({ | ||
// path, | ||
// endpoint: "PRE_BACKUP", | ||
// method: "POST", | ||
// status: 200, | ||
// body: { | ||
// backupId, | ||
// features: { | ||
// CONTACTS_V1: "path/to/backup/calls.json", | ||
// CALL_LOGS_V1: "path/to/backup/call_logs.json", | ||
// }, | ||
// }, | ||
// }) | ||
// }, 10000) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
apps/mudita-center-e2e/src/specs/overview/kompakt-prebackup-api.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
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" | ||
import { mockPreBackupResponses } from "../../helpers/mock-prebackup" | ||
|
||
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("Mock prebackup, wait for Overview Page and click Create Backup", async () => { | ||
mockPreBackupResponses("path-1") | ||
const createBackupButton = await ModalBackupKompaktPage.createBackupButton | ||
await expect(createBackupButton).toBeDisplayed() | ||
await expect(createBackupButton).toBeClickable() | ||
await createBackupButton.click() | ||
}) | ||
|
||
it("Click Create backup and click skip password to start backup", async () => { | ||
const createBackupProceedNext = | ||
await ModalBackupKompaktPage.createBackupProceedNext | ||
await expect(createBackupProceedNext).toBeClickable() | ||
await createBackupProceedNext.click() | ||
|
||
const createBackupPasswordSkip = | ||
await ModalBackupKompaktPage.createBackupPasswordSkip | ||
await createBackupPasswordSkip.click() | ||
}) | ||
|
||
it("Verify backup creating modal, check if backup is in progress", async () => { | ||
const backupInProgressModal = | ||
await ModalBackupKompaktPage.backupInProgressModal | ||
await expect(backupInProgressModal).toBeDisplayed() | ||
await expect(ModalBackupKompaktPage.creatingBackupTitle).toHaveText( | ||
"Creating backup" | ||
) | ||
await expect(ModalBackupKompaktPage.creatingBackupDescription).toHaveText( | ||
"Please wait and do not unplug your device from computer." | ||
) | ||
const creatingBackupProgressBar = | ||
await ModalBackupKompaktPage.creatingBackupProgressBar | ||
|
||
const creatingBackupProgressBarValue = | ||
await creatingBackupProgressBar.getAttribute("value") | ||
expect(creatingBackupProgressBarValue).toBe("10") | ||
|
||
const creatingBackupProgressBarDetails = | ||
await ModalBackupKompaktPage.creatingBackupProgressBarDetails | ||
await expect(creatingBackupProgressBarDetails).toHaveText("10%") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
libs/device/feature/src/lib/api-features/get-feature-data.request.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Copyright (c) Mudita sp. z o.o. All rights reserved. | ||
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md | ||
*/ | ||
|
||
import { ipcRenderer } from "electron-better-ipc" | ||
import { Feature } from "generic-view/models" | ||
import { APIFeaturesServiceEvents } from "device/models" | ||
import { ResultObject } from "Core/core/builder" | ||
import { DeviceId } from "Core/device/constants/device-id" | ||
|
||
export const getFeatureDataRequest = ( | ||
deviceId: DeviceId, | ||
feature: string | ||
): Promise<ResultObject<Feature["data"]>> => { | ||
return ipcRenderer.callMain(APIFeaturesServiceEvents.FeatureData, { | ||
deviceId, | ||
feature, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.