-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
42 additions
and
29 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,26 @@ | ||
import { expect } from "@playwright/test"; | ||
import { AppPage } from "../abstractClasses"; | ||
|
||
export class ContactUs extends AppPage { | ||
public pagePath = '/contact' | ||
|
||
private fullNameInput = this.page.getByPlaceholder('You Full Name'); | ||
private emailInput = this.page.getByPlaceholder('Your Email Address'); | ||
private messageInput = this.page.getByPlaceholder('Please Describe Your Message'); | ||
private submitButton = this.page.getByRole('button', { name: 'Submit' }); | ||
|
||
async expectLoaded() { | ||
await expect(this.fullNameInput).toBeVisible(); | ||
await expect(this.emailInput).toBeVisible(); | ||
await expect(this.messageInput).toBeVisible(); | ||
await expect(this.submitButton).toBeVisible(); | ||
} | ||
|
||
async submitContactUsForm(options: { fullName: string, email: string, message: string }) { | ||
await this.expectLoaded(); | ||
await this.fullNameInput.fill(options.fullName); | ||
await this.emailInput.fill(options.email); | ||
await this.messageInput.fill(options.message); | ||
await this.submitButton.click(); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,39 +1,15 @@ | ||
import { randomUUID } from 'node:crypto'; | ||
import { test, expect } from '@playwright/test'; | ||
import { AppPage } from '../app/abstractClasses'; | ||
import { test } from '@playwright/test'; | ||
import { Application } from '../app'; | ||
|
||
test('test', async ({ page }) => { | ||
const contactUs = new ContactUs(page); | ||
const app = new Application(page); | ||
|
||
await contactUs.open(); | ||
await contactUs.submitContactUsForm({ | ||
await app.contactus.open(); | ||
await app.contactus.submitContactUsForm({ | ||
email: `xotabu4+${randomUUID()}@gmail.com`, | ||
fullName: 'test name', | ||
message: 'test message' | ||
}); | ||
// TODO: add success popup appears expectation | ||
}); | ||
|
||
class ContactUs extends AppPage { | ||
public pagePath = '/contact' | ||
|
||
private fullNameInput = this.page.getByPlaceholder('You Full Name'); | ||
private emailInput = this.page.getByPlaceholder('Your Email Address'); | ||
private messageInput = this.page.getByPlaceholder('Please Describe Your Message'); | ||
private submitButton = this.page.getByRole('button', { name: 'Submit' }); | ||
|
||
async expectLoaded() { | ||
await expect(this.fullNameInput).toBeVisible(); | ||
await expect(this.emailInput).toBeVisible(); | ||
await expect(this.messageInput).toBeVisible(); | ||
await expect(this.submitButton).toBeVisible(); | ||
} | ||
|
||
async submitContactUsForm(options: { fullName: string, email: string, message: string }) { | ||
await this.expectLoaded(); | ||
await this.fullNameInput.fill(options.fullName); | ||
await this.emailInput.fill(options.email); | ||
await this.messageInput.fill(options.message); | ||
await this.submitButton.click(); | ||
} | ||
} |