From e10e892237041b9dc7b0c1d41d0cbee6c9b72228 Mon Sep 17 00:00:00 2001 From: robertmudi Date: Fri, 20 Dec 2024 14:04:51 +0100 Subject: [PATCH] CP-3171 first commit, added two test files, one for empty contacts scenario, second for actual contacts viewing --- .../src/page-objects/tabs.page.ts | 15 ++---- .../kompakt-contacts-viewing-empty.ts | 53 +++++++++++++++++++ .../overview/kompakt-contacts-viewing.ts | 47 ++++++++++++++++ 3 files changed, 105 insertions(+), 10 deletions(-) create mode 100644 apps/mudita-center-e2e/src/specs/overview/kompakt-contacts-viewing-empty.ts create mode 100644 apps/mudita-center-e2e/src/specs/overview/kompakt-contacts-viewing.ts diff --git a/apps/mudita-center-e2e/src/page-objects/tabs.page.ts b/apps/mudita-center-e2e/src/page-objects/tabs.page.ts index 3d712b22ca..1c97fdd3d8 100644 --- a/apps/mudita-center-e2e/src/page-objects/tabs.page.ts +++ b/apps/mudita-center-e2e/src/page-objects/tabs.page.ts @@ -35,27 +35,22 @@ class NavigationTabs extends Page { return $('[data-testid="contacts-menu-link"]') } - async clickContactsTab() { - await this.contactsTab.waitForClickable() - await this.contactsTab.click() + public get contactsKompaktTab() { + return $('[data-testid="icon-MenuContacts"]') } public get settingsTab() { return $('[data-testid="icon-MenuSettings"]') } - async settingsTabClick() { - await this.settingsTab.click() - } - public get helpTab() { return $('[data-testid="help-menu-button"]') } public async openHelpPage() { - const helpTab = await this.helpTab; - await helpTab.waitForDisplayed({ timeout: 15000 }); - await helpTab.click(); + const helpTab = await this.helpTab + await helpTab.waitForDisplayed({ timeout: 15000 }) + await helpTab.click() } } diff --git a/apps/mudita-center-e2e/src/specs/overview/kompakt-contacts-viewing-empty.ts b/apps/mudita-center-e2e/src/specs/overview/kompakt-contacts-viewing-empty.ts new file mode 100644 index 0000000000..4cfcb48380 --- /dev/null +++ b/apps/mudita-center-e2e/src/specs/overview/kompakt-contacts-viewing-empty.ts @@ -0,0 +1,53 @@ +import { E2EMockClient } from "../../../../../libs/e2e-mock/client/src" +import { + overviewConfigForBackup, + overviewDataWithOneSimCard, +} from "../../../../../libs/e2e-mock/responses/src" +import { mockEntityDownloadProcess } from "../../helpers/mock-entity-download-process.helper" +import { selectedContactsEntities } from "../../helpers/entity-fixtures" +import tabsPage from "../../page-objects/tabs.page" + +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 () => { + mockEntityDownloadProcess({ + path: "path-1", + data: [], + entityType: "contacts", + }) + + 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 contacts for Kompakt device and click Contacts tab", async () => { + // mock contacts function for testing/modification purposes + // mockEntityDownloadProcess({ + // path: "path-1", + // data: selectedContactsEntities, + // entityType: "contacts", + // }) + const contactsKompaktTab = tabsPage.contactsKompaktTab + await contactsKompaktTab.click() + }) +}) diff --git a/apps/mudita-center-e2e/src/specs/overview/kompakt-contacts-viewing.ts b/apps/mudita-center-e2e/src/specs/overview/kompakt-contacts-viewing.ts new file mode 100644 index 0000000000..56dd516ced --- /dev/null +++ b/apps/mudita-center-e2e/src/specs/overview/kompakt-contacts-viewing.ts @@ -0,0 +1,47 @@ +import { E2EMockClient } from "../../../../../libs/e2e-mock/client/src" +import { + overviewConfigForBackup, + overviewDataWithOneSimCard, +} from "../../../../../libs/e2e-mock/responses/src" +import { mockEntityDownloadProcess } from "../../helpers/mock-entity-download-process.helper" +import { selectedContactsEntities } from "../../helpers/entity-fixtures" +import tabsPage from "../../page-objects/tabs.page" + +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.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("Click Contacts tab", async () => { + // mock contacts function for testing/modification purposes + // mockEntityDownloadProcess({ + // path: "path-1", + // data: selectedContactsEntities, + // entityType: "contacts", + // }) + const contactsKompaktTab = tabsPage.contactsKompaktTab + await contactsKompaktTab.click() + }) +})