Skip to content

Commit

Permalink
CP-3171 added new selectors, finished empty contacts test,
Browse files Browse the repository at this point in the history
  • Loading branch information
robertmudi committed Dec 21, 2024
1 parent e10e892 commit 1566829
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 24 deletions.
25 changes: 25 additions & 0 deletions apps/mudita-center-e2e/src/page-objects/contacts-kompakt.ts
Original file line number Diff line number Diff line change
@@ -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()
13 changes: 0 additions & 13 deletions apps/mudita-center-e2e/src/page-objects/tabs.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"]')
}
Expand All @@ -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"]')
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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 () => {
Expand Down Expand Up @@ -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)
})
})

0 comments on commit 1566829

Please sign in to comment.