-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Support drawer menus opening as overlay instead of pushing content in ios #7986
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
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
0a1937a
Support drawer menus opening as overlay instead of pushing content in…
liatnetach 29131c7
clean code using sub functions anf few more pr suggestions
liatnetach 4803f82
Merge branch '7.x.x' into support-drawer-menu-open-mode
liatnetach 3183838
add e2e
liatnetach d98e6cd
update test
liatnetach 8a591c3
add e2e
liatnetach 7e7e97b
Merge remote-tracking branch 'origin/7.x.x' into support-drawer-menu-…
d4vidi 588bd1d
Code clean-up
d4vidi 9c9834b
Improve code for drawer pan start
d4vidi 640ca2e
split panGestureCallback
liatnetach 5390499
add same tests for above screen
liatnetach 61a939b
update tests
liatnetach dd7ddc4
fix tests
liatnetach 465146c
split ios android close case + fix anumation bug
liatnetach d73c98b
revert fix
liatnetach 7ba9697
update the percentVisible condition
liatnetach cc29eb0
fix shouldStretch for original mode
liatnetach acea9ee
update description
liatnetach 0ea31cc
Revert side-menu screen to minimal button list, add openMode toggle
d4vidi 1411a50
Adjust shouldStretchDrawer comment
d4vidi ef66711
Fix SetRoot test
d4vidi 1dc2135
add snapshot test
liatnetach 6a69199
update assets
liatnetach 4ecd2da
get expectImagesToBeEqual from Utils
liatnetach 54f0395
test 2 containers
liatnetach be4adb9
add logs
liatnetach 91d5b2d
create device screenshot
liatnetach bd1293a
update assets
liatnetach 558371f
Enhance drawer behavior by preventing closure when tapping on the ope…
yogevbd 2f87c08
Merge branch 'support-drawer-menu-open-mode' of github.com:wix/react-…
yogevbd 1ef6d7f
Fix tests
yogevbd 2d8384b
Clean up drawer-controller, revert changes for drawer push-mode
d4vidi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,78 +1,91 @@ | ||
| import Utils from './Utils'; | ||
| import TestIDs from '../playground/src/testIDs'; | ||
|
|
||
| const { elementByLabel, elementById } = Utils; | ||
| const {elementByLabel, elementById, expectImagesToBeEqual} = Utils; | ||
|
|
||
| describe('SideMenu', () => { | ||
| describe.each(['aboveContent', 'pushContent'])('SideMenu', (openMode) => { | ||
| beforeEach(async () => { | ||
| await device.launchApp({ newInstance: true }); | ||
| await device.launchApp({newInstance: true}); | ||
| await elementById(TestIDs.SIDE_MENU_BTN).tap(); | ||
| }); | ||
|
|
||
| it('close SideMenu and push to stack with static id', async () => { | ||
| await elementById(TestIDs.OPEN_LEFT_SIDE_MENU_BTN).tap(); | ||
| await elementById(TestIDs.LEFT_SIDE_MENU_PUSH_BTN).tap(); | ||
| await elementById(TestIDs.CLOSE_LEFT_SIDE_MENU_BTN).tap(); | ||
| await expect(elementById(TestIDs.PUSHED_SCREEN_HEADER)).toBeVisible(); | ||
| await elementById(TestIDs.POP_BTN).tap(); | ||
| await expect(elementById(TestIDs.CENTER_SCREEN_HEADER)).toBeVisible(); | ||
| if (openMode === 'aboveContent') { | ||
| await elementById(TestIDs.TOGGLE_SIDE_MENU_OPEN_MODE_BTN).tap(); | ||
| } | ||
| }); | ||
|
|
||
| it('Push to stack with static id and close SideMenu with screen options', async () => { | ||
| await elementById(TestIDs.OPEN_LEFT_SIDE_MENU_BTN).tap(); | ||
| await elementById(TestIDs.LEFT_SIDE_MENU_PUSH_AND_CLOSE_BTN).tap(); | ||
| await expect(elementById(TestIDs.PUSHED_SCREEN_HEADER)).toBeVisible(); | ||
| await elementById(TestIDs.POP_BTN).tap(); | ||
| await expect(elementById(TestIDs.CENTER_SCREEN_HEADER)).toBeVisible(); | ||
| }); | ||
| describe(`Open mode '${openMode}'`, () => { | ||
| it('close SideMenu and push to stack with static id', async () => { | ||
| await elementById(TestIDs.OPEN_LEFT_SIDE_MENU_BTN).tap(); | ||
| await elementById(TestIDs.LEFT_SIDE_MENU_PUSH_BTN).tap(); | ||
| await elementById(TestIDs.CLOSE_LEFT_SIDE_MENU_BTN).tap(); | ||
| await expect(elementById(TestIDs.PUSHED_SCREEN_HEADER)).toBeVisible(); | ||
| await elementById(TestIDs.POP_BTN).tap(); | ||
| await expect(elementById(TestIDs.CENTER_SCREEN_HEADER)).toBeVisible(); | ||
| }); | ||
d4vidi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| it('side menu visibility - left', async () => { | ||
| await elementById(TestIDs.OPEN_LEFT_SIDE_MENU_BTN).tap(); | ||
| await elementById(TestIDs.CLOSE_LEFT_SIDE_MENU_BTN).tap(); | ||
| await expect(elementById(TestIDs.CLOSE_LEFT_SIDE_MENU_BTN)).toBeNotVisible(); | ||
| }); | ||
| it('Push to stack with static id and close SideMenu with screen options', async () => { | ||
| await elementById(TestIDs.OPEN_LEFT_SIDE_MENU_BTN).tap(); | ||
| await elementById(TestIDs.LEFT_SIDE_MENU_PUSH_AND_CLOSE_BTN).tap(); | ||
| await expect(elementById(TestIDs.PUSHED_SCREEN_HEADER)).toBeVisible(); | ||
| await elementById(TestIDs.POP_BTN).tap(); | ||
| await expect(elementById(TestIDs.CENTER_SCREEN_HEADER)).toBeVisible(); | ||
| }); | ||
|
|
||
| it('side menu visibility - right', async () => { | ||
| await elementById(TestIDs.OPEN_RIGHT_SIDE_MENU_BTN).tap(); | ||
| await elementById(TestIDs.CLOSE_RIGHT_SIDE_MENU_BTN).tap(); | ||
| await expect(elementById(TestIDs.CLOSE_RIGHT_SIDE_MENU_BTN)).toBeNotVisible(); | ||
| }); | ||
| it('side menu visibility - left', async () => { | ||
| await elementById(TestIDs.OPEN_LEFT_SIDE_MENU_BTN).tap(); | ||
| await elementById(TestIDs.CLOSE_LEFT_SIDE_MENU_BTN).tap(); | ||
| await expect(elementById(TestIDs.CLOSE_LEFT_SIDE_MENU_BTN)).toBeNotVisible(); | ||
| }); | ||
|
|
||
| it.e2e('should rotate', async () => { | ||
| await elementById(TestIDs.OPEN_LEFT_SIDE_MENU_BTN).tap(); | ||
| await device.setOrientation('landscape'); | ||
| await expect(elementById(TestIDs.LEFT_SIDE_MENU_PUSH_BTN)).toBeVisible(); | ||
| }); | ||
| it('side menu visibility - right', async () => { | ||
| await elementById(TestIDs.OPEN_RIGHT_SIDE_MENU_BTN).tap(); | ||
| await elementById(TestIDs.CLOSE_RIGHT_SIDE_MENU_BTN).tap(); | ||
| await expect(elementById(TestIDs.CLOSE_RIGHT_SIDE_MENU_BTN)).toBeNotVisible(); | ||
| }); | ||
|
|
||
| it.e2e(':ios: rotation should update drawer height', async () => { | ||
| await elementById(TestIDs.OPEN_LEFT_SIDE_MENU_BTN).tap(); | ||
| await expect(elementByLabel('left drawer height: 869')).toBeVisible(); | ||
| await device.setOrientation('landscape'); | ||
| await expect(elementByLabel('left drawer height: 428')).toBeVisible(); | ||
| await device.setOrientation('portrait'); | ||
| await expect(elementByLabel('left drawer height: 869')).toBeVisible(); | ||
| }); | ||
| it.e2e('should rotate', async () => { | ||
| await elementById(TestIDs.OPEN_LEFT_SIDE_MENU_BTN).tap(); | ||
| await device.setOrientation('landscape'); | ||
| await expect(elementById(TestIDs.LEFT_SIDE_MENU_PUSH_BTN)).toBeVisible(); | ||
| }); | ||
|
|
||
| it.e2e('should set left drawer width', async () => { | ||
| await elementById(TestIDs.OPEN_LEFT_SIDE_MENU_BTN).tap(); | ||
| await expect(elementById(TestIDs.SIDE_MENU_LEFT_DRAWER_HEIGHT_TEXT)).toBeVisible(); | ||
| await expect(elementByLabel('left drawer width: 250')).toBeVisible(); | ||
| }); | ||
| it.e2e(':ios: rotation should update drawer height', async () => { | ||
| await elementById(TestIDs.OPEN_LEFT_SIDE_MENU_BTN).tap(); | ||
| await expect(elementByLabel('left drawer height: 869')).toBeVisible(); | ||
| await device.setOrientation('landscape'); | ||
| await expect(elementByLabel('left drawer height: 428')).toBeVisible(); | ||
| await device.setOrientation('portrait'); | ||
| await expect(elementByLabel('left drawer height: 869')).toBeVisible(); | ||
| }); | ||
|
|
||
| it.e2e('should change left drawer width', async () => { | ||
| await elementById(TestIDs.CHANGE_LEFT_SIDE_MENU_WIDTH_BTN).tap(); | ||
| await elementById(TestIDs.OPEN_LEFT_SIDE_MENU_BTN).tap(); | ||
| await expect(elementByLabel('left drawer width: 50')).toBeVisible(); | ||
| }); | ||
| it.e2e('should set left drawer width', async () => { | ||
| await elementById(TestIDs.OPEN_LEFT_SIDE_MENU_BTN).tap(); | ||
| await expect(elementById(TestIDs.SIDE_MENU_LEFT_DRAWER_HEIGHT_TEXT)).toBeVisible(); | ||
| await expect(elementByLabel('left drawer width: 250')).toBeVisible(); | ||
| }); | ||
|
|
||
| it.e2e('should set right drawer width', async () => { | ||
| await elementById(TestIDs.OPEN_RIGHT_SIDE_MENU_BTN).tap(); | ||
| await expect(elementByLabel('right drawer width: 250')).toBeVisible(); | ||
| }); | ||
| it.e2e('should change left drawer width', async () => { | ||
| await elementById(TestIDs.CHANGE_LEFT_SIDE_MENU_WIDTH_BTN).tap(); | ||
| await elementById(TestIDs.OPEN_LEFT_SIDE_MENU_BTN).tap(); | ||
| await expect(elementByLabel('left drawer width: 50')).toBeVisible(); | ||
| }); | ||
|
|
||
| it.e2e('should set right drawer width', async () => { | ||
| await elementById(TestIDs.OPEN_RIGHT_SIDE_MENU_BTN).tap(); | ||
| await expect(elementByLabel('right drawer width: 250')).toBeVisible(); | ||
| }); | ||
|
|
||
| it.e2e('should change right drawer width', async () => { | ||
| await elementById(TestIDs.CHANGE_RIGHT_SIDE_MENU_WIDTH_BTN).tap(); | ||
| await elementById(TestIDs.OPEN_RIGHT_SIDE_MENU_BTN).tap(); | ||
| await expect(elementByLabel('right drawer width: 50')).toBeVisible(); | ||
| }); | ||
|
|
||
| it.e2e('should change right drawer width', async () => { | ||
| await elementById(TestIDs.CHANGE_RIGHT_SIDE_MENU_WIDTH_BTN).tap(); | ||
| await elementById(TestIDs.OPEN_RIGHT_SIDE_MENU_BTN).tap(); | ||
| await expect(elementByLabel('right drawer width: 50')).toBeVisible(); | ||
| it.e2e(':ios: should render side menu correctly', async () => { | ||
| await elementById(TestIDs.OPEN_LEFT_SIDE_MENU_BTN).tap(); | ||
| const snapshottedImagePath = `./e2e/assets/side_menu.${openMode}.png`; | ||
| const actual = await elementById('SideMenuContainer').takeScreenshot(`side_menu_${openMode}`); | ||
| expectImagesToBeEqual(actual, snapshottedImagePath); | ||
| }); | ||
| }); | ||
| }); | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.