Fix flaky Minecraft HoC Pegasus share page scenario#61801
Merged
Conversation
This was referenced Oct 16, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR includes a prospective fix for the flaky
hour_of_code_finish.featureUI test. This UI test has been flaky on Ipad and in particular on iPhone (top failing UI test on iPhone).This UI test has been disabled in Safari #60103 because the test was flaky at
> 0.33on Safari. I propose that we merge this PR and monitor for a few days. If the failure rate decreases on Iphone and Ipad, we can consider enabling this UI test on Safari.@wilkie proposed a refactoring of
Phaser'sisLoadingwhich I think would also be helpful in deflaking this test. (More details below.)When looking at the Saucelabs replays of the UI test, there is one scenario which is frequently flaky: 'Pegasus share page preserves certificate when redirecting' in
hour_of_code_finish.feature. I observed 2 different errors which resulted in a failed state. A third error that didn't lead to a failed state but I thought was still noteworthy is described in the Follow-up work section.Error 1:
To help resolve the first error, I am adding the step 'And I wait for the lab page to fully load' so that there is time to check for
Craft.phaserLoaded.code-dot-org/dashboard/test/ui/features/step_definitions/minecraft.rb
Lines 20 to 23 in 75f5f03
FYI, In
craft.js,Craft.phaserLoadedis defined as@wilkie is proposing a possible solution at #59857 to help resolve the
null is not an object (evaluating 'Craft.gameController.game.load.isLoadingerror. He investigated the logic behindphaserLoaded. I think it would also be helpful to update the code incraftto avoid the JS error.Error 2:
In the second error, we have completed the the first 4 steps of the scenario, and we are now on step
Given I am on "http://code.org/api/hour/finish/mc".When we check
And I wait until current URL contains "/congrats"we see this message at the top of the screen:'Puma caught this error: undefined method
by_short_codefor {"dance-ai-2023"=>...'by_short_codeis defined atcode-dot-org/pegasus/src/database.rb
Line 72 in 75f5f03
When '/api/hour/finish/mc' redirects to '/congrats', the fetching of tutorial data appears to not have been successful.
I propose adding a wait after the Minecraft game loads and afterGiven I am on "http://code.org/api/hour/finish/mc".After consulting with @wilkie, we are going to monitor this UI test as we are unsure why this error is occurring.
From Wilkie: 'the code seems to deterministically build a cached key/value store that maps things like "mc" to the CdoTutorial record... and I can't see why that would fail unless the database itself were misbehaving somehow.'
I also added a check for
Craftin the 'I wait until the Minecraft game is loaded' so thatphaserLoadedis not called unlessCraftis defined.Links
jira
Testing story
I ran this updated scenario against

test10 times and it passed 10 times in a row.Deployment strategy
Follow-up work
UPDATE: Resolved Slack thread
One of the three errors from the Saucelabs replay videos involved a YouTube error
'Sign in to confirm you're not a bot'.
Note that this error didn't lead to a failed state (the Minecraft loading error did), but I was able to repro this on my iPhone on
productionso logging a ticket to investigate this at https://codedotorg.atlassian.net/browse/LABS-1119.Privacy
Security
Caching
PR Checklist: