DevelopingSpace / starchart

A self-serve tool for managing custom domains and certificates
MIT License
21 stars 13 forks source link

Intermittent e2e test failures #618

Closed humphd closed 1 year ago

humphd commented 1 year ago

I'm seeing random test failures on the e2e tests recently. The error seems to be due to a selector returning multiple options for a "delete" button:

Error: locator.click: Error: strict mode violation: getByRole('button', { name: 'Delete' }) resolved to 2 elements:
    1) <button type="submit" aria-label="Delete DNS record" cla…>…</button> aka getByRole('button', { name: 'Delete DNS record' })
    2) <button type="submit" class="chakra-button cha-zrxcer">Delete</button> aka getByRole('button', { name: 'Delete', exact: true })

=========================== logs ===========================
waiting for getByRole('button', { name: 'Delete' })
============================================================

  54 |     await dnsRecordRow.getByRole('button', { name: 'Delete DNS record' }).click();
  55 |     // Click on delete button in modal
> 56 |     await page.getByRole('button', { name: 'Delete' }).click();
     |                                                        ^
  57 |     // Since there should be no DNS Records at this point, the table shouldn't exist
  58 |     await expect(page.locator('table')).toBeHidden();
  59 |   });

    at /home/runner/work/starchart/starchart/test/e2e/dns-record-table.spec.ts:56:56

What's up with these 2 delete buttons? cc @Eakam1007, @Myrfion

humphd commented 1 year ago

https://github.com/DevelopingSpace/starchart/actions/runs/4700553392/jobs/8335400208 is an example of a PR by @Ririio, but I've seen it in other PRs today too. Sometimes it happens, sometimes it doesn't.

Eakam1007 commented 1 year ago

When we click on the Delete DNS Record table on the table, a modal pops up with another Delete button to confirm the delete. Seems like the selector is picking up both of them since they both start with "Delete". This is an easy fix by making the selector more specific so it only selects the button in the modal.

I'll change it later today