Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cp fix e2e lint #2179

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/mudita-center-e2e/src/helpers/tests.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class TestHelper {
}
return false
}
isOnline() {
return browser.execute(() => navigator.onLine)
isOnline(): Promise<boolean> {
return browser.execute(() => navigator.onLine) as Promise<boolean>
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/

import { ChainablePromiseElement } from "webdriverio"
import Page from "./page"

class HelpArticlePage extends Page {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/

import { index } from "@orama/orama/dist/components"
import Page from "./page"

class SelectDevicePage extends Page {
Expand Down
10 changes: 6 additions & 4 deletions apps/mudita-center-e2e/src/page-objects/tabs.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,16 @@ class NavigationTabs extends Page {
}

public get helpTab() {
return $('[data-testid="help-menu-button"]')
return $('[data-testid="help-menu-button"]') as x
}

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()
}
}

export default new NavigationTabs()

type x = ReturnType<WebdriverIO.Browser["$"]>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import HelpModalPage from "../../page-objects/help-modal.page"

describe("Contact Support - Unhappy Path", () => {
before(async () => {

Check failure on line 12 in apps/mudita-center-e2e/src/specs/help/contact-support-unhappy-path.ts

View workflow job for this annotation

GitHub Actions / validate (18.16.1)

Cannot find name 'before'.
const notNowButton = await HomePage.notNowButton
await notNowButton.waitForDisplayed()
await notNowButton.click()
Expand All @@ -26,20 +26,20 @@

it("Check contents of Contact Form", async () => {
const wholeModal = HelpModalPage.wholeModal
await expect(wholeModal).toBeDisplayed()

Check failure on line 29 in apps/mudita-center-e2e/src/specs/help/contact-support-unhappy-path.ts

View workflow job for this annotation

GitHub Actions / validate (18.16.1)

Property 'toBeDisplayed' does not exist on type 'JestMatchers<ChainablePromiseElement<Element>>'. Did you mean 'toBeDisabled'?

const closeModalButton = HelpModalPage.closeModalButton
await expect(closeModalButton).toBeDisplayed()

Check failure on line 32 in apps/mudita-center-e2e/src/specs/help/contact-support-unhappy-path.ts

View workflow job for this annotation

GitHub Actions / validate (18.16.1)

Property 'toBeDisplayed' does not exist on type 'JestMatchers<ChainablePromiseElement<Element>>'. Did you mean 'toBeDisabled'?

const modalHeader = HelpModalPage.modalHeader
await expect(modalHeader).toBeDisplayed()

Check failure on line 35 in apps/mudita-center-e2e/src/specs/help/contact-support-unhappy-path.ts

View workflow job for this annotation

GitHub Actions / validate (18.16.1)

Property 'toBeDisplayed' does not exist on type 'JestMatchers<ChainablePromiseElement<Element>>'. Did you mean 'toBeDisabled'?

const iconSupport = HelpModalPage.iconSupport
await expect(iconSupport).toBeDisplayed()

Check failure on line 38 in apps/mudita-center-e2e/src/specs/help/contact-support-unhappy-path.ts

View workflow job for this annotation

GitHub Actions / validate (18.16.1)

Property 'toBeDisplayed' does not exist on type 'JestMatchers<ChainablePromiseElement<Element>>'. Did you mean 'toBeDisabled'?

const modalTitle = HelpModalPage.modalTitle
await expect(modalTitle).toBeDisplayed()

Check failure on line 41 in apps/mudita-center-e2e/src/specs/help/contact-support-unhappy-path.ts

View workflow job for this annotation

GitHub Actions / validate (18.16.1)

Property 'toBeDisplayed' does not exist on type 'JestMatchers<ChainablePromiseElement<Element>>'. Did you mean 'toBeDisabled'?
await expect(modalTitle).toHaveText("Mudita Center Support")

Check failure on line 42 in apps/mudita-center-e2e/src/specs/help/contact-support-unhappy-path.ts

View workflow job for this annotation

GitHub Actions / validate (18.16.1)

Property 'toHaveText' does not exist on type 'JestMatchers<ChainablePromiseElement<Element>>'.

const modalSubtitle = HelpModalPage.modalSubtitle
await expect(modalSubtitle).toBeDisplayed()
Expand Down Expand Up @@ -76,12 +76,12 @@
const sendButtonLabel = HelpModalPage.sendButtonLabel
await expect(sendButton).toBeDisplayed()
await expect(sendButtonLabel).toHaveText("SEND")
await expect(sendButton).toBeDisabled()
expect(sendButton).toBeDisabled()
})

it("Try to Send form without any input", async () => {
const sendButton = HelpModalPage.sendButton
await expect(sendButton).toBeDisabled()
expect(sendButton).toBeDisabled()
})

it("Verify e-mail without @ character", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("Check Help window", () => {

// Verify network conditions
const isOnline = await testsHelper.isOnline()
await expect(isOnline).toBeFalsy()
expect(isOnline).toBeFalsy()

const notNowButton = await HomePage.notNowButton
await notNowButton.waitForDisplayed()
Expand Down Expand Up @@ -92,23 +92,23 @@ describe("Check Help window", () => {
const activeTabColor = await helpCategoriesListItems[0].getCSSProperty(
"color"
)
await expect(activeTabColor.value).toBe("rgba(0,0,0,1)")
expect(activeTabColor.value).toBe("rgba(0,0,0,1)")

const activeTabBackground = await helpCategoriesListItems[0].getCSSProperty(
"background-color"
)
await expect(activeTabBackground.value).toBe("rgba(237,237,237,1)")
expect(activeTabBackground.value).toBe("rgba(237,237,237,1)")

//Hover on section tabs
await helpCategoriesListItems[1].moveTo()
const hoverTabColor = await helpCategoriesListItems[0].getCSSProperty(
"color"
)
await expect(hoverTabColor.value).toBe("rgba(0,0,0,1)")
expect(hoverTabColor.value).toBe("rgba(0,0,0,1)")
const hoverTabBackground = await helpCategoriesListItems[0].getCSSProperty(
"background-color"
)
await expect(hoverTabBackground.value).toBe("rgba(237,237,237,1)")
expect(hoverTabBackground.value).toBe("rgba(237,237,237,1)")
})

it("Verify Harmony Section titles", async () => {
Expand All @@ -133,13 +133,11 @@ describe("Check Help window", () => {
//Every sub category should not be empty
const helpSubCategoryArticlesListItemTitles =
await helpSubCategoriesListItems.map((element) => {
return element
.$('[data-testid="help-subcategories-list-item-title"]')
.getText()
return element.$('[data-testid="help-subcategories-list-item-title"]')
})
await expect(
helpSubCategoryArticlesListItemTitles.length
).toBeGreaterThanOrEqual(1)
expect(helpSubCategoryArticlesListItemTitles.length).toBeGreaterThanOrEqual(
1
)

//List of articles should not be empty in any of the categories
let helpSubCategoriesListItem
Expand Down
15 changes: 8 additions & 7 deletions apps/mudita-center-e2e/src/specs/help/help-section-check.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,23 @@ describe("Check Help window", () => {
const activeTabColor = await helpCategoriesListItems[0].getCSSProperty(
"color"
)
await expect(activeTabColor.value).toBe("rgba(0,0,0,1)")
expect(activeTabColor.value).toBe("rgba(0,0,0,1)")

const activeTabBackground = await helpCategoriesListItems[0].getCSSProperty(
"background-color"
)
await expect(activeTabBackground.value).toBe("rgba(237,237,237,1)")
expect(activeTabBackground.value).toBe("rgba(237,237,237,1)")

//Hover on section tabs
await helpCategoriesListItems[1].moveTo()
const hoverTabColor = await helpCategoriesListItems[0].getCSSProperty(
"color"
)
await expect(hoverTabColor.value).toBe("rgba(0,0,0,1)")
expect(hoverTabColor.value).toBe("rgba(0,0,0,1)")
const hoverTabBackground = await helpCategoriesListItems[0].getCSSProperty(
"background-color"
)
await expect(hoverTabBackground.value).toBe("rgba(237,237,237,1)")
expect(hoverTabBackground.value).toBe("rgba(237,237,237,1)")
})

it("Verify Harmony Section titles", async () => {
Expand Down Expand Up @@ -117,9 +117,10 @@ describe("Check Help window", () => {
.$('[data-testid="help-subcategories-list-item-title"]')
.getText()
})
await expect(
helpSubCategoryArticlesListItemTitles.length
).toBeGreaterThanOrEqual(1)

expect(helpSubCategoryArticlesListItemTitles.length).toBeGreaterThanOrEqual(
1
)

//List of articles should not be empty in any of the categories
let helpSubCategoriesListItem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@ describe("Messages screen check", () => {
before(async () => {
// Waiting for device connected through USB
await browser.executeAsync((done) => {
setTimeout(done, 10000)
setTimeout(() => {
done()
}, 10000)
})
})
it("Should click Messages tab and check 'new message' button is displayed", async () => {
const messagesTab = await NavigationTabs.messagesTab
await messagesTab.waitForDisplayed()
await messagesTab.click()
await browser.executeAsync((done) => {
setTimeout(done, 2000)
setTimeout(() => {
done()
}, 2000)
})
const newMessageBtn = await MessagesPage.newMessageButton
await expect(newMessageBtn).toBeDisplayed()
Expand All @@ -28,7 +32,7 @@ describe("Messages screen check", () => {
it("Should click 'New Message' button and check it will become disabled", async () => {
const newMessageBtn = await MessagesPage.newMessageButton
await newMessageBtn.click()
await expect(newMessageBtn).toBeDisabled()
expect(newMessageBtn).toBeDisabled()
})

it("Should check 'Search Contacts' input field is displayed", async () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/mudita-center-e2e/src/specs/news/more-news.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ describe("Check more news button", () => {

const moreNewsButtonHref = NewsPage.moreNewsButtonHref
const checkHref = await moreNewsButtonHref.getAttribute("href")
await expect(checkHref).toBe("https://www.mudita.com/#news")
expect(checkHref).toBe("https://www.mudita.com/#news")
})
})
19 changes: 12 additions & 7 deletions apps/mudita-center-e2e/src/specs/news/news-check-offline.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/

import HomePage from "../../page-objects/home.page"
import NewsPage from "../../page-objects/news.page"
import {
Expand Down Expand Up @@ -35,7 +40,7 @@ describe("News Page Check in Offline Mode", () => {

// Verify network conditions
const isOnline = await testsHelper.isOnline()
await expect(isOnline).toBeFalsy()
expect(isOnline).toBeFalsy()
})

it("Opens News Page", async () => {
Expand Down Expand Up @@ -78,16 +83,16 @@ describe("News Page Check in Offline Mode", () => {

it("Verify News Cards", async () => {
const newsCardElements = await NewsPage.newsCardElements
await expect(newsCardElements).toHaveLength(6)
expect(newsCardElements).toHaveLength(6)

for (let newsCard of newsCardElements) {
for (const newsCard of newsCardElements) {
const newsCardImageLink = await newsCard.$('[data-testid="image-link"]')
await expect(newsCardImageLink).toBeClickable()
await expect(newsCardImageLink).toHaveAttribute("href", linkRegex)
expect(newsCardImageLink).toHaveAttribute("href", linkRegex)

const newsCardImageSrc = await newsCard.$("img")
await expect(newsCardImageSrc).toBeDisplayed()
await expect(newsCardImageSrc).toHaveAttribute("src", newsImageRegex)
expect(newsCardImageSrc).toHaveAttribute("src", newsImageRegex)

const newsCardTitle = await newsCard.$(
'[data-testid="header-link"] p[color="primary"]'
Expand All @@ -110,7 +115,7 @@ describe("News Page Check in Offline Mode", () => {
)
await expect(newsCardCommunityLink).toBeDisplayed()
await expect(newsCardCommunityLink).toBeClickable()
await expect(newsCardCommunityLink).toHaveAttribute("href", linkRegex)
expect(newsCardCommunityLink).toHaveAttribute("href", linkRegex)

const newsCardCommunityLinkText = await newsCard.$(
'[data-testid="community-link"] p[color="primary"]'
Expand All @@ -137,6 +142,6 @@ describe("News Page Check in Offline Mode", () => {

// Verify network conditions
const isOnline = await testsHelper.isOnline()
await expect(isOnline).toBeTruthy()
expect(isOnline).toBeTruthy()
})
})
17 changes: 10 additions & 7 deletions apps/mudita-center-e2e/src/specs/news/news-check-online.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import exp from "constants"
import screenshotHelper from "../../helpers/screenshot.helper"
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/

import HomePage from "../../page-objects/home.page"
import NewsPage from "../../page-objects/news.page"
import {
Expand Down Expand Up @@ -46,16 +49,16 @@ describe("News Page Check", () => {
})
it("Verify News Cards", async () => {
const newsCardElements = await NewsPage.newsCardElements
await expect(newsCardElements).toHaveLength(6)
expect(newsCardElements).toHaveLength(6)

for (let newsCard of newsCardElements) {
for (const newsCard of newsCardElements) {
const newsCardImageLink = await newsCard.$('[data-testid="image-link"]')
await expect(newsCardImageLink).toBeClickable()
await expect(newsCardImageLink).toHaveAttribute("href", linkRegex)
expect(newsCardImageLink).toHaveAttribute("href", linkRegex)

const newsCardImageSrc = await newsCard.$("img")
await expect(newsCardImageSrc).toBeDisplayed()
await expect(newsCardImageSrc).toHaveAttribute("src", newsImageRegex)
expect(newsCardImageSrc).toHaveAttribute("src", newsImageRegex)
const newsCardTitle = await newsCard.$(
'[data-testid="header-link"] p[color="primary"]'
)
Expand All @@ -75,7 +78,7 @@ describe("News Page Check", () => {
)
await expect(newsCardCommunityLink).toBeDisplayed()
await expect(newsCardCommunityLink).toBeClickable()
await expect(newsCardCommunityLink).toHaveAttribute("href", linkRegex)
expect(newsCardCommunityLink).toHaveAttribute("href", linkRegex)
const newsCardCommunityLinkText = await newsCard.$(
'[data-testid="community-link"] p[color="primary"]'
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// import { DEFAULT_RESPONSES } from "Libs/e2e-mock/responses/src/lib/default-responses"
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/

import { E2EMockClient } from "../../../../../libs/e2e-mock/client/src"
import {
DEFAULT_RESPONSES,
outboxReloadOverview,
overviewDataWithoutBadge,
} from "../../../../../libs/e2e-mock/responses/src"
// import { outboxReloadOverview } from "Libs/e2e-mock/responses/src"
import { DEFAULT_RESPONSES } from "../../../../../libs/e2e-mock/responses/src"

describe("E2E mock lock sample", () => {
before(async () => {
Expand All @@ -21,7 +20,7 @@ describe("E2E mock lock sample", () => {
E2EMockClient.disconnect()
})

it.only("Connect locked device", async () => {
it("Connect locked device", async () => {
E2EMockClient.mockResponse({
path: "path-1",
body: {},
Expand Down Expand Up @@ -66,7 +65,10 @@ describe("E2E mock lock sample", () => {

E2EMockClient.mockResponse({
path: "path-1",
body: DEFAULT_RESPONSES.FEATURE_DATA?.GET?.body as Record<string, any>,
body: DEFAULT_RESPONSES.FEATURE_DATA?.GET?.body as Record<
string,
unknown
>,
endpoint: "FEATURE_DATA",
method: "GET",
status: 200,
Expand All @@ -77,7 +79,7 @@ describe("E2E mock lock sample", () => {
path: "path-1",
body: DEFAULT_RESPONSES.FEATURE_CONFIGURATION?.GET?.body as Record<
string,
any
unknown
>,
endpoint: "FEATURE_CONFIGURATION",
method: "GET",
Expand All @@ -87,7 +89,7 @@ describe("E2E mock lock sample", () => {
path: "path-1",
body: DEFAULT_RESPONSES.MENU_CONFIGURATION?.GET?.body as Record<
string,
any
unknown
>,
endpoint: "MENU_CONFIGURATION",
method: "GET",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/

import { E2EMockClient } from "../../../../../libs/e2e-mock/client/src"
import {
apiConfigWithContacts,
Expand All @@ -20,7 +25,7 @@ describe("E2E mock match sample", () => {
E2EMockClient.disconnect()
})

it.only("Connect device with two different responses for one endpoint", async () => {
it("Connect device with two different responses for one endpoint", async () => {
// if body of FEATURE_CONFIGURATION request is equal to { feature: "contacts", lang: "en-US" } then return body: contactsConfig.
// in other cases return response without match filed
E2EMockClient.mockResponse({
Expand Down
Loading
Loading