mirror of
https://github.com/mudita/mudita-center.git
synced 2025-12-23 22:28:03 -05:00
[CP-3826] [API Device][Kompakt] Restore failed - check modal (#2609)
This commit is contained in:
@@ -118,8 +118,45 @@ class OverviewKompaktPage extends OverviewPage {
|
||||
return $("//*[@data-testid='primary-button-cancel-restore']")
|
||||
}
|
||||
|
||||
public get kompaktRestoreModalCloseFailedButton() {
|
||||
return $("//*[@data-testid='primary-button-close-restore-modal']")
|
||||
}
|
||||
|
||||
public get restoringFailedHeader() {
|
||||
return $("//h1[text()='Restore failed']")
|
||||
}
|
||||
|
||||
public get restoringFailedDescription() {
|
||||
return $("//p[contains(text(), 'The restore process was interrupted.')]")
|
||||
}
|
||||
|
||||
public get kompaktRestoreModalConfirm() {
|
||||
return $("//*[@data-testid='primary-button-confirm-restore']")
|
||||
}
|
||||
|
||||
public async getLatestBackupLabel() {
|
||||
const labels = await $$("//label[contains(@for, 'input-')]")
|
||||
return labels[0]
|
||||
}
|
||||
|
||||
public get restoringHeader() {
|
||||
return $("//h1[text()='Restoring']")
|
||||
}
|
||||
|
||||
public get restoringDescription() {
|
||||
return $("//p[contains(text(), 'Please wait')]")
|
||||
}
|
||||
|
||||
public get progressbarDescription() {
|
||||
return $("//*[@data-testid='progressbar-description']")
|
||||
}
|
||||
|
||||
public get progressbar() {
|
||||
return $("//*[@data-testid='progressbar-progress']")
|
||||
}
|
||||
|
||||
public get progressbarLabel() {
|
||||
return $("//*[@data-testid='progressbar-details']")
|
||||
}
|
||||
}
|
||||
export default new OverviewKompaktPage()
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
import exp from "constants"
|
||||
import { E2EMockClient } from "../../../../../libs/e2e-mock/client/src"
|
||||
import { overviewDataWithOneSimCard } from "../../../../../libs/e2e-mock/responses/src"
|
||||
import { createMockBackup } from "../../helpers/mock-backup"
|
||||
import OverviewKompaktPage from "../../page-objects/overview-kompakt.page"
|
||||
|
||||
describe("Check restore - interrupted", () => {
|
||||
const firstSerialNumber = "0123456789ABCDEF"
|
||||
|
||||
before(async () => {
|
||||
// Arrange – setup backup and connect mock
|
||||
await createMockBackup(firstSerialNumber)
|
||||
|
||||
E2EMockClient.connect()
|
||||
await browser.waitUntil(() => E2EMockClient.checkConnection())
|
||||
})
|
||||
|
||||
after(() => {
|
||||
// Clean up
|
||||
E2EMockClient.stopServer()
|
||||
E2EMockClient.disconnect()
|
||||
})
|
||||
|
||||
it("Connect device", async () => {
|
||||
// Arrange – setup mocked device response
|
||||
E2EMockClient.mockResponses([
|
||||
{
|
||||
path: "path-1",
|
||||
endpoint: "FEATURE_DATA",
|
||||
method: "GET",
|
||||
status: 200,
|
||||
body: {
|
||||
...overviewDataWithOneSimCard,
|
||||
sections: {
|
||||
...overviewDataWithOneSimCard.sections,
|
||||
backup: {
|
||||
...overviewDataWithOneSimCard.sections.backup,
|
||||
show: true,
|
||||
details: [
|
||||
{
|
||||
fileName: "1752426740400_0123456789ABCDEF.mcbackup",
|
||||
serialNumber: firstSerialNumber,
|
||||
vendorId: "3310",
|
||||
productId: "2006",
|
||||
timestamp: 1752426740400,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
])
|
||||
|
||||
E2EMockClient.addDevice({ path: "path-1", serialNumber: firstSerialNumber })
|
||||
|
||||
// Act – wait for overview menu to load
|
||||
await browser.pause(6000)
|
||||
const menuItem = await $(`//a[@href="#/generic/mc-overview"]`)
|
||||
await menuItem.waitForDisplayed({ timeout: 10000 })
|
||||
|
||||
// Assert
|
||||
await expect(menuItem).toBeDisplayed()
|
||||
await browser.pause(7000)
|
||||
})
|
||||
|
||||
it("Click Restore button", async () => {
|
||||
// Arrange
|
||||
const restoreButton = OverviewKompaktPage.kompaktRestoreButton
|
||||
const timeout = 100000
|
||||
const interval = 500
|
||||
const startTime = Date.now()
|
||||
|
||||
// Act – wait for the button to become clickable
|
||||
let isDisplayed = false
|
||||
while (Date.now() - startTime < timeout) {
|
||||
try {
|
||||
isDisplayed = await restoreButton.isDisplayed()
|
||||
if (isDisplayed && (await restoreButton.isClickable())) {
|
||||
break
|
||||
}
|
||||
} catch (e) {}
|
||||
await browser.pause(interval)
|
||||
}
|
||||
|
||||
// Assert
|
||||
await expect(restoreButton).toBeDisplayed()
|
||||
await restoreButton.click()
|
||||
})
|
||||
|
||||
it("Select latest backup file and proceed next", async () => {
|
||||
// Arrange
|
||||
const label = await OverviewKompaktPage.getLatestBackupLabel()
|
||||
const confirmButton = OverviewKompaktPage.kompaktRestoreModalConfirm
|
||||
|
||||
// Act
|
||||
await label.click()
|
||||
|
||||
// Assert
|
||||
await expect(confirmButton).toBeDisplayed()
|
||||
await confirmButton.click()
|
||||
})
|
||||
|
||||
it("Verify failed Restore modal", async () => {
|
||||
// Arrange
|
||||
const failedHeader = OverviewKompaktPage.restoringFailedHeader
|
||||
const failedDescription = OverviewKompaktPage.restoringFailedDescription
|
||||
const closeButton = OverviewKompaktPage.kompaktRestoreModalCloseFailedButton
|
||||
|
||||
// Act – wait for modal to appear
|
||||
await browser.waitUntil(async () => await failedHeader.isDisplayed(), {
|
||||
timeout: 15000,
|
||||
timeoutMsg: "Restore failed header did not appear",
|
||||
})
|
||||
|
||||
// Assert
|
||||
await expect(failedHeader).toHaveText("Restore failed")
|
||||
await expect(failedDescription).toHaveText(
|
||||
"The restore process was interrupted."
|
||||
)
|
||||
await expect(closeButton).toBeDisplayed()
|
||||
await closeButton.click()
|
||||
})
|
||||
|
||||
it("Verify if overview page is displayed after Restore is failed", async () => {
|
||||
// Arrange
|
||||
const kompaktImage = OverviewKompaktPage.kompaktImage
|
||||
|
||||
// Assert
|
||||
await expect(kompaktImage).toBeDisplayed()
|
||||
})
|
||||
})
|
||||
@@ -106,6 +106,10 @@ describe("Check restore modal", () => {
|
||||
OverviewKompaktPage.kompaktRestoreModalConfirm
|
||||
await expect(kompaktRestoreModalConfirm).toBeDisplayed()
|
||||
|
||||
//check if latest restore file exist (radio button + label)
|
||||
const label = await OverviewKompaktPage.getLatestBackupLabel()
|
||||
await expect(label).toBeDisplayed()
|
||||
|
||||
const kompaktRestoreModalCancel =
|
||||
OverviewKompaktPage.kompaktRestoreModalCancel
|
||||
await expect(kompaktRestoreModalCancel).toBeDisplayed()
|
||||
|
||||
@@ -54,5 +54,6 @@ export enum TestFilesPaths {
|
||||
kompaktManageFilesInstallApkModalUpdate = "src/specs/overview/kompakt-manage-files-install-apk-modal-update.ts",
|
||||
kompaktCheckDeviceType = "src/specs/overview/kompakt-check-device-type.ts",
|
||||
kompaktRestoreModalCheck = "src/specs/overview/kompakt-restore-modal-check.ts",
|
||||
kompaktRestoreFailedModalCheck = "src/specs/overview/kompakt-restore-failed.ts",
|
||||
}
|
||||
export const toRelativePath = (path: string) => `./${path}`
|
||||
|
||||
@@ -107,6 +107,7 @@ export const config: Options.Testrunner = {
|
||||
toRelativePath(TestFilesPaths.kompaktManageFilesInstallApkModalUpdate),
|
||||
toRelativePath(TestFilesPaths.kompaktCheckDeviceType),
|
||||
toRelativePath(TestFilesPaths.kompaktRestoreModalCheck),
|
||||
toRelativePath(TestFilesPaths.kompaktRestoreFailedModalCheck),
|
||||
],
|
||||
suites: {
|
||||
standalone: [
|
||||
@@ -159,6 +160,7 @@ export const config: Options.Testrunner = {
|
||||
toRelativePath(TestFilesPaths.kompaktManageFilesInstallApkModalUpdate),
|
||||
toRelativePath(TestFilesPaths.kompaktCheckDeviceType),
|
||||
toRelativePath(TestFilesPaths.kompaktRestoreModalCheck),
|
||||
toRelativePath(TestFilesPaths.kompaktRestoreFailedModalCheck),
|
||||
],
|
||||
multidevicePureHarmony: [],
|
||||
multideviceSingleHarmony: [],
|
||||
@@ -220,6 +222,7 @@ export const config: Options.Testrunner = {
|
||||
toRelativePath(TestFilesPaths.kompaktManageFilesInstallApkModalUpdate),
|
||||
toRelativePath(TestFilesPaths.kompaktCheckDeviceType),
|
||||
toRelativePath(TestFilesPaths.kompaktRestoreModalCheck),
|
||||
toRelativePath(TestFilesPaths.kompaktRestoreFailedModalCheck),
|
||||
],
|
||||
},
|
||||
// Patterns to exclude.
|
||||
|
||||
Reference in New Issue
Block a user