Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions FabricExample/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ PLATFORMS
DEPENDENCIES
activesupport (>= 6.1.7.5, != 7.1.0)
cocoapods (>= 1.13, != 1.15.1, != 1.15.0)
xcodeproj (< 1.26.0)
Comment thread
kkafar marked this conversation as resolved.

RUBY VERSION
ruby 3.2.1p31
Expand Down
111 changes: 111 additions & 0 deletions FabricExample/e2e/examplesTests/tests.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import { device, expect, element, by } from 'detox';

describe('Test432', () => {
beforeAll(async () => {
await device.reloadReactNative();
});

it('should Test432 exist', async () => {
Comment thread
kligarski marked this conversation as resolved.
Outdated
await waitFor(element(by.id('root-screen-tests-Test432')))
.toBeVisible()
.whileElement(by.id('root-screen-examples-scrollview'))
.scroll(600, 'down', NaN, 0.85);

await expect(element(by.id('root-screen-tests-Test432'))).toBeVisible();
await element(by.id('root-screen-tests-Test432')).tap();
});

it('home-square should be fully visible', async () => {
Comment thread
kligarski marked this conversation as resolved.
Outdated
await expect(element(by.id('home-square'))).toBeVisible(100);
});

it('squares from details screen should be fully visible', async () => {
Comment thread
kligarski marked this conversation as resolved.
Outdated
await element(by.id('go-to-details')).tap();
await expect(element(by.id('details-red-square'))).toBeVisible(100);

await element(by.id('details-toggle-subviews')).tap();
Comment thread
kligarski marked this conversation as resolved.
Outdated
// On Android, we need to wait for some elements (e.g. at first, this square is only 25% visible)
waitFor(element(by.id('details-green-square'))).toBeVisible(100);

await element(by.id('details-toggle-subviews')).tap();
await expect(element(by.id('details-red-square'))).toBeVisible(100);

if (device.getPlatform() === 'ios') {
await element(by.id('BackButton')).tap();
} else {
await device.pressBack();
}

await expect(element(by.id('home-square'))).toBeVisible(100);
});

it('squares from info screen should be fully visible', async () => {
await element(by.id('go-to-info')).tap();
await expect(element(by.id('info-green-square-1'))).toBeVisible(100);

await element(by.id('info-toggle-subviews')).tap();
waitFor(element(by.id('info-green-square-1'))).toBeVisible(100);
waitFor(element(by.id('info-green-square-2'))).toBeVisible(100);
waitFor(element(by.id('info-red-square'))).toBeVisible(100);

await element(by.id('info-toggle-subviews')).tap();
waitFor(element(by.id('info-green-square-1'))).toBeVisible(100);

if (device.getPlatform() === 'ios') {
await element(by.id('BackButton')).tap();
} else {
await device.pressBack();
}

await expect(element(by.id('home-square'))).toBeVisible(100);
});

it('squares from settings screen should be fully visible', async () => {
await element(by.id('show-settings')).tap();
await expect(element(by.id('settings-square'))).toBeVisible(100);

if (device.getPlatform() === 'ios') {
await element(by.id('settings-text')).swipe('down', 'fast');
} else {
await device.pressBack();
}
await expect(element(by.id('home-square'))).toBeVisible(100);
});
});

// Detox currently supports orientation only on iOS
if (device.getPlatform() === 'ios') {
describe('Test528', () => {
beforeAll(async () => {
await device.reloadReactNative();
});

it('should Test528 exist', async () => {
await waitFor(element(by.id('root-screen-tests-Test528')))
.toBeVisible()
.whileElement(by.id('root-screen-examples-scrollview'))
.scroll(600, 'down', NaN, 0.85);

await expect(element(by.id('root-screen-tests-Test528'))).toBeVisible();
await element(by.id('root-screen-tests-Test528')).tap();
});

it('displays headerRight button after orientation change on Screen1', async () => {
await expect(element(by.text('Custom Button'))).toBeVisible(100);
await device.setOrientation('landscape');
await expect(element(by.text('Custom Button'))).toBeVisible(100);
await device.setOrientation('portrait');
await expect(element(by.text('Custom Button'))).toBeVisible(100);
});

it('displays headerRight button on Screen1 after orientation change on Screen2', async () => {
await element(by.text('Go to Screen 2')).tap();
await device.setOrientation('landscape');
await element(by.id('BackButton')).tap();
await expect(element(by.text('Custom Button'))).toBeVisible(100);
await device.setOrientation('portrait');
await expect(element(by.text('Custom Button'))).toBeVisible(100);
});
});
}

