I have this flaky method in Playwright testing framework. It always fails to check the…
- User
I have this flaky method in Playwright testing framework. It always fails to check the absence of the device on the page and fails on this step: await this.buttons.delete.first().click({ timeout: 10_000 });
I tried many checks: // while (await this.buttons.delete.count() > 0) { and while (await this.buttons.delete.first().isVisible()) { and await expect.poll(async () => await this.buttons.delete.count(), { intervals: [500, 200, 200], timeout: 1000 }).toBe(0).catch(() => { }); //waiting for the UI updated. Best effort But nothing seems work reliably. Please suggest the solution, maybe I miss something here.
/**
Deletes all devices listed on the Grid. @returns {Promise} - Resolves when all devices have been deleted. @description This method iteratively deletes all devices from the UI until none remain. */ async deleteAllDevices() { await waitForPageLoad(this.page); while (await this.buttons.delete.first().isVisible()) { // while (await this.buttons.delete.count() > 0) { await waitForPageLoad(this.page); await this.buttons.delete.first().click({ timeout: 10_000 }); await this.buttons.cancel.waitFor(); const deviceName = (await this.getDeviceNameInDeleteConfirmationDialog().textContent()).trim(); console.log(deleteAllDevices. Deleting device: ${deviceName}); await this.buttons.confirmDelete.waitFor(); await this.getDeviceNameConfirmInput().fill(deviceName); await this.buttons.confirmDelete.click(); await waitForPageLoad(this.page); await expect.poll(async () => await this.buttons.delete.count(), { intervals: [500, 200, 200], timeout: 1000 }).toBe(0).catch(() => { }); //waiting for the UI updated. Best effort } }
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.