wildebeest/ui-e2e-tests/invidivual-toot.spec.ts

47 wiersze
1.5 KiB
TypeScript

import { test, expect } from '@playwright/test'
test('Navigation to and view of an individual toot', async ({ page }) => {
await page.goto('http://127.0.0.1:8788/explore')
await page.locator('article').filter({ hasText: 'Ken White' }).locator('i.fa-globe + span').click()
const backButtonLocator = page.locator('a', { hasText: 'Back' })
await expect(backButtonLocator).toBeVisible()
const avatarLocator = page.locator('img[alt="Avatar of Ken White"]')
await expect(avatarLocator).toBeVisible()
const userLinkLocator = page.locator('a[href="/@Popehat"]', { hasText: 'Ken White' })
await expect(userLinkLocator).toBeVisible()
const tootContentLocator = page.locator('p', {
hasText: 'Just recorded the first Serious Trouble episode of the new year, out tomorrow.',
})
await expect(tootContentLocator).toBeVisible()
})
test('Navigation to and view of a reply toot', async ({ page }) => {
await page.goto('http://127.0.0.1:8788/explore')
await page
.locator('article')
.filter({ hasText: 'Bethany Black' })
.filter({
hasText: 'We did it! *wipes tear from eye*',
})
.locator('i.fa-globe + span')
.click()
await page
.locator('article')
.filter({ hasText: 'Zach Weinersmith' })
.filter({
hasText: 'Yes we did!',
})
.locator('i.fa-globe + span')
.click()
await expect(page.getByRole('link', { name: 'Avatar of Zach Weinersmith' })).toBeVisible()
await expect(page.getByRole('link', { name: 'Zach Weinersmith', exact: true })).toBeVisible()
await expect(page.getByText('Yes we did!')).toBeVisible()
})