-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Add e2e tests, bug fixes for testIDs #22537
Closed
Closed
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8be4aa2
Add detox tests, bug fixes for testIDs
rickhanlonii 502fde6
Fix flow
rickhanlonii ddd4129
Remove test
rickhanlonii 673be06
rm scroll-view test id
rickhanlonii 69c62a7
Prettier
rickhanlonii 10e4a4a
Revert config field rename
rickhanlonii 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 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 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 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,65 @@ | ||
/** | ||
* 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('DatePickerIOS', () => { | ||
beforeAll(async () => { | ||
await element(by.id('explorer_search')).replaceText('<DatePickerIOS>'); | ||
await element( | ||
by.label( | ||
'<DatePickerIOS> Select dates and times using the native UIDatePicker.', | ||
), | ||
).tap(); | ||
}); | ||
|
||
afterAll(async () => { | ||
await element(by.label('Back')).tap(); | ||
}); | ||
|
||
it('Should change indicator with datetime picker', async () => { | ||
const testID = 'date-and-time'; | ||
const indicatorID = 'date-and-time-indicator'; | ||
|
||
const testElement = await element( | ||
by.type('UIPickerView').withAncestor(by.id(testID)), | ||
); | ||
const indicator = await element(by.id(indicatorID)); | ||
|
||
await expect(testElement).toBeVisible(); | ||
await expect(indicator).toBeVisible(); | ||
|
||
await testElement.setColumnToValue(0, 'Dec 4'); | ||
await testElement.setColumnToValue(1, '4'); | ||
await testElement.setColumnToValue(2, '10'); | ||
await testElement.setColumnToValue(3, 'AM'); | ||
|
||
await expect(indicator).toHaveText('12/4/2005 4:10 AM'); | ||
}); | ||
|
||
it('Should change indicator with date-only picker', async () => { | ||
const testID = 'date-only'; | ||
const indicatorID = 'date-and-time-indicator'; | ||
|
||
const testElement = await element( | ||
by.type('UIPickerView').withAncestor(by.id(testID)), | ||
); | ||
const indicator = await element(by.id(indicatorID)); | ||
|
||
await expect(testElement).toBeVisible(); | ||
await expect(indicator).toBeVisible(); | ||
|
||
await testElement.setColumnToValue(0, 'November'); | ||
await testElement.setColumnToValue(1, '3'); | ||
await testElement.setColumnToValue(2, '2006'); | ||
|
||
await expect(indicator).toHaveText('11/3/2006 4:10 AM'); | ||
}); | ||
}); |
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,30 @@ | ||
/** | ||
* 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('Picker', () => { | ||
beforeAll(async () => { | ||
await element(by.id('explorer_search')).replaceText('<Picker>'); | ||
await element( | ||
by.label( | ||
'<Picker> Provides multiple options to choose from, using either a dropdown menu or a dialog.', | ||
), | ||
).tap(); | ||
}); | ||
|
||
afterAll(async () => { | ||
await element(by.label('Back')).tap(); | ||
}); | ||
|
||
it('should be selectable by ID', async () => { | ||
await expect(element(by.id('basic-picker'))).toBeVisible(); | ||
}); | ||
}); |
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
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 |
---|---|---|
|
@@ -46,10 +46,13 @@ class DatePickerExample extends React.Component< | |
return ( | ||
<View> | ||
<WithLabel label="Value:"> | ||
<Text> | ||
<Text testID="date-and-time-indicator"> | ||
{this.state.date.toLocaleDateString() + | ||
' ' + | ||
this.state.date.toLocaleTimeString()} | ||
this.state.date.toLocaleTimeString([], { | ||
hour: '2-digit', | ||
minute: '2-digit', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I switched the formatting here since having seconds is non-deterministic |
||
})} | ||
</Text> | ||
</WithLabel> | ||
<WithLabel label="Timezone:"> | ||
|
@@ -62,20 +65,23 @@ class DatePickerExample extends React.Component< | |
</WithLabel> | ||
<Heading label="Date + time picker" /> | ||
<DatePickerIOS | ||
testID="date-and-time" | ||
date={this.state.date} | ||
mode="datetime" | ||
timeZoneOffsetInMinutes={this.state.timeZoneOffsetInHours * 60} | ||
onDateChange={this.onDateChange} | ||
/> | ||
<Heading label="Date picker" /> | ||
<DatePickerIOS | ||
testID="date-only" | ||
date={this.state.date} | ||
mode="date" | ||
timeZoneOffsetInMinutes={this.state.timeZoneOffsetInHours * 60} | ||
onDateChange={this.onDateChange} | ||
/> | ||
<Heading label="Time picker, 10-minute interval" /> | ||
<DatePickerIOS | ||
testID="time-only" | ||
date={this.state.date} | ||
mode="time" | ||
timeZoneOffsetInMinutes={this.state.timeZoneOffsetInHours * 60} | ||
|
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
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.
This is a Jest change that was printing a warning
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.
Can you do that in a separate commit?