kopia lustrzana https://github.com/cloudflare/wildebeest
add e2e ui test to check account posts and posts-and-replies tabs
rodzic
ffaba34966
commit
beb2cfb8f0
|
@ -40,8 +40,7 @@ export default component$(() => {
|
||||||
const { accountId, statuses } = statusesLoader.use().value
|
const { accountId, statuses } = statusesLoader.use().value
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div data-testid="account-posts">
|
||||||
<div data-testid="account-statuses">
|
|
||||||
<StatusesPanel
|
<StatusesPanel
|
||||||
initialStatuses={statuses}
|
initialStatuses={statuses}
|
||||||
fetchMoreStatuses={$(async (numOfCurrentStatuses: number) => {
|
fetchMoreStatuses={$(async (numOfCurrentStatuses: number) => {
|
||||||
|
@ -59,6 +58,5 @@ export default component$(() => {
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</>
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -40,8 +40,7 @@ export default component$(() => {
|
||||||
const { accountId, statuses } = statusesLoader.use().value
|
const { accountId, statuses } = statusesLoader.use().value
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div data-testid="account-posts-and-replies">
|
||||||
<div data-testid="account-statuses">
|
|
||||||
<StatusesPanel
|
<StatusesPanel
|
||||||
initialStatuses={statuses}
|
initialStatuses={statuses}
|
||||||
fetchMoreStatuses={$(async (numOfCurrentStatuses: number) => {
|
fetchMoreStatuses={$(async (numOfCurrentStatuses: number) => {
|
||||||
|
@ -61,6 +60,5 @@ export default component$(() => {
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -9,13 +9,11 @@ test(`Navigation via to and view of an account (with 1 post)`, async ({ page })
|
||||||
await expect(page.getByTestId('account-info').getByText('Joined')).toBeVisible()
|
await expect(page.getByTestId('account-info').getByText('Joined')).toBeVisible()
|
||||||
await expect(page.getByTestId('account-info').getByTestId('stats')).toHaveText('1Posts0Following0Followers')
|
await expect(page.getByTestId('account-info').getByTestId('stats')).toHaveText('1Posts0Following0Followers')
|
||||||
|
|
||||||
expect(await page.getByTestId('account-statuses').getByRole('article').count()).toBe(1)
|
expect(await page.getByTestId('account-posts').getByRole('article').count()).toBe(1)
|
||||||
await expect(
|
await expect(
|
||||||
page.getByTestId('account-statuses').getByRole('article').getByRole('img', { name: 'Avatar of Ben, just Ben' })
|
page.getByTestId('account-posts').getByRole('article').getByRole('img', { name: 'Avatar of Ben, just Ben' })
|
||||||
).toBeVisible()
|
).toBeVisible()
|
||||||
await expect(page.getByTestId('account-statuses').getByRole('article')).toContainText(
|
await expect(page.getByTestId('account-posts').getByRole('article')).toContainText('A very simple update: all good!')
|
||||||
'A very simple update: all good!'
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
test('Navigation to and view of an account (with 2 posts)', async ({ page }) => {
|
test('Navigation to and view of an account (with 2 posts)', async ({ page }) => {
|
||||||
|
@ -28,10 +26,30 @@ test('Navigation to and view of an account (with 2 posts)', async ({ page }) =>
|
||||||
await expect(page.getByTestId('account-info').getByText('Joined')).toBeVisible()
|
await expect(page.getByTestId('account-info').getByText('Joined')).toBeVisible()
|
||||||
await expect(page.getByTestId('account-info').getByTestId('stats')).toHaveText('2Posts0Following0Followers')
|
await expect(page.getByTestId('account-info').getByTestId('stats')).toHaveText('2Posts0Following0Followers')
|
||||||
|
|
||||||
expect(await page.getByTestId('account-statuses').getByRole('article').count()).toBe(2)
|
expect(await page.getByTestId('account-posts').getByRole('article').count()).toBe(2)
|
||||||
const [post1Locator, post2Locator] = await page.getByTestId('account-statuses').getByRole('article').all()
|
const [post1Locator, post2Locator] = await page.getByTestId('account-posts').getByRole('article').all()
|
||||||
await expect(post1Locator.getByRole('img', { name: 'Avatar of Raffa123$' })).toBeVisible()
|
await expect(post1Locator.getByRole('img', { name: 'Avatar of Raffa123$' })).toBeVisible()
|
||||||
await expect(post1Locator).toContainText("I'm Rafael and I am a web designer")
|
await expect(post1Locator).toContainText("I'm Rafael and I am a web designer")
|
||||||
await expect(post2Locator.getByRole('img', { name: 'Avatar of Raffa123$' })).toBeVisible()
|
await expect(post2Locator.getByRole('img', { name: 'Avatar of Raffa123$' })).toBeVisible()
|
||||||
await expect(post2Locator).toContainText('Hi! My name is Rafael!')
|
await expect(post2Locator).toContainText('Hi! My name is Rafael!')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('View of an account with only a reply and 0 posts', async ({ page }) => {
|
||||||
|
await page.goto('http://127.0.0.1:8788/@Penny')
|
||||||
|
|
||||||
|
await expect(page.getByTestId('account-posts')).toBeVisible()
|
||||||
|
await expect(page.getByTestId('account-posts')).toHaveText('Nothing to see right now. Check back later!')
|
||||||
|
await expect(page.getByTestId('account-posts-and-replies')).not.toBeVisible()
|
||||||
|
|
||||||
|
await page.getByRole('link', { name: 'Posts and replies' }).click()
|
||||||
|
|
||||||
|
await expect(page.getByTestId('account-posts-and-replies')).toBeVisible()
|
||||||
|
await expect(page.getByTestId('account-posts-and-replies').getByRole('article')).toContainText('Yes you guys did it!')
|
||||||
|
await expect(page.getByTestId('account-posts')).not.toBeVisible()
|
||||||
|
|
||||||
|
await page.getByRole('link', { name: 'Posts', exact: true }).click()
|
||||||
|
|
||||||
|
await expect(page.getByTestId('account-posts')).toBeVisible()
|
||||||
|
await expect(page.getByTestId('account-posts')).toHaveText('Nothing to see right now. Check back later!')
|
||||||
|
await expect(page.getByTestId('account-posts-and-replies')).not.toBeVisible()
|
||||||
|
})
|
||||||
|
|
Ładowanie…
Reference in New Issue