Skip to content

Instantly share code, notes, and snippets.

@sidferreira
Created November 4, 2019 15:26
Show Gist options
  • Save sidferreira/ea637de661c710468fc57a1eb997cff9 to your computer and use it in GitHub Desktop.
Save sidferreira/ea637de661c710468fc57a1eb997cff9 to your computer and use it in GitHub Desktop.
Detox_iOS13_RN0.61_Issues
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React from 'react';
import {View, TextInput, Text} from 'react-native';
const App: () => React$Node = () => {
return (
<>
<View
style={{flex: 1, backgroundColor: 'cyan', padding: 60}}
testID="Ancestor">
<TextInput testID="Input" value="Input" style={style} accessible />
<TextInput
testID="InputSelectedStates"
value="InputSelectedStates"
accessibilityStates={['selected']}
style={style}
accessible
/>
<TextInput
testID="InputSelectedState"
value="InputSelectedState"
accessibilityState={{selected: true}}
style={style}
accessible
/>
<Text testID="Text" value="Text" style={style} accessible>
Text
</Text>
<Text
testID="TextSelectedStates"
value="TextSelectedStates"
accessibilityStates={['selected']}
style={style}
accessible>
TextSelectedStates
</Text>
<Text
testID="TextSelectedState"
value="TextSelectedState"
accessibilityState={{selected: true}}
style={style}
accessible>
TextSelectedState
</Text>
</View>
</>
);
};
const style = {
borderWidth: 5,
borderColor: 'green',
backgroundColor: 'green',
};
export default App;
/* eslint-disable no-undef */
describe('Input', () => {
beforeEach(async () => {
await device.reloadReactNative();
});
it('A', async () => {
await expect(element(by.id('Ancestor'))).toExist();
});
it('B', async () => {
await expect(element(by.id('Input'))).toExist();
});
it('C', async () => {
await expect(element(by.id('InputSelectedStates'))).toExist();
});
it('D', async () => {
await expect(element(by.id('InputSelectedState'))).toExist();
});
it('E', async () => {
// await expect(element(by.traits(['selected']))).toExist();
await expect(element(by.traits(['selected'])).atIndex(0)).toExist();
});
it('AB', async () => {
await expect(
element(by.id('Input').withAncestor(by.id('Ancestor'))),
).toExist();
});
it('AC', async () => {
await expect(
element(by.id('InputSelectedStates').withAncestor(by.id('Ancestor'))),
).toExist();
});
it('AD', async () => {
await expect(
element(by.id('InputSelectedState').withAncestor(by.id('Ancestor'))),
).toExist();
});
it('AE', async () => {
await expect(
element(by.id('Input').and(by.traits(['selected']))),
).toNotExist();
});
it('BE', async () => {
await expect(
element(by.id('InputSelectedStates').and(by.traits(['selected']))),
).toExist();
});
it('CE', async () => {
await expect(
element(by.id('InputSelectedState').and(by.traits(['selected']))),
).toExist();
});
});
Input
✓ A (81ms)
✓ B (73ms)
✓ C (68ms)
✓ D (70ms)
✓ E (69ms)
✓ AB (68ms)
✓ AC (71ms)
✓ AD (69ms)
✓ AE (75ms)
✕ BE (77ms)
✕ CE (77ms)
Text
✓ A (77ms)
✓ B (74ms)
✓ C (71ms)
✓ D (68ms)
✓ E (69ms)
✓ AB (72ms)
✓ AC (68ms)
✓ AD (68ms)
✓ AE (71ms)
✓ BE (70ms)
✓ CE (69ms)
/* eslint-disable no-undef */
describe('Text', () => {
beforeEach(async () => {
await device.reloadReactNative();
});
it('A', async () => {
await expect(element(by.id('Ancestor'))).toExist();
});
it('B', async () => {
await expect(element(by.id('Text'))).toExist();
});
it('C', async () => {
await expect(element(by.id('TextSelectedStates'))).toExist();
});
it('D', async () => {
await expect(element(by.id('TextSelectedState'))).toExist();
});
it('E', async () => {
await expect(element(by.traits(['selected'])).atIndex(0)).toExist();
});
it('AB', async () => {
await expect(
element(by.id('Text').withAncestor(by.id('Ancestor'))),
).toExist();
});
it('AC', async () => {
await expect(
element(by.id('TextSelectedStates').withAncestor(by.id('Ancestor'))),
).toExist();
});
it('AD', async () => {
await expect(
element(by.id('TextSelectedState').withAncestor(by.id('Ancestor'))),
).toExist();
});
it('AE', async () => {
await expect(
element(by.id('Text').and(by.traits(['selected']))),
).toNotExist();
});
it('BE', async () => {
await expect(
element(by.id('TextSelectedStates').and(by.traits(['selected']))),
).toExist();
});
it('CE', async () => {
await expect(
element(by.id('TextSelectedState').and(by.traits(['selected']))),
).toExist();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment