-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into e2etest/CUST-Andrew
- Loading branch information
Showing
4 changed files
with
104 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,3 +79,37 @@ test('Get User By Id works and connected customer link works and right info', as | |
|
||
await page.close(); | ||
}); | ||
|
||
test('Admin Edit Customer', async ({ page }) => { | ||
await page.goto('http://localhost:3000/users/login'); | ||
await page.getByPlaceholder('Enter your email').click(); | ||
await page.getByPlaceholder('Enter your email').fill('[email protected]'); | ||
await page.getByPlaceholder('Enter your password').click(); | ||
await page.getByPlaceholder('Enter your password').fill('pwd'); | ||
await page.getByRole('button', { name: 'Login' }).click(); | ||
await page.getByRole('button', { name: 'Customers' }).click(); | ||
await page.getByRole('link', { name: 'Customers List' }).click(); | ||
await page.getByRole('link', { name: 'e6c7398e-8ac4-4e10-9ee0-' }).click(); | ||
await page.getByRole('button', { name: 'Edit Customer' }).click(); | ||
await page.locator('input[name="firstName"]').click(); | ||
await page.locator('input[name="firstName"]').fill('John'); | ||
await page.locator('input[name="lastName"]').click(); | ||
await page.locator('input[name="lastName"]').fill('Doe'); | ||
await page.locator('input[name="address"]').click(); | ||
await page.locator('input[name="address"]').fill('Baker Street 123'); | ||
await page.locator('input[name="city"]').click(); | ||
await page.locator('input[name="city"]').fill('Montreal'); | ||
await page.getByRole('combobox').selectOption('Quebec'); | ||
await page.locator('input[name="telephone"]').click(); | ||
await page.locator('input[name="telephone"]').fill('5144203239'); | ||
await page.getByRole('button', { name: 'Update' }).click(); | ||
await expect(page.locator('h2')).toContainText('Success!'); | ||
await expect(page.getByRole('paragraph')).toContainText('Customer has been successfully updated.'); | ||
await page.getByRole('button', { name: 'Close' }).click(); | ||
await expect(page.locator('#root')).toContainText('First Name: John'); | ||
await expect(page.locator('#root')).toContainText('Last Name: Doe'); | ||
await expect(page.locator('#root')).toContainText('City: Montreal'); | ||
await expect(page.locator('#root')).toContainText('Province: Quebec'); | ||
await expect(page.locator('#root')).toContainText('Telephone: 5144203239'); | ||
await page.close(); | ||
}); |
25 changes: 25 additions & 0 deletions
25
petclinic-frontend/tests/emailing/emailingpagetests.spec.ts
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,25 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('Sending Email Test', async ({ page }) => { | ||
await page.goto('http://localhost:3000/users/login'); | ||
await page.getByPlaceholder('Enter your email').click(); | ||
await page.getByPlaceholder('Enter your email').fill('[email protected]'); | ||
await page.getByPlaceholder('Enter your password').click(); | ||
await page.getByPlaceholder('Enter your password').fill('pwd'); | ||
await page.getByRole('button', { name: 'Login' }).click(); | ||
await page.getByRole('link', { name: 'Emails' }).click(); | ||
await page.getByRole('button', { name: 'Send Raw Email' }).click(); | ||
await page.locator('input[type="email"]').click(); | ||
await page.locator('input[type="email"]').fill('[email protected]'); | ||
await page.locator('input[type="email"]').press('Tab'); | ||
await page.locator('input[type="text"]').fill('TestEmail'); | ||
await page.locator('input[type="text"]').press('Tab'); | ||
await page.locator('textarea').fill('This is a test email'); | ||
await page.getByRole('button', { name: 'Submit' }).click(); | ||
await expect(page.getByText('Status Code:')).toBeVisible(); | ||
await expect(page.locator('#root')).toContainText( | ||
'Message: Email sent successfully' | ||
); | ||
|
||
await page.close(); | ||
}); |
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,16 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('View Shop Product Title', async ({ page }) => { | ||
await page.goto('http://localhost:3000/home'); | ||
await page.getByRole('link', { name: 'Login' }).click(); | ||
await page.getByPlaceholder('Enter your email').click(); | ||
await page.getByPlaceholder('Enter your email').fill('[email protected]'); | ||
await page.getByPlaceholder('Enter your password').click(); | ||
await page.getByPlaceholder('Enter your password').fill('pwd'); | ||
await page.getByRole('button', { name: 'Login' }).click(); | ||
await page.getByRole('link', { name: 'Shop' }).click(); | ||
await page.getByRole('heading', { name: 'Aquarium Filter' }).first().click(); | ||
await expect( | ||
page.getByRole('heading', { name: 'Aquarium Filter', exact: true }) | ||
).toContainText('Aquarium Filter'); | ||
}); |
29 changes: 29 additions & 0 deletions
29
petclinic-frontend/tests/signuppage/signuppagetests.spec.ts
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,29 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('test', async ({ page }) => { | ||
await page.goto('http://localhost:3000/home'); | ||
await page.getByRole('link', { name: 'Signup' }).click(); | ||
await page.locator('input[name="firstName"]').click(); | ||
await page.locator('input[name="firstName"]').fill('ew'); | ||
await page.locator('input[name="lastName"]').click(); | ||
await page.locator('input[name="lastName"]').fill('ew'); | ||
await page.locator('input[name="address"]').click(); | ||
await page.locator('input[name="address"]').fill('jesse'); | ||
await page.locator('input[name="city"]').click(); | ||
await page.locator('input[name="city"]').fill('stjean'); | ||
await page.locator('input[name="province"]').click(); | ||
await page.locator('input[name="province"]').fill('qc'); | ||
await page.locator('input[name="telephone"]').click(); | ||
await page.locator('input[name="telephone"]').fill('1234567890'); | ||
await page.locator('input[name="username"]').click(); | ||
await page.locator('input[name="username"]').fill('wewew'); | ||
await page.locator('input[name="email"]').click(); | ||
await page.locator('input[name="email"]').fill('wrongemail'); | ||
await page.locator('input[name="password"]').click(); | ||
await page.locator('input[name="password"]').press('CapsLock'); | ||
await page.locator('input[name="password"]').fill('P'); | ||
await page.locator('input[name="password"]').press('CapsLock'); | ||
await page.locator('input[name="password"]').fill('Password12:'); | ||
await page.getByRole('button', { name: 'Send Verification Email' }).click(); | ||
await expect(page.locator('form')).toContainText('Invalid email format.'); | ||
}); |