-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Adds some initial tests for Touchable*. It only tests the first screen worth of examples; in a separate PR I'll work on an alternate way to "scroll" to individual examples in tests, before I add tests for the rest of the Touchable examples. On the live stream where I began writing these tests, I reorganized the "Touchable feedback examples" to the top of the list so it would be on-screen for testing. I didn't include this reorganization or test in this PR; that can be added in once the "alternative to scrolling" is added in, to avoid having to reorganize. Changelog: ---------- [General] [Added] - Add E2E tests for Touchable Pull Request resolved: #22570 Differential Revision: D13400348 Pulled By: TheSavior fbshipit-source-id: 821af135296049090427a16472cc14dabeb10ab4
- Loading branch information
1 parent
ee6b0d6
commit 1bc704d
Showing
2 changed files
with
133 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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,72 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @emails oncall+react_native | ||
* @format | ||
*/ | ||
|
||
/* global element, by, expect */ | ||
|
||
describe('Touchable', () => { | ||
beforeAll(async () => { | ||
await element(by.id('explorer_search')).replaceText('<Touchable*'); | ||
await element( | ||
by.label('<Touchable*> and onPress Touchable and onPress examples.'), | ||
).tap(); | ||
}); | ||
|
||
afterAll(async () => { | ||
//TODO - remove app state persistency, till then, we must go back to main screen, | ||
await element(by.label('Back')).tap(); | ||
}); | ||
|
||
it('Touchable Highlight should be tappable', async () => { | ||
const buttonID = 'touchable_highlight_image_button'; | ||
const button2ID = 'touchable_highlight_text_button'; | ||
const consoleID = 'touchable_highlight_console'; | ||
|
||
await element(by.id(buttonID)).tap(); | ||
await expect(element(by.id(consoleID))).toHaveText( | ||
'TouchableHighlight onPress', | ||
); | ||
|
||
await element(by.id(buttonID)).tap(); | ||
await expect(element(by.id(consoleID))).toHaveText( | ||
'2x TouchableHighlight onPress', | ||
); | ||
|
||
await element(by.id(button2ID)).tap(); | ||
await expect(element(by.id(consoleID))).toHaveText( | ||
'3x TouchableHighlight onPress', | ||
); | ||
}); | ||
|
||
it('Touchable Without Feedback should be tappable', async () => { | ||
const buttonID = 'touchable_without_feedback_button'; | ||
const consoleID = 'touchable_without_feedback_console'; | ||
|
||
await element(by.id(buttonID)).tap(); | ||
await expect(element(by.id(consoleID))).toHaveText( | ||
'TouchableWithoutFeedback onPress', | ||
); | ||
|
||
await element(by.id(buttonID)).tap(); | ||
await expect(element(by.id(consoleID))).toHaveText( | ||
'2x TouchableWithoutFeedback onPress', | ||
); | ||
}); | ||
|
||
it('Text should be tappable', async () => { | ||
const buttonID = 'tappable_text'; | ||
const consoleID = 'tappable_text_console'; | ||
|
||
await element(by.id(buttonID)).tap(); | ||
await expect(element(by.id(consoleID))).toHaveText('text onPress'); | ||
|
||
await element(by.id(buttonID)).tap(); | ||
await expect(element(by.id(consoleID))).toHaveText('2x text onPress'); | ||
}); | ||
}); |
This file contains 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