From 156682977173784160960c15b1fb0e75420f5271 Mon Sep 17 00:00:00 2001 From: robertmudi Date: Sat, 21 Dec 2024 15:56:42 +0100 Subject: [PATCH] CP-3171 added new selectors, finished empty contacts test, --- .../src/page-objects/contacts-kompakt.ts | 25 ++++++++++++++++ .../src/page-objects/tabs.page.ts | 13 -------- .../kompakt-contacts-viewing-empty.ts | 30 ++++++++++++------- 3 files changed, 44 insertions(+), 24 deletions(-) create mode 100644 apps/mudita-center-e2e/src/page-objects/contacts-kompakt.ts diff --git a/apps/mudita-center-e2e/src/page-objects/contacts-kompakt.ts b/apps/mudita-center-e2e/src/page-objects/contacts-kompakt.ts new file mode 100644 index 0000000000..90680fae46 --- /dev/null +++ b/apps/mudita-center-e2e/src/page-objects/contacts-kompakt.ts @@ -0,0 +1,25 @@ +/** + * 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 ContactsKompaktPage extends Page { + public get contactRow() { + return $(`//*[@data-testid="ui-table-row"]`) + } + + public get iconContactsBook() { + return $(`//*[@data-testid="icon-contacts-book"]`) + } + + public get importContactsSubtext() { + return $('//p[@data-testid="ui-typography-p1"]') + } + + public get importContactsButton() { + return $('//*[@data-testid="primary-button-importContactsButton"]') + } +} +export default new ContactsKompaktPage() 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 1c97fdd3d8..1cc5470002 100644 --- a/apps/mudita-center-e2e/src/page-objects/tabs.page.ts +++ b/apps/mudita-center-e2e/src/page-objects/tabs.page.ts @@ -14,10 +14,6 @@ class NavigationTabs extends Page { return $('[data-testid="overview-link"]') } - async overviewTabClick() { - await this.overviewTab.click() - } - public get overviewKompaktTab() { return $('[data-testid="icon-MenuOverview"]') } @@ -26,15 +22,6 @@ class NavigationTabs extends Page { return $('[data-testid="overview-menu-link"]') } - async clickMessagesTab() { - await this.messagesTab.waitForClickable({ timeout: 5000 }) - await this.messagesTab.click() - } - - public get contactsTab() { - return $('[data-testid="contacts-menu-link"]') - } - public get contactsKompaktTab() { return $('[data-testid="icon-MenuContacts"]') } 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 index 4cfcb48380..3ee86796ea 100644 --- 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 @@ -1,11 +1,9 @@ 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" +import ContactsKompaktPage from "../../page-objects/contacts-kompakt" +import { icon } from "Libs/generic-view/models/src" describe("E2E mock sample - overview view", () => { before(async () => { @@ -40,14 +38,24 @@ describe("E2E mock sample - overview view", () => { 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", - // }) + it("Click Contacts tab", async () => { const contactsKompaktTab = tabsPage.contactsKompaktTab await contactsKompaktTab.click() }) + + it("Check if no contacts are displayed in the Contacts", async () => { + const contactRow = ContactsKompaktPage.contactRow + await expect(contactRow).not.toBeDisplayed() + + const iconContactsBook = ContactsKompaktPage.iconContactsBook + await expect(iconContactsBook).toBeDisplayed() + const importContactsSubtext = ContactsKompaktPage.importContactsSubtext + await expect(importContactsSubtext).toHaveText( + "Import all your contacts from a single source." + ) + const importContactsButton = ContactsKompaktPage.importContactsButton + await expect(importContactsButton).toBeDisplayed() + await expect(importContactsButton).toBeClickable() + await browser.pause(2000) + }) })