8 changes: 4 additions & 4 deletions FabricExample/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1733,7 +1733,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- RNScreens (4.10.0-beta.3):
- RNScreens (4.10.0):
- DoubleConversion
- glog
- hermes-engine
Expand All @@ -1754,9 +1754,9 @@ PODS:
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- RNScreens/common (= 4.10.0-beta.3)
- RNScreens/common (= 4.10.0)
- Yoga
- RNScreens/common (4.10.0-beta.3):
- RNScreens/common (4.10.0):
- DoubleConversion
- glog
- hermes-engine
Expand Down Expand Up @@ -2075,7 +2075,7 @@ SPEC CHECKSUMS:
ReactCommon: 179964ffc47fa62ad0e1eebac704e88c59b46667
RNGestureHandler: 4e7defe5095e936424173fc75f0bf2af5bba8e23
RNReanimated: 183ca222293bd622678e387100e54d03d952c73b
RNScreens: b40d97d6ad4b6f1f55552bed30b845ae01ff3d2c
RNScreens: 0f01bbed9bd8045a8d58e4b46993c28c7f498f3c
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
Yoga: 330be28eee1242da875db9e851b19a4df496b999

Expand Down
4 changes: 3 additions & 1 deletion apps/src/shared/Square.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import { View } from 'react-native';
interface Props {
color?: string;
size?: number;
testID?: string;
}

export const Square = ({
size = 100,
color = 'red',
testID,
}: Props): React.JSX.Element => (
<View style={{ width: size, height: size, backgroundColor: color }} />
<View style={{ width: size, height: size, backgroundColor: color }} testID={testID} />
);
33 changes: 25 additions & 8 deletions apps/src/tests/Test432.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,17 @@ const HomeScreen = ({ navigation }: StackScreenProps<'Home'>) => {
<Button
title={'Go to details'}
onPress={() => navigation.navigate('Details')}
testID="go-to-details"
/>
<Button
title={'Go to info'}
onPress={() => navigation.navigate('Info')}
testID="go-to-info"
/>
<Button
title={'Show settings'}
onPress={() => navigation.navigate('Settings')}
testID="show-settings"
/>
</View>
);
Expand All @@ -45,29 +48,40 @@ const DetailsScreen = ({ navigation }: StackScreenProps<'Details'>) => {
navigation.setOptions({
headerBackVisible: !x,
headerRight: () =>
x ? <Square size={20} color="green" /> : <Square size={10} />,
x ? (
<Square size={20} color="green" testID="details-green-square" />
) : (
<Square size={10} testID="details-red-square" />
),
});
}, [navigation, x]);

return <Button title="Toggle subviews" onPress={() => setX(prev => !prev)} />;
return <Button title="Toggle subviews" onPress={() => setX(prev => !prev)} testID='details-toggle-subviews' />;
};

const SettingsScreen = () => {
return <Text>Settings</Text>;
return <Text testID='settings-text'>Settings</Text>;
};

const InfoScreen = ({ navigation }: StackScreenProps<'Info'>) => {
const [hasLeftItem, setHasLeftItem] = useState(false);

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

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

useLayoutEffect(() => {
Expand All @@ -82,6 +96,7 @@ const InfoScreen = ({ navigation }: StackScreenProps<'Info'>) => {
<Button
title="Toggle subviews"
onPress={() => setHasLeftItem(prev => !prev)}
testID='info-toggle-subviews'
/>
);
};
Expand All @@ -95,7 +110,9 @@ const StackNavigator = () => {
name="Home"
component={HomeScreen}
options={{
headerRight: () => <Square size={20} color="black" />,
headerRight: () => (
<Square size={20} color="black" testID="home-square" />
),
}}
/>
<Stack.Screen name="Details" component={DetailsScreen} />
Expand All @@ -112,7 +129,7 @@ const StackNavigator = () => {
options={{
presentation: 'modal',
animation: 'slide_from_bottom',
headerRight: () => <Square size={30} />,
headerRight: () => <Square size={30} testID="settings-square" />,
}}
/>
</Stack.Navigator>
Expand Down
14 changes: 7 additions & 7 deletions apps/src/tests/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// @ts-nocheck

export { default as Test42 } from './Test42';
export { default as Test111 } from './Test111';
export { default as Test263 } from './Test263';
export { default as Test349 } from './Test349';
export { default as Test364 } from './Test364';
export { default as Test432 } from './Test432';
export { default as Test528 } from './Test528';
export { default as Test42 } from './Test42'; // [E2E skipped]: can't check orientation, unclear problem description
export { default as Test111 } from './Test111'; // [E2E skipped]: can't check flickering
export { default as Test263 } from './Test263'; // [E2E skipped]: example differs from PR, even if changed the problem still occurs
export { default as Test349 } from './Test349'; // [E2E skipped]: can't check autofill easily, wrong prop name
export { default as Test364 } from './Test364'; // [E2E skipped]: tabBarVisible prop doesn't exist anymore, suggested solution is to change navigator hierarchy (proposed in PR and in react-navigation docs)
export { default as Test432 } from './Test432'; // [E2E created]
export { default as Test528 } from './Test528'; // [E2E created](iOS): Detox supports changing orientation only on iOS
export { default as Test550 } from './Test550';
export { default as Test556 } from './Test556';
export { default as Test564 } from './Test564';
Expand Down
Loading