Skip to content

Commit

Permalink
Update long timeout test to reflect how Detox actually works
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoNatan committed Feb 7, 2018
1 parent 0ec09f5 commit 44589fa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions detox/test/e2e/c-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Actions', () => {
});

it('should tap on an element at point', async () => {
await element(by.id('View7990')).tapAtPoint({x:180, y:140});
await element(by.id('View7990')).tapAtPoint({ x: 180, y: 140 });
await expect(element(by.id('UniqueId819'))).toHaveText('Taps: 1');
});

Expand Down Expand Up @@ -81,7 +81,7 @@ describe('Actions', () => {
await expect(element(by.text('PullToReload Working!!!'))).toBeVisible();
});

it('should wait for long timeout', async () => {
it.only('should not wait for long timeout (>1.5s)', async () => {
await element(by.id('WhyDoAllTheTestIDsHaveTheseStrangeNames')).tap();
await expect(element(by.id('WhyDoAllTheTestIDsHaveTheseStrangeNames'))).toBeVisible();
});
Expand Down
16 changes: 9 additions & 7 deletions detox/test/src/Screens/ActionsScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ export default class ActionsScreen extends Component {

<TouchableOpacity onPress={this.onButtonPress.bind(this, 'Tap Working')}
onLongPress={this.onButtonPress.bind(this, 'Long Press Working')}
>
>
<Text style={{ color: 'blue', marginBottom: 20, textAlign: 'center' }}>Tap Me</Text>
</TouchableOpacity>

<TouchableOpacity onPress={this.onLongTimeout.bind(this)}
>
>
<Text testID='WhyDoAllTheTestIDsHaveTheseStrangeNames' style={{ color: 'blue', marginBottom: 20, textAlign: 'center' }}>Tap Me For Long Timeout</Text>
</TouchableOpacity>

Expand All @@ -46,19 +46,19 @@ export default class ActionsScreen extends Component {
onChangeText={this.onChangeTypeText.bind(this)}
value={this.state.typeText}
testID='UniqueId937'
/>
/>

<TextInput style={{ height: 40, borderColor: 'gray', borderWidth: 1, marginBottom: 20, marginHorizontal: 20, padding: 5 }}
onChangeText={this.onChangeClearText.bind(this)}
value={this.state.clearText}
testID='UniqueId005'
/>
/>

<TextInput style={{ height: 40, borderColor: 'gray', borderWidth: 1, marginBottom: 20, marginHorizontal: 20, padding: 5 }}
onChangeText={this.onReplaceText.bind(this)}
value={this.state.replaceText}
testID='UniqueId006'
/>
/>

<View style={{ height: 100, borderColor: '#c0c0c0', borderWidth: 1, backgroundColor: '#f8f8ff', marginBottom: 20 }}>
<ScrollView testID='ScrollView161'>
Expand Down Expand Up @@ -100,9 +100,11 @@ export default class ActionsScreen extends Component {
});
}

onLongTimeout(greeting) {
onLongTimeout() {
setTimeout(() => {
greeting: 'Long Timeout Done'
this.setState({
greeting: "After Long Timeout"
});
}, 4000);
}

Expand Down

0 comments on commit 44589fa

Please sign in to comment.