-
-
Notifications
You must be signed in to change notification settings - Fork 643
chore(test): e2e and scenario for tabs specialEffects scrollToTop #3953
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
LKuchno
merged 7 commits into
main
from
@lkuchno/e2e-test-tabs-special-effects-scroll-to-top
Apr 30, 2026
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
73c25ab
adding new functions - describeIfAndroid, tapSelectedTab
LKuchno a8e0642
new e2e test and changes for it in scenario and index file
LKuchno 5df5582
Update FabricExample/e2e/e2e-utils.ts
LKuchno fdc7b0a
change function in e2e-utils file and add platform handler to test
LKuchno c11e5af
Merge branch '@lkuchno/e2e-test-tabs-special-effects-scroll-to-top' o…
LKuchno 0beb695
Update FabricExample/e2e/single-feature-tests/tabs/test-tabs-special-…
LKuchno d732793
Update FabricExample/e2e/e2e-utils.ts
LKuchno 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
87 changes: 87 additions & 0 deletions
87
FabricExample/e2e/single-feature-tests/tabs/test-tabs-special-effects-scroll-to-top.e2e.ts
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 |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| import { device, expect, element, by } from 'detox'; | ||
| import { | ||
| selectSingleFeatureTestsScreen, | ||
| forceTapByLabeliOS, | ||
| } from '../../e2e-utils'; | ||
|
|
||
| async function forceSelectTabByLabel(label: string) { | ||
|
LKuchno marked this conversation as resolved.
|
||
| if (device.getPlatform() === 'ios') { | ||
| await forceTapByLabeliOS(label); | ||
| } else { | ||
| await element(by.label(label)).tap(); | ||
| } | ||
| } | ||
|
|
||
| describe('Tabs specialEffects — scrollToTop', () => { | ||
| beforeAll(async () => { | ||
| await device.reloadReactNative(); | ||
| await selectSingleFeatureTestsScreen( | ||
| 'Tabs', | ||
| 'test-tabs-special-effects-scroll-to-top', | ||
| ); | ||
|
Comment on lines
+19
to
+25
|
||
| }); | ||
|
|
||
| it('should display tab bar and Tab1 scrollable list on load', async () => { | ||
| await expect(element(by.id('tab1-scrollview'))).toBeVisible(); | ||
| await expect(element(by.id('tab1-item-1'))).toBeVisible(); | ||
| if (device.getPlatform() === 'ios') { | ||
| await expect(element(by.type('UITabBar'))).toBeVisible(); | ||
| } else { | ||
| await expect(element(by.id('tab1-tab-item'))).toBeVisible(); | ||
| await expect(element(by.id('tab2-tab-item'))).toBeVisible(); | ||
| await expect(element(by.id('tab3-tab-item'))).toBeVisible(); | ||
| } | ||
| }); | ||
|
|
||
| it('Tab1 (scrollToTop: true) — re-tapping active tab scrolls list back to top', async () => { | ||
| await element(by.id('tab1-scrollview')).scroll(300, 'down', NaN, 0.85); | ||
| await expect(element(by.id('tab1-item-1'))).not.toBeVisible(); | ||
|
|
||
| await forceSelectTabByLabel('tab1-tab-item-label'); | ||
|
|
||
| await waitFor(element(by.id('tab1-item-1'))) | ||
| .toBeVisible() | ||
| .withTimeout(3000); | ||
| }); | ||
|
|
||
| it('Tab2 (scrollToTop: false) — re-tapping active tab preserves scroll position', async () => { | ||
| await element(by.id('tab2-tab-item')).tap(); | ||
| await expect(element(by.id('tab2-item-1'))).toBeVisible(); | ||
|
|
||
| await element(by.id('tab2-scrollview')).scroll(300, 'down', NaN, 0.85); | ||
| await expect(element(by.id('tab2-item-1'))).not.toBeVisible(); | ||
|
|
||
| await forceSelectTabByLabel('tab2-tab-item-label'); | ||
|
|
||
| await expect(element(by.id('tab2-item-1'))).not.toBeVisible(); | ||
| }); | ||
|
|
||
| it('Tab3 (no specialEffects) — re-tapping active tab scrolls list back to top', async () => { | ||
| await element(by.id('tab3-tab-item')).tap(); | ||
| await expect(element(by.id('tab3-item-1'))).toBeVisible(); | ||
|
|
||
| await element(by.id('tab3-scrollview')).scroll(300, 'down', NaN, 0.85); | ||
| await expect(element(by.id('tab3-item-1'))).not.toBeVisible(); | ||
|
|
||
| await forceSelectTabByLabel('tab3-tab-item-label'); | ||
|
|
||
| await waitFor(element(by.id('tab3-item-1'))) | ||
| .toBeVisible() | ||
| .withTimeout(3000); | ||
| }); | ||
|
|
||
| it('Tab1 (scrollToTop: true) — switching away and back preserves scroll position', async () => { | ||
| await forceSelectTabByLabel('tab1-tab-item-label'); | ||
| await expect(element(by.id('tab1-item-1'))).toBeVisible(); | ||
|
|
||
| await element(by.id('tab1-scrollview')).scroll(300, 'down', NaN, 0.85); | ||
| await expect(element(by.id('tab1-item-1'))).not.toBeVisible(); | ||
|
|
||
| await forceSelectTabByLabel('tab3-tab-item-label'); | ||
| await expect(element(by.id('tab3-item-1'))).toBeVisible(); | ||
|
|
||
| await forceSelectTabByLabel('tab1-tab-item-label'); | ||
|
|
||
| await expect(element(by.id('tab1-item-1'))).not.toBeVisible(); | ||
| }); | ||
| }); | ||
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
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.
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 don't think that we can really do anything about it.
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 was already trying to get rid of it and it didn't work so I kept it in this form.