57 lines
1.8 KiB
TypeScript
57 lines
1.8 KiB
TypeScript
|
|
import { test, expect } from '@playwright/test';
|
||
|
|
|
||
|
|
|
||
|
|
test.describe.serial('Friends page', () => {
|
||
|
|
test.describe.only('as User1', () => {
|
||
|
|
test.use({ storageState: 'test/storageState/user1.json' });
|
||
|
|
|
||
|
|
test.beforeAll(() => {
|
||
|
|
|
||
|
|
})
|
||
|
|
|
||
|
|
test('Homepage', async ({ page }) => {
|
||
|
|
await page.goto('/')
|
||
|
|
await expect(page.locator('h1').first()).toHaveText('Dashboard - Home')
|
||
|
|
await expect(page.locator('data-testid=navbarTopProfileDropdown')).toContainText('Nuwan Chaturanga')
|
||
|
|
});
|
||
|
|
|
||
|
|
test('Friends page', async({ page }) => {
|
||
|
|
await page.goto('/friends')
|
||
|
|
await expect(page.locator('h5').first()).toHaveText('Find New Friends')
|
||
|
|
})
|
||
|
|
|
||
|
|
test.describe('Send friend request', () => {
|
||
|
|
test.beforeAll( async () => {
|
||
|
|
|
||
|
|
})
|
||
|
|
|
||
|
|
test.only('Connect', async ({page, browser}) => {
|
||
|
|
await page.goto('/friends')
|
||
|
|
await expect(page.locator('data-testid=peopleListTable')).toContainText('Seth Call')
|
||
|
|
await page.locator('data-testid=peopleListTable').locator('text=Seth Call').click()
|
||
|
|
//await page.locator('data-testid=profileSidePanel').locator('data-testid=connect').click()
|
||
|
|
//await expect(page.locator('#flash')).toHaveText('Your friend request was sent successfully')
|
||
|
|
})
|
||
|
|
|
||
|
|
})
|
||
|
|
|
||
|
|
})
|
||
|
|
|
||
|
|
test.describe('as User2', () => {
|
||
|
|
test.use({ storageState: 'test/storageState/user2.json' });
|
||
|
|
|
||
|
|
test('Homepage', async ({ page }) => {
|
||
|
|
await page.goto('/')
|
||
|
|
await expect(page.locator('h1').first()).toHaveText('Dashboard - Home')
|
||
|
|
await expect(page.locator('data-testid=navbarTopProfileDropdown')).toContainText('Seth Call')
|
||
|
|
});
|
||
|
|
|
||
|
|
test('Friends page', async({ page }) => {
|
||
|
|
await page.goto('/friends')
|
||
|
|
await expect(page.locator('h5').first()).toHaveText('Find New Friends')
|
||
|
|
})
|
||
|
|
|
||
|
|
})
|
||
|
|
})
|
||
|
|
|