-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Dzanan91/test/grs-task
test: added tests for contact us page-GRS task
- Loading branch information
Showing
9 changed files
with
150 additions
and
457 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Page,BrowserContext, Locator, FrameLocator, } from "@playwright/test"; | ||
|
||
export class ContactUsPage { | ||
readonly page:Page | ||
readonly context: BrowserContext; | ||
|
||
readonly firstNameInput: Locator | ||
readonly lastNameInput: Locator | ||
readonly emailInput: Locator | ||
readonly commentSection: Locator | ||
readonly submitBtn: Locator | ||
readonly nameErrorMessage: Locator | ||
readonly emailErrorMessage: Locator | ||
readonly commentErrorMessage: Locator | ||
readonly widgetElement: Locator | ||
readonly youTubeElement: Locator | ||
readonly iframe: FrameLocator; | ||
|
||
|
||
constructor(page:Page, context: BrowserContext) { | ||
this.page = page | ||
this.context = context | ||
|
||
this.iframe = page.frameLocator('iframe[src="https://forms.zohopublic.com/giantrocketship/form/ContactUs/formperma/2GK_UjFMD9mHGNOwqNGNR4-lMvKrCQeBVRGu4FTSuY4?zf_rszfm=1&gclid=undefined"]'); | ||
|
||
this.firstNameInput = this.iframe.locator('input[elname="First"]'); | ||
this.lastNameInput = this.iframe.locator('input[elname="Last"]'); | ||
this.emailInput = this.iframe.locator('input[name="Email"]'); | ||
this.commentSection = this.iframe.locator('textarea[id="MultiLine-arialabel"]'); | ||
this.submitBtn = this.iframe.locator('button[elname="submit"]') | ||
this.nameErrorMessage = this.iframe.locator('#error-Name') | ||
this.emailErrorMessage = this.iframe.locator('#error-Email') | ||
this.commentErrorMessage = this.iframe.locator('#error-MultiLine') | ||
this.widgetElement = this.page.locator('div[data-widget_type="text-editor.default"] p') | ||
this.youTubeElement = this.page.locator('div[data-settings*="youtube_url"]') | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export function generateRandomString(length: number): string { | ||
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; | ||
let result = ''; | ||
for (let i = 0; i < length; i++) { | ||
result += characters.charAt(Math.floor(Math.random() * characters.length)); | ||
} | ||
return result; | ||
} |
Oops, something went wrong.