From 499a8d88b40ce989dcf9dc00b745949a2030f719 Mon Sep 17 00:00:00 2001 From: robertmudi <158469469+robertmudi@users.noreply.github.com> Date: Thu, 10 Oct 2024 17:24:31 +0200 Subject: [PATCH] CP-2747 [E2E][HomePage] More news (#2117) --- .../src/page-objects/news.page.ts | 4 +++ .../src/specs/news/more-news.e2e.ts | 31 +++++++++++++++++++ .../consts/test-filenames.const.ts | 1 + apps/mudita-center-e2e/wdio.conf.ts | 3 ++ 4 files changed, 39 insertions(+) create mode 100644 apps/mudita-center-e2e/src/specs/news/more-news.e2e.ts diff --git a/apps/mudita-center-e2e/src/page-objects/news.page.ts b/apps/mudita-center-e2e/src/page-objects/news.page.ts index a85e660248..832baaeeed 100644 --- a/apps/mudita-center-e2e/src/page-objects/news.page.ts +++ b/apps/mudita-center-e2e/src/page-objects/news.page.ts @@ -14,6 +14,10 @@ class NewsPage extends Page { return $("p*=More news") } + public get moreNewsButtonHref() { + return $('a[href="https://www.mudita.com/#news"]') + } + public get newsCardElements() { return $$('[data-testid="news-card"]') } diff --git a/apps/mudita-center-e2e/src/specs/news/more-news.e2e.ts b/apps/mudita-center-e2e/src/specs/news/more-news.e2e.ts new file mode 100644 index 0000000000..c24909d9c2 --- /dev/null +++ b/apps/mudita-center-e2e/src/specs/news/more-news.e2e.ts @@ -0,0 +1,31 @@ +/** + * Copyright (c) Mudita sp. z o.o. All rights reserved. + * For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md + */ + +import NavigationTabs from "../../page-objects/tabs.page" +import HomePage from "../../page-objects/home.page" +import NewsPage from "../../page-objects/news.page" + +describe("Check more news button", () => { + it("Click Not Now and Open Mudita News", async () => { + const notNowButton = await HomePage.notNowButton + await expect(notNowButton).toBeClickable() + await notNowButton.click() + const muditaNewsTab = NavigationTabs.muditaNewsTab + await expect(muditaNewsTab).toBeDisplayed() + }) + + it("Check Mudita News Header, check More News button href", async () => { + const newsHeader = NewsPage.newsHeader + await expect(newsHeader).toBeDisplayed() + await expect(newsHeader).toHaveText("Mudita News") + + const moreNewsButton = await NewsPage.moreNewsButton + await expect(moreNewsButton).toBeDisplayed() + + const moreNewsButtonHref = NewsPage.moreNewsButtonHref + const checkHref = await moreNewsButtonHref.getAttribute("href") + await expect(checkHref).toBe("https://www.mudita.com/#news") + }) +}) diff --git a/apps/mudita-center-e2e/src/test-filenames/consts/test-filenames.const.ts b/apps/mudita-center-e2e/src/test-filenames/consts/test-filenames.const.ts index c93795b1ee..4e5d168a41 100644 --- a/apps/mudita-center-e2e/src/test-filenames/consts/test-filenames.const.ts +++ b/apps/mudita-center-e2e/src/test-filenames/consts/test-filenames.const.ts @@ -11,6 +11,7 @@ export enum TestFilesPaths { e2eMockSample = "src/specs/overview/e2e-mock-sample.e2e.ts", mcCheckForUpdatesTest = "src/specs/settings/mc-version-check-for-updates.e2e.ts", newsPageOnlineTest = "src/specs/news/news-check-online.e2e.ts", + newsMoreNews = "src/specs/news/more-news.e2e.ts", newsPageOfflineTest = "src/specs/news/news-check-offline.e2e.ts", termsOfServiceTest = "src/specs/settings/terms-of-service.e2e.ts", backupLocationTest = "src/specs/settings/backup-location.e2e.ts", diff --git a/apps/mudita-center-e2e/wdio.conf.ts b/apps/mudita-center-e2e/wdio.conf.ts index 1d39370a45..4818b46fce 100644 --- a/apps/mudita-center-e2e/wdio.conf.ts +++ b/apps/mudita-center-e2e/wdio.conf.ts @@ -61,6 +61,7 @@ export const config: Options.Testrunner = { toRelativePath(TestFilesPaths.homePageTestDeviceNotConnectedTest), toRelativePath(TestFilesPaths.newsPageOnlineTest), toRelativePath(TestFilesPaths.newsPageOfflineTest), + toRelativePath(TestFilesPaths.newsMoreNews), toRelativePath(TestFilesPaths.termsOfServiceTest), toRelativePath(TestFilesPaths.backupLocationTest), toRelativePath(TestFilesPaths.mcCheckForUpdatesOfflineTest), @@ -84,6 +85,7 @@ export const config: Options.Testrunner = { //toRelativePath(TestFilesPaths.helpSectionCheckTest), //toRelativePath(TestFilesPaths.homePageTestDeviceNotConnectedTest), toRelativePath(TestFilesPaths.newsPageOnlineTest), + toRelativePath(TestFilesPaths.newsMoreNews), toRelativePath(TestFilesPaths.termsOfServiceTest), toRelativePath(TestFilesPaths.backupLocationTest), toRelativePath(TestFilesPaths.privacyPolicyTest), @@ -123,6 +125,7 @@ export const config: Options.Testrunner = { toRelativePath(TestFilesPaths.newsPageOnlineTest), toRelativePath(TestFilesPaths.termsOfServiceTest), toRelativePath(TestFilesPaths.contactSupportUnhappyPath), + toRelativePath(TestFilesPaths.newsMoreNews), ], cicdMock: [ toRelativePath(TestFilesPaths.contactSupportUnhappyPath),