-
-
Notifications
You must be signed in to change notification settings - Fork 661
chore(test): e2e test for test-tabs-general-appearance-android #4158
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
Open
LKuchno
wants to merge
17
commits into
main
Choose a base branch
from
@lkuchno/e2e-test-tabs-general-appearance-android
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+248
−3
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
3da80ad
first draft of appeaeance screen for android
LKuchno f793802
improved scenario
LKuchno c10b4f8
chore(test): test-tabs-general-appearance-android
LKuchno fb29c2d
changing typo in name appearance
LKuchno 77eaefd
changing typo in name appearance
LKuchno 2aa688e
changing typo in name appearance
LKuchno ace6591
applying remarks from review
LKuchno 38e3ed5
changign label to labels as it refers to plural
LKuchno c64210a
changing name from Tab Bar Appearance to Tab Bar General Appearance
LKuchno a3d0f5b
reordering imports
LKuchno 67b0330
changing test scenario title to Tab Bar General Appearance (Android)
LKuchno 1c4f090
removing spaces
LKuchno d9c8901
formatting and duplicated import fix
LKuchno ef1dd06
Merge branch 'main' of github.com:software-mansion/react-native-scree…
LKuchno f5be49c
chore(test): e2e test for test-tabs-general-appearance-android
LKuchno 5232e45
changing assertion to check on label not tab by itself
LKuchno 018335f
Merge branch 'main' of github.com:software-mansion/react-native-scree…
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
234 changes: 234 additions & 0 deletions
234
FabricExample/e2e/single-feature-tests/tabs/test-tabs-general-appearance-android.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,234 @@ | ||
| import { device, expect, element, by } from 'detox'; | ||
| import { | ||
| describeIfAndroid, | ||
| selectSingleFeatureTestsScreen, | ||
| } from '../../e2e-utils'; | ||
|
|
||
| async function selectLabelVisibilityMode( | ||
| mode: 'auto' | 'selected' | 'labeled' | 'unlabeled', | ||
| ) { | ||
| await element( | ||
| by.id('general-appearance-android-label-visibility-picker'), | ||
| ).tap(); | ||
| await element(by.id(`tabbaritemlabelvisibilitymode-${mode}`)).tap(); | ||
| await expect( | ||
| element(by.id('general-appearance-android-label-visibility-picker')), | ||
| ).toHaveLabel(`tabBarItemLabelVisibilityMode: ${mode}`); | ||
| await element( | ||
| by.id('general-appearance-android-label-visibility-picker'), | ||
| ).tap(); | ||
| } | ||
|
|
||
| describeIfAndroid( | ||
| 'Tab Bar General Appearance (Android) - tabBarItemLabelVisibilityMode', | ||
| () => { | ||
| beforeAll(async () => { | ||
| await device.reloadReactNative(); | ||
| await selectSingleFeatureTestsScreen( | ||
| 'Tabs', | ||
| 'test-tabs-general-appearance-android', | ||
| ); | ||
| await element(by.id('general-appearance-android-tab-label')).tap(); | ||
| }); | ||
|
|
||
| it('auto mode shows label only on the selected tab', async () => { | ||
| await expect( | ||
| element(by.id('general-appearance-android-label-visibility-picker')), | ||
| ).toHaveLabel('tabBarItemLabelVisibilityMode: auto'); | ||
|
|
||
| await expect( | ||
| element( | ||
| by | ||
| .text('Label') | ||
| .withAncestor(by.id('general-appearance-android-tab-label')), | ||
| ), | ||
| ).toBeVisible(); | ||
| await expect( | ||
| element( | ||
| by | ||
| .text('Default') | ||
| .withAncestor(by.id('general-appearance-android-tab-default')), | ||
| ), | ||
| ).not.toExist(); | ||
| await expect( | ||
| element( | ||
| by | ||
| .text('Ripple') | ||
| .withAncestor(by.id('general-appearance-android-tab-ripple')), | ||
| ), | ||
| ).not.toExist(); | ||
| await expect( | ||
| element( | ||
| by | ||
| .text('Indicator') | ||
| .withAncestor(by.id('general-appearance-android-tab-indicator')), | ||
| ), | ||
| ).not.toExist(); | ||
| }); | ||
|
|
||
| it('labeled mode makes all tab bar item titles visible', async () => { | ||
| await selectLabelVisibilityMode('labeled'); | ||
|
|
||
| await expect( | ||
| element( | ||
| by | ||
| .text('Default') | ||
| .withAncestor(by.id('general-appearance-android-tab-default')), | ||
| ), | ||
| ).toBeVisible(); | ||
| await expect( | ||
| element( | ||
| by | ||
| .text('Label') | ||
| .withAncestor(by.id('general-appearance-android-tab-label')), | ||
| ), | ||
| ).toBeVisible(); | ||
| await expect( | ||
| element( | ||
| by | ||
| .text('Ripple') | ||
| .withAncestor(by.id('general-appearance-android-tab-ripple')), | ||
| ), | ||
| ).toBeVisible(); | ||
| await expect( | ||
| element( | ||
| by | ||
| .text('Indicator') | ||
| .withAncestor(by.id('general-appearance-android-tab-indicator')), | ||
| ), | ||
| ).toBeVisible(); | ||
| }); | ||
|
|
||
| it('should fallback to default auto mode and persist custom label mode settings across tab switches', async () => { | ||
| await selectLabelVisibilityMode('labeled'); | ||
| await element(by.id('general-appearance-android-tab-default')).tap(); | ||
|
Copilot marked this conversation as resolved.
|
||
|
|
||
| await expect( | ||
| element( | ||
| by | ||
| .text('Default') | ||
| .withAncestor(by.id('general-appearance-android-tab-default')), | ||
| ), | ||
| ).toBeVisible(); | ||
| await expect( | ||
| element( | ||
| by | ||
| .text('Label') | ||
| .withAncestor(by.id('general-appearance-android-tab-label')), | ||
| ), | ||
| ).not.toExist(); | ||
| await expect( | ||
| element( | ||
| by | ||
| .text('Ripple') | ||
| .withAncestor(by.id('general-appearance-android-tab-ripple')), | ||
| ), | ||
| ).not.toExist(); | ||
| await expect( | ||
| element( | ||
| by | ||
| .text('Indicator') | ||
| .withAncestor(by.id('general-appearance-android-tab-indicator')), | ||
| ), | ||
| ).not.toExist(); | ||
|
|
||
| await element(by.id('general-appearance-android-tab-label')).tap(); | ||
|
|
||
| await expect( | ||
| element( | ||
| by | ||
| .text('Default') | ||
| .withAncestor(by.id('general-appearance-android-tab-default')), | ||
| ), | ||
| ).toBeVisible(); | ||
| await expect( | ||
| element( | ||
| by | ||
| .text('Label') | ||
| .withAncestor(by.id('general-appearance-android-tab-label')), | ||
| ), | ||
| ).toBeVisible(); | ||
| await expect( | ||
| element( | ||
| by | ||
| .text('Ripple') | ||
| .withAncestor(by.id('general-appearance-android-tab-ripple')), | ||
| ), | ||
| ).toBeVisible(); | ||
| await expect( | ||
| element( | ||
| by | ||
| .text('Indicator') | ||
| .withAncestor(by.id('general-appearance-android-tab-indicator')), | ||
| ), | ||
| ).toBeVisible(); | ||
|
Copilot marked this conversation as resolved.
|
||
| }); | ||
|
|
||
| it('unlabeled mode hides all tab bar item titles', async () => { | ||
| await selectLabelVisibilityMode('unlabeled'); | ||
|
|
||
| await expect( | ||
| element( | ||
| by | ||
| .text('Label') | ||
| .withAncestor(by.id('general-appearance-android-tab-label')), | ||
| ), | ||
| ).not.toExist(); | ||
| await expect( | ||
| element( | ||
| by | ||
| .text('Default') | ||
| .withAncestor(by.id('general-appearance-android-tab-default')), | ||
| ), | ||
| ).not.toExist(); | ||
| await expect( | ||
| element( | ||
| by | ||
| .text('Ripple') | ||
| .withAncestor(by.id('general-appearance-android-tab-ripple')), | ||
| ), | ||
| ).not.toExist(); | ||
| await expect( | ||
| element( | ||
| by | ||
| .text('Indicator') | ||
| .withAncestor(by.id('general-appearance-android-tab-indicator')), | ||
| ), | ||
| ).not.toExist(); | ||
| }); | ||
|
|
||
| it('selected mode shows label only on the selected tab', async () => { | ||
| await selectLabelVisibilityMode('selected'); | ||
|
|
||
| await expect( | ||
| element( | ||
| by | ||
| .text('Label') | ||
| .withAncestor(by.id('general-appearance-android-tab-label')), | ||
| ), | ||
| ).toBeVisible(); | ||
|
|
||
| await expect( | ||
| element( | ||
| by | ||
| .text('Default') | ||
| .withAncestor(by.id('general-appearance-android-tab-default')), | ||
| ), | ||
| ).not.toExist(); | ||
| await expect( | ||
| element( | ||
| by | ||
| .text('Ripple') | ||
| .withAncestor(by.id('general-appearance-android-tab-ripple')), | ||
| ), | ||
| ).not.toExist(); | ||
| await expect( | ||
| element( | ||
| by | ||
| .text('Indicator') | ||
| .withAncestor(by.id('general-appearance-android-tab-indicator')), | ||
| ), | ||
| ).not.toExist(); | ||
| }); | ||
| }, | ||
| ); | ||
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.
Uh oh!
There was an error while loading. Please reload this page.