2023-02-04 16:19:37 +00:00
|
|
|
import { test, expect } from '@playwright/test'
|
|
|
|
|
|
|
|
test('Display the list of toots in the explore page', async ({ page }) => {
|
|
|
|
await page.goto('http://127.0.0.1:8788/explore')
|
|
|
|
|
|
|
|
const tootsTextsToCheck = [
|
2023-02-14 21:16:51 +00:00
|
|
|
'We did it!',
|
2023-02-16 16:58:03 +00:00
|
|
|
"I'm Rafael and I am a web designer!",
|
2023-02-14 21:16:51 +00:00
|
|
|
"Fine. I'll use Wildebeest",
|
|
|
|
'A very simple update: all good!',
|
2023-02-04 16:19:37 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
for (const tootText of tootsTextsToCheck) {
|
|
|
|
await expect(page.locator('article').filter({ hasText: tootText })).toBeVisible()
|
|
|
|
}
|
|
|
|
})
|
2023-02-16 11:05:57 +00:00
|
|
|
|
|
|
|
test('Correctly displays toots with truncated urls', async ({ page }) => {
|
|
|
|
await page.goto('http://127.0.0.1:8788/explore')
|
|
|
|
|
|
|
|
const articleLocator = page.locator('article').filter({ hasText: "Fine. I'll use Wildebeest" })
|
|
|
|
await expect(articleLocator.getByRole('link', { name: 'blog.cloudflare.com/welcome-to…' })).toBeVisible()
|
|
|
|
})
|
2023-02-16 16:58:03 +00:00
|
|
|
|
|
|
|
test('Correctly displays toots with spoiler text', async ({ page }) => {
|
|
|
|
await page.goto('http://127.0.0.1:8788/explore')
|
|
|
|
|
|
|
|
const articleLocator = page.getByRole('article').filter({ hasText: 'who am I?' })
|
|
|
|
await expect(articleLocator.getByRole('paragraph').getByText('Hi! My name is Rafael! 👋')).not.toBeVisible()
|
|
|
|
await articleLocator.getByRole('button', { name: 'show more' }).click()
|
|
|
|
await expect(articleLocator.getByRole('paragraph').getByText('Hi! My name is Rafael! 👋')).toBeVisible()
|
|
|
|
await articleLocator.getByRole('button', { name: 'show less' }).click()
|
|
|
|
await expect(articleLocator.getByRole('paragraph').getByText('Hi! My name is Rafael! 👋')).not.toBeVisible()
|
|
|
|
})
|