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

Fix the "must check that an infinite loop is not triggered" integration test #19064

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

timvandermeij
Copy link
Contributor

This integration test fails intermittently, locally at least in Chrome with Puppeteer 23.4.0+, with the following errors:

In chrome: Expected '123Hello' to equal 'Hello123'.
In chrome: Expected '123Hello' to equal '123'.

This happens because the test before it left queued sandbox events behind. We don't close the document between tests, so those get run when we click the textbox in this test and that interferes with our selection/typing actions. This commit fixes the issue by flushing the queued sandbox events in the first test, which makes sure that state no longer leaks through to the next test and thus improves isolation.

Morever, similar to commit 3adf8b6 we use safer assertions to avoid further intermittent failures, and we replace the page.$eval call with a simpler Home button push like we already do in e.g. the test helpers. This combined makes the code shorter and simpler.

Fixes a part of #18773 (the scripting tests now all pass for me locally with the new Puppeteer version).

…on test

This integration test fails intermittently, locally at least in Chrome
with Puppeteer 23.4.0+, with the following errors:

```
In chrome: Expected '123Hello' to equal 'Hello123'.
In chrome: Expected '123Hello' to equal '123'.
```

This happens because the test before it left queued sandbox events
behind. We don't close the document between tests, so those get run
when we click the textbox in this test and that interferes with our
selection/typing actions. This commit fixes the issue by flushing the
queued sandbox events in the first test, which makes sure that state
no longer leaks through to the next test and thus improves isolation.

Morever, similar to commit 3adf8b6 we use safer assertions to avoid
further intermittent failures, and we replace the `page.$eval` call
with a simpler Home button push like we already do in e.g. the test
helpers. This combined makes the code shorter and simpler.
@timvandermeij
Copy link
Contributor Author

/botio integrationtest

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_integrationtest from @timvandermeij received. Current queue size: 0

Live output at: http://54.241.84.105:8877/0cbf1cfbc417644/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_integrationtest from @timvandermeij received. Current queue size: 0

Live output at: http://54.193.163.58:8877/6970813f0df0b06/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/0cbf1cfbc417644/output.txt

Total script time: 8.83 mins

  • Integration Tests: Passed

@Snuffleupagus
Copy link
Collaborator

This happens because the test before it left queued sandbox events behind. We don't close the document between tests, so those get run when we click the textbox in this test and that interferes with our selection/typing actions.

Possibly a stupid question, but could/should we just close the document between tests instead?

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/6970813f0df0b06/output.txt

Total script time: 19.36 mins

  • Integration Tests: Passed

@timvandermeij
Copy link
Contributor Author

timvandermeij commented Nov 17, 2024

Possibly a stupid question, but could/should we just close the document between tests instead?

It's a good question actually, and I asked myself that one as well while making the patch. I did consider that, but because we don't seem to do that anywhere else yet I figured I'd go for consistency here. Moreover, in general it seems like good practice to have the tests clean up anything they created themselves.

However, I do agree that we might want to consider doing that in follow-up work. Isolation issues (dependencies between tests) are currently not visible because we run the integration tests in a fixed order, in contrast to e.g. the unit tests which already run in a random order. I think fixing that will bring any remaining isolation issues to the surface, and fixing them will then probably result in having the close the document between tests. For now though the objective is to unblock Puppeteer updates, so I therefore kept this patch small to fix one thing at a time, but I have created follow-up issue #19065 to track this because I do think that it is a good idea (but probably also quite a bit of work similar to what we had to do to get the intermittents under control).

@calixteman
Copy link
Contributor

This happens because the test before it left queued sandbox events behind. We don't close the document between tests, so those get run when we click the textbox in this test and that interferes with our selection/typing actions.

Possibly a stupid question, but could/should we just close the document between tests instead?

Yes we should make all the tests independent of each other, mainly because it's super painful to have to run all test before the one you want to debug...
It's on my todo list (but its rank isn't very high...)

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

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

r=me, thank you.

@timvandermeij timvandermeij merged commit e8fbb60 into mozilla:master Nov 19, 2024
7 checks passed
@timvandermeij timvandermeij deleted the fix-intermittent branch November 19, 2024 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants