Skip to content

Commit 880cb8c

Browse files
authored
tools: try to reduce flake in image upload e2e tests (#2415)
try to reduce flake in the image upload tests
1 parent c2909e7 commit 880cb8c

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

app/forms/image-upload.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ function Step({ children, state, label, className }: StepProps) {
101101
/* eslint-enable react/jsx-key */
102102
return (
103103
// data-status used only for e2e testing
104-
<div className={cn('items-top flex gap-2 px-4 py-3', className)} data-status={status}>
104+
<div
105+
className={cn('items-top flex gap-2 px-4 py-3', className)}
106+
data-testid="upload-step"
107+
data-status={status}
108+
>
105109
{/* padding on icon to align it with text since everything is aligned to top */}
106110
<div className="pt-px">{icon}</div>
107111
<div

test/e2e/image-upload.e2e.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,14 @@ import {
1919
// to complete in time, so we just assert that they all start out ready and end
2020
// up complete
2121
async function expectUploadProcess(page: Page) {
22-
const steps = page.locator('div[data-status]')
23-
24-
for (const step of await steps.all()) {
25-
await expect(step).toHaveAttribute('data-status', 'ready', { timeout: 10000 })
26-
}
27-
2822
// check these here instead of first because if we don't look for the ready
2923
// states right away we won't catch them in time
3024
const progressModal = page.getByRole('dialog', { name: 'Image upload progress' })
3125
await expect(progressModal).toBeVisible()
26+
27+
const steps = page.getByTestId('upload-step')
28+
await expect(steps).toHaveCount(8)
29+
3230
const done = progressModal.getByRole('button', { name: 'Done' })
3331

3432
for (const step of await steps.all()) {
@@ -234,12 +232,6 @@ test.describe('Image upload', () => {
234232

235233
await page.click('role=button[name="Upload image"]')
236234

237-
const steps = page.locator('div[data-status]')
238-
239-
for (const step of await steps.all()) {
240-
await expect(step).toHaveAttribute('data-status', 'ready')
241-
}
242-
243235
const step = page.locator('[data-status]').filter({ hasText: stepText }).first()
244236
await expect(step).toHaveAttribute('data-status', 'error', { timeout: 15000 })
245237
await expectVisible(page, [

0 commit comments

Comments
 (0)