Utilizing Angular and Playwright
Within my application, I have incorporated 2 buttons - one for delete mode and another for refreshing. Whenever the user triggers a refresh action, the delete mode button is disabled. Once the request returns, the delete mode button is re-enabled.
How can I create a test scenario where I click on the refresh button and verify that the delete mode button is disabled before the mocked request completes?
I've attempted the following approach but the assertion consistently passes even with attempts to use .not
to potentially fail it (resulting in false positives).
it('should disable delete button during refresh', async ({ page }) => {
const deleteBtn = page.getByRole('button', {name: 'enter delete mode'}).first();
page.on('request', () => { expect(deleteBtn).toBeDisabled() }) // false positive
await page.getByText('REFRESH', { exact: true}).click();
});