Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AG-12646 - Stabilise tests. #2634

Merged
merged 4 commits into from
Oct 3, 2024
Merged

AG-12646 - Stabilise tests. #2634

merged 4 commits into from
Oct 3, 2024

Conversation

alantreadway
Copy link
Member

@alantreadway alantreadway commented Oct 3, 2024

Addresses stability of some tests that have been highlighted as part of introducing AG-12646.

@alantreadway alantreadway requested a review from a team as a code owner October 3, 2024 13:10
@alantreadway alantreadway changed the title ag 12646/stabilise tests AG-12646 - Stabilise tests. Oct 3, 2024
const point = await canvasToPageTransformer(page);
const hover = point(200, 200);
const leave = point(300, 400);

// Test 1. Check that the Delete & Backspace keys work:
await page.locator(SELECTORS.textAnnotationMenu).click();
await page.locator(SELECTORS.commentMenuItem).click();
await page.mouse.move(hover.x, hover.y);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this move necessary? There are no other moves in the steps after this which is unusual.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not, but it reflects user behaviour better, since clicks don't just appear in the middle of the canvas without some hover events beforehand.

@@ -155,31 +158,44 @@ test.describe('toolbar', () => {
await page.keyboard.press('Backspace');
await page.keyboard.press('Home');
await page.keyboard.press('Delete');
await expect(page).toHaveScreenshot('delete-erased-text.png');
await expect(wrapper).toHaveAttribute('data-update-pending', 'false');
await expect(page).toHaveScreenshot('delete-erased-text.png', { animations: 'disabled' });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is delete-erased-text.png the only file that is causing trouble? I'm wondering whether so many data-update-pending checks are necessary 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to the nature of the failure, it looks like some interaction overtook a hover earlier in the flow - so waiting only before the snapshot wouldn't address this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ The updated snapshot is correct.

@olegat
Copy link
Contributor

olegat commented Oct 3, 2024

LGTM - but it would be helpful to understand why the AG-13008 test is the only one that's affected by the concurrency.

Could it be that page.mouse.click and page.click(elem) have different specifications regarding asynchronicity?

The documentation seems to suggest that they do:

@alantreadway alantreadway force-pushed the ag-12646/stabilise-tests branch from 779dc2b to ea7c915 Compare October 3, 2024 14:53
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - This will make the .spec.ts files far more readable and reliable. Thanks.


// Test 2. Check that Backspace key deletes the annotation when in idle state:
// (Click away from the annotation, then reclick it to go into idle state)
await page.mouse.click(leave.x, leave.y, { button: 'left' });
await page.mouse.click(hover.x, hover.y, { button: 'left' });
await page.keyboard.press('Backspace');
await expect(page).toHaveScreenshot('delete-annotation-removed.png');
await expect(page).toHaveScreenshot('delete-annotation-removed.png', { animations: 'disabled' });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: We may want to add a toHaveScreenshot proxy to change the default to { animations: 'disable' }. This can be done in a follow-up PR though.

@alantreadway alantreadway merged commit 70ca19c into latest Oct 3, 2024
26 checks passed
@alantreadway alantreadway deleted the ag-12646/stabilise-tests branch October 3, 2024 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants