Skip to content

Commit 4af3875

Browse files
committed
progress on Test432
1 parent 33f7a00 commit 4af3875

3 files changed

Lines changed: 31 additions & 10 deletions

File tree

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,27 @@
1-
import { device } from 'detox';
1+
import { device, expect, element, by } from 'detox';
22

3-
describe('Tests from PRs and issues', () => {
4-
beforeEach(async () => {
3+
describe('Test432', () => {
4+
beforeAll(async () => {
55
await device.reloadReactNative();
66
});
77

8+
it('should Test432 exist', async () => {
9+
await waitFor(element(by.id('root-screen-tests-Test432')))
10+
.toBeVisible()
11+
.whileElement(by.id('root-screen-examples-scrollview'))
12+
.scroll(100, 'down', NaN, 0.85);
13+
14+
await expect(element(by.id('root-screen-tests-Test432'))).toBeVisible();
15+
await element(by.id('root-screen-tests-Test432')).tap();
16+
});
17+
18+
19+
// home home-square
20+
// details details-red-square | click | details-green-square | click | details-red-square | back
21+
// info info-green-square-1 | click | info-red-square info-green-square-1 info-green-square-2 | click | info-green-square-1 | back
22+
// settings settings-square
23+
// za kazdym powrotem do home sprawdzic czarny square
24+
25+
26+
827
});

apps/src/shared/Square.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ import { View } from 'react-native';
44
interface Props {
55
color?: string;
66
size?: number;
7+
testID?: string;
78
}
89

910
export const Square = ({
1011
size = 100,
1112
color = 'red',
13+
testID,
1214
}: Props): React.JSX.Element => (
13-
<View style={{ width: size, height: size, backgroundColor: color }} />
15+
<View style={{ width: size, height: size, backgroundColor: color }} testID={testID} />
1416
);

apps/src/tests/Test432.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const DetailsScreen = ({ navigation }: StackScreenProps<'Details'>) => {
4545
navigation.setOptions({
4646
headerBackVisible: !x,
4747
headerRight: () =>
48-
x ? <Square size={20} color="green" /> : <Square size={10} />,
48+
x ? <Square size={20} color="green" testID="details-green-square" /> : <Square size={10} testID="details-red-square" />,
4949
});
5050
}, [navigation, x]);
5151

@@ -61,13 +61,13 @@ const InfoScreen = ({ navigation }: StackScreenProps<'Info'>) => {
6161

6262
const square1 = (props: { tintColor?: string }) => (
6363
<View style={{ gap: 8, flexDirection: 'row' }}>
64-
{hasLeftItem && <Square {...props} color="green" size={20} />}
65-
<Square {...props} color="green" size={20} />
64+
{hasLeftItem && <Square {...props} color="green" size={20} testID="info-green-square-2" />}
65+
<Square {...props} color="green" size={20} testID="info-green-square-1" />
6666
</View>
6767
);
6868

6969
const square2 = (props: { tintColor?: string }) => (
70-
<Square {...props} color="red" size={20} />
70+
<Square {...props} color="red" size={20} testID="info-red-square" />
7171
);
7272

7373
useLayoutEffect(() => {
@@ -95,7 +95,7 @@ const StackNavigator = () => {
9595
name="Home"
9696
component={HomeScreen}
9797
options={{
98-
headerRight: () => <Square size={20} color="black" />,
98+
headerRight: () => <Square size={20} color="black" testID="home-square" />,
9999
}}
100100
/>
101101
<Stack.Screen name="Details" component={DetailsScreen} />
@@ -112,7 +112,7 @@ const StackNavigator = () => {
112112
options={{
113113
presentation: 'modal',
114114
animation: 'slide_from_bottom',
115-
headerRight: () => <Square size={30} />,
115+
headerRight: () => <Square size={30} testID="settings-square" />,
116116
}}
117117
/>
118118
</Stack.Navigator>

0 commit comments

Comments
 (0)