-
Notifications
You must be signed in to change notification settings - Fork 4.7k
[RNMobile] - Add optional wait in getBlockAtPosition #40078
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
[RNMobile] - Add optional wait in getBlockAtPosition #40078
Conversation
|
Size Change: +300 B (0%) Total Size: 1.22 MB
ℹ️ View Unchanged
|
fluiddot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I verified that the E2E tests succeeded in wordpress-mobile/gutenberg-mobile#4734, so the changes look great to me 🎊 .
I added some comments within the source code, there's nothing critical so let me know if you'll be able to address them. Otherwise, I'll be more than happy to approve the PR.
packages/react-native-editor/__device-tests__/gutenberg-editor-paragraph.test.js
Show resolved
Hide resolved
|
|
||
| await editorPage.setHtmlContent( | ||
| [ | ||
| testData.unknownElementBlock, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unknownElementBlock might sound too generic since this is related to a Paragraph block, what do you think about renaming it to unknownElementParagraphBlock?
| const blockActionsMenuButton = await waitForVisible( | ||
| this.driver, | ||
| blockActionsMenuButtonLocator | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that the following code block handles the case where the Block Actions Menu button is not visible. The buttons is displayed at the bottom of the block, so it tries to scroll down the block list until it's visible. Not sure why this behavior is only applied on Android since it might also happen on iOS 🤔 . In any case, I'm wondering if we could use the waitForVisible helper there too, wdyt?
gutenberg/packages/react-native-editor/__device-tests__/pages/editor-page.js
Lines 459 to 470 in eda2d66
| if ( isAndroid() ) { | |
| const block = await this.getBlockAtPosition( blockName, position ); | |
| let checkList = await this.driver.elementsByXPath( | |
| blockActionsMenuButtonLocator | |
| ); | |
| while ( checkList.length === 0 ) { | |
| await swipeUp( this.driver, block ); // Swipe up to show remove icon at the bottom. | |
| checkList = await this.driver.elementsByXPath( | |
| blockActionsMenuButtonLocator | |
| ); | |
| } | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right, I can try that, this one I will try in the next PR instead of here as this is something that the paragraph tests use a lot and testing could take a while. Good point about being Android only, not sure why but I'll try to remove it to see if it will work for both platforms in the next PR as well.
jostnes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review @fluiddot 🙇♀️
I've updated the suggested name change, the other changes I will update in the next PR since I think will take a while to test.
packages/react-native-editor/__device-tests__/gutenberg-editor-paragraph.test.js
Show resolved
Hide resolved
| const blockActionsMenuButton = await waitForVisible( | ||
| this.driver, | ||
| blockActionsMenuButtonLocator | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right, I can try that, this one I will try in the next PR instead of here as this is something that the paragraph tests use a lot and testing could take a while. Good point about being Android only, not sure why but I'll try to remove it to see if it will work for both platforms in the next PR as well.
fluiddot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎊 !
What?
I have been testing paragraph tests in this draft PR. However, the changes became too big so I am breaking it down to a few smaller PRs. This PR is the first part of a few PRs in an attempt to fix the flakiness on tests that are using the paragraph blocks.
Why?
The paragraph tests are currently flaky and don't work when running locally. When it fails in the CI, it is harder to debug it locally to know if it's an issue with the test or something else. This change is the first part to make it work consistently both when testing locally and in CI.
How?
gutenberg-editor-paragraph.test.jstotest-data.jsfile to be consistent with other test filesgetBlockAtPosition()to use the new helperwaitForVisible(). It is optional because from testing found that adding this here works for some tests but not all. In order to not have to update all tests at the same time, adding this condition so we can try it out test by test. Once we have checked all the tests, this condition can be removed/updated.Testing Instructions
Check that test still work in the CI.
Screenshots or screencast