Skip to content

Commit

Permalink
CP-2726 [E2E][HomePage] Contact Support - Unhappy Path (#2092)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertmudi authored Oct 4, 2024
2 parents f4ea3a4 + afb2b44 commit 60b8d20
Show file tree
Hide file tree
Showing 5 changed files with 191 additions and 11 deletions.
48 changes: 47 additions & 1 deletion apps/mudita-center-e2e/src/page-objects/help-modal.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ class HelpModalPage extends Page {
public get sendButton() {
return $('[data-testid="submit-button"]')
}

/**[Selector] Send button label */
public get sendButtonLabel() {
return $('//button[@data-testid="submit-button"]//p')
}
/** returns an Array containing list of attached files */
async attachmentsList() {
return $('[data-testid="file-list"]').$$('[data-testid="file-list-file"]')
Expand All @@ -43,9 +46,52 @@ class HelpModalPage extends Page {
public get closeBottomButton() {
return $('[data-testid="close-bottom-button"]')
}
/**[Selector] Invalid email text */
public get invalidEmailTextElement() {
return $('//input[@data-testid="email-input"]/following-sibling::*[1]')
}

/**[Selector] Support icon */
public get iconSupport() {
return $('[data-testid="icon-Support"]')
}
/**[Selector] Attachment icon */
public get iconAttachment() {
return $('[data-testid="icon-Attachment"]')
}
/**[Selector] Modal title with specific text */
public get modalTitle() {
return $('[data-testid="contact-support-modal-title"]')
}
/**[Selector] Modal subtitle */
public get modalSubtitle() {
return $('[data-testid="contact-support-modal-subtitle"]')
}
/**[Selector] Current date zip file */
public get currentDateZipFile() {
const currentDate = new Date().toISOString().split("T")[0] // Get current date in YYYY-MM-DD format
return $(`p*=${currentDate}.zip`)
}
/**[Selector] Attached files text */
public get attachedFilesLabel() {
return $('[data-testid="attached-files-label"]')
}
/**[Selector] Attached files subtext */
public get attachedFilesSubText() {
return $('[data-testid="attached-files-subtext"]')
}
/**[Selector] Email label */
public get emailLabel() {
return $('[data-testid="email-label"]')
}
/**[Selector] Message label */
public get messageLabel() {
return $('[data-testid="message-label"]')
}
/**[Selector] Whole modal */
public get wholeModal() {
return $('[data-testid="contact-support-modal"]')
}
}

export default new HelpModalPage()
18 changes: 11 additions & 7 deletions apps/mudita-center-e2e/src/page-objects/help.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
import Page from "./page"

class HelpPage extends Page {
public get helpTabTitle() {
public get helpTabTitle() {
return $('[data-testid="location"]')
}
public get helpMainHeader() {
return $('[data-testid="help-main-header"]')
}
public get helpMainSubHeader() {
public get helpMainSubHeader() {
return $('[data-testid="help-main-subheader"]')
}
public get iconSearch() {
Expand All @@ -27,7 +27,7 @@ class HelpPage extends Page {
public get helpSearchResultsParagraph() {
return $('[data-testid="help-search-results"] p')
}
public get helpSearchResultsList() {
public get helpSearchResultsList() {
return $('[data-testid="help-search-results"] ul')
}
public get helpSearchResultsItems() {
Expand All @@ -49,16 +49,20 @@ class HelpPage extends Page {
return $$('[data-testid="help-subcategories-list-item"]')
}
public get helpSubCategoriesListItemsLeftColumn() {
return $$('[data-testid="help-subcategories-list"]>div')[0].$$('[data-testid="help-subcategories-list-item"]')
return $$('[data-testid="help-subcategories-list"]>div')[0].$$(
'[data-testid="help-subcategories-list-item"]'
)
}
public get helpSubCategoriesListItemsRightColumn() {
return $$('[data-testid="help-subcategories-list"]>div')[1].$$('[data-testid="help-subcategories-list-item"]')
return $$('[data-testid="help-subcategories-list"]>div')[1].$$(
'[data-testid="help-subcategories-list-item"]'
)
}
public get helpMainFooterDescription() {
return $('[data-testid="help-main-footer-description"]')
return $('[data-testid="help-main-footer-description"]')
}
public get helpMainFooterContactSupportButton() {
return $('[data-testid="help-main-footer-contact-support-button"]')
return $('[data-testid="help-main-footer-contact-support-button"]')
}
}

Expand Down
117 changes: 117 additions & 0 deletions apps/mudita-center-e2e/src/specs/help/contact-support-unhappy-path.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/**
* 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 HelpPage from "../../page-objects/help.page"
import HomePage from "../../page-objects/home.page"
import HelpModalPage from "../../page-objects/help-modal.page"

describe("Contact Support - Unhappy Path", () => {
before(async () => {
const notNowButton = await HomePage.notNowButton
await notNowButton.waitForDisplayed()
await notNowButton.click()
})

it("Open Mudita Help Center and open Contact Support Modal", async () => {
const helpTab = NavigationTabs.helpTab
await helpTab.click()

const helpMainFooterContactSupportButton =
HelpPage.helpMainFooterContactSupportButton
await helpMainFooterContactSupportButton.click()
})

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

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

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

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

const modalTitle = HelpModalPage.modalTitle
await expect(modalTitle).toBeDisplayed()
await expect(modalTitle).toHaveText("Mudita Center Support")

const modalSubtitle = HelpModalPage.modalSubtitle
await expect(modalSubtitle).toBeDisplayed()
await expect(modalSubtitle).toHaveText(
"Contact Mudita support team and we will do our best to help you resolve your issues."
)

const emailLabel = HelpModalPage.emailLabel
await expect(emailLabel).toHaveText("Email")
const emailInput = HelpModalPage.emailInput
await expect(emailInput).toBeDisplayed()

const messageLabel = HelpModalPage.messageLabel
await expect(messageLabel).toHaveText("Message (optional)")
const descriptionInput = HelpModalPage.descriptionInput
await expect(descriptionInput).toBeDisplayed()

const attachedFilesLabel = HelpModalPage.attachedFilesLabel
const attachedFilesSubText = HelpModalPage.attachedFilesSubText
const singleAttachment = HelpModalPage.singleAttachment
const iconAttachment = HelpModalPage.iconAttachment
const currentDateZipFile = HelpModalPage.currentDateZipFile
await expect(singleAttachment).toBeDisplayed()
await expect(iconAttachment).toBeDisplayed()
await expect(currentDateZipFile).toBeDisplayed() //checks if zipfile has current date (date of sending the logs is the same as zip file name)
await expect(attachedFilesLabel).toHaveText("Attached files")
await expect(attachedFilesSubText).toHaveText(
"The attached files will help us resolve your problem"
)
})

it("Check if SEND button is present, has proper name and is disabled", async () => {
const sendButton = HelpModalPage.sendButton
const sendButtonLabel = HelpModalPage.sendButtonLabel
await expect(sendButton).toBeDisplayed()
await expect(sendButtonLabel).toHaveText("SEND")
await expect(sendButton).toBeDisabled()
})

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

it("Verify e-mail without @ character", async () => {
const emailInput = HelpModalPage.emailInput
await emailInput.setValue("emailtest.com")
const emailWarning = "Email is invalid"
const invalidEmailTextElement = HelpModalPage.invalidEmailTextElement
await expect(invalidEmailTextElement).toHaveText(emailWarning)
})

it("Check e-mail with @@ characters", async () => {
const emailInput = HelpModalPage.emailInput
await emailInput.setValue("email@@test.com")
const emailWarning = "Email is invalid"
const invalidEmailTextElement = HelpModalPage.invalidEmailTextElement
await expect(invalidEmailTextElement).toHaveText(emailWarning)
})

it("Enter correct e-mail to check if error message dissappears", async () => {
const emailInput = HelpModalPage.emailInput
await emailInput.setValue("[email protected]")
const invalidEmailTextElement = HelpModalPage.invalidEmailTextElement
await expect(invalidEmailTextElement).not.toBeDisplayed()
})

it("Check e-mail with , character", async () => {
const emailInput = HelpModalPage.emailInput
await emailInput.setValue("email@test,com")
const emailWarning = "Email is invalid"
const invalidEmailTextElement = HelpModalPage.invalidEmailTextElement
await expect(invalidEmailTextElement).toHaveText(emailWarning)
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export enum TestFilesPaths {
kompaktAbout = "src/specs/overview/kompakt-about.ts",
kompaktConnectedDevicesModalStressTest = "src/specs/stress-tests/connected-devices-stress-test.ts",
kompaktDrawerStressTest = "src/specs/stress-tests/device-drawer-stress-test.ts",
contactSupportUnhappyPath = "src/specs/help/contact-support-unhappy-path.ts",
kompaktBackupModalGettingInitialInfo = "src/specs/overview/kompakt-backup-getting-initial-info.ts",
}
export const toRelativePath = (path: string) => `./${path}`
18 changes: 15 additions & 3 deletions apps/mudita-center-e2e/wdio.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const config: Options.Testrunner = {
toRelativePath(TestFilesPaths.kompaktAbout),
toRelativePath(TestFilesPaths.kompaktConnectedDevicesModalStressTest),
toRelativePath(TestFilesPaths.kompaktDrawerStressTest),
toRelativePath(TestFilesPaths.contactSupportUnhappyPath),
toRelativePath(TestFilesPaths.kompaktBackupModalGettingInitialInfo),
],
suites: {
Expand All @@ -87,6 +88,7 @@ export const config: Options.Testrunner = {
toRelativePath(TestFilesPaths.backupLocationTest),
toRelativePath(TestFilesPaths.privacyPolicyTest),
toRelativePath(TestFilesPaths.licenseTest),
toRelativePath(TestFilesPaths.contactSupportUnhappyPath),
],
mock: [
toRelativePath(TestFilesPaths.mcCheckForUpdatesTest),
Expand Down Expand Up @@ -120,8 +122,10 @@ export const config: Options.Testrunner = {
//toRelativePath(TestFilesPaths.homePageTestDeviceNotConnectedTest),
toRelativePath(TestFilesPaths.newsPageOnlineTest),
toRelativePath(TestFilesPaths.termsOfServiceTest),
toRelativePath(TestFilesPaths.contactSupportUnhappyPath),
],
cicdMock: [
toRelativePath(TestFilesPaths.contactSupportUnhappyPath),
toRelativePath(TestFilesPaths.mcCheckForUpdatesTest),
toRelativePath(TestFilesPaths.mcCheckForUpdatesOfflineTest),
toRelativePath(TestFilesPaths.newsPageOfflineTest),
Expand Down Expand Up @@ -177,9 +181,17 @@ export const config: Options.Testrunner = {
binary: process.env.TEST_BINARY_PATH,
args: [],
},
'wdio:chromedriverOptions': {
binary: path.resolve(__dirname, '..', '..', 'node_modules', 'chromedriver', 'bin', 'chromedriver')
}
"wdio:chromedriverOptions": {
binary: path.resolve(
__dirname,
"..",
"..",
"node_modules",
"chromedriver",
"bin",
"chromedriver"
),
},
// If outputDir is provided WebdriverIO can capture driver session logs
// it is possible to configure which logTypes to include/exclude.
// excludeDriverLogs: ['*'], // pass '*' to exclude all driver session logs
Expand Down

0 comments on commit 60b8d20

Please sign in to comment.