fix: screenshotting logic

This commit is contained in:
Lei Nelissen
2022-11-28 22:56:22 +01:00
parent 9c8e474d51
commit d4570b60ae
2 changed files with 6 additions and 11 deletions

View File

@@ -33,8 +33,8 @@ class FintunesUITests: XCTestCase {
app.otherElements["all-albums"].tap(); app.otherElements["all-albums"].tap();
snapshot("05AlbumsScreen"); snapshot("05AlbumsScreen");
app.buttons["search-tab"].tap(); app.buttons["search-tab"].tap();
app.textFields["search-input"].tap(); app.otherElements["search-input-container"].tap();
app.textFields["search-input"].typeText("bicep"); app.textFields["search-input-textinput"].typeText("bicep")
snapshot("03SearchScreen"); snapshot("03SearchScreen");
if app.otherElements["search-result-a644f8d23821601d2feb86ddae5e64f4"].waitForExistence(timeout: 5) { if app.otherElements["search-result-a644f8d23821601d2feb86ddae5e64f4"].waitForExistence(timeout: 5) {
app.otherElements["search-result-a644f8d23821601d2feb86ddae5e64f4"].tap(); app.otherElements["search-result-a644f8d23821601d2feb86ddae5e64f4"].tap();

View File

@@ -5,7 +5,7 @@ import useDefaultStyles from './Colors';
import { Gap } from './Utility'; import { Gap } from './Utility';
export interface InputProps extends TextInputProps { export interface InputProps extends TextInputProps {
icon?: React.ReactNode icon?: React.ReactNode;
} }
const Container = styled.Pressable` const Container = styled.Pressable`
@@ -21,26 +21,21 @@ const Container = styled.Pressable`
})} })}
`; `;
const InputWrapper = styled.TextInput` function Input({ icon = null, style, testID, ...rest }: InputProps) {
margin: 0;
padding: 0;
`;
function Input({ icon = null, style, ...rest }: InputProps) {
const defaultStyles = useDefaultStyles(); const defaultStyles = useDefaultStyles();
const inputRef = useRef<TextInput | null>(null); const inputRef = useRef<TextInput | null>(null);
const handlePress = useCallback(() => inputRef.current?.focus(), []); const handlePress = useCallback(() => inputRef.current?.focus(), []);
return ( return (
<Container style={[defaultStyles.input, style]} onPress={handlePress}> <Container style={[defaultStyles.input, style]} onPress={handlePress} testID={`${testID}-container`} accessible={false}>
{icon && ( {icon && (
<> <>
{icon} {icon}
<Gap size={8} /> <Gap size={8} />
</> </>
)} )}
<InputWrapper {...rest} ref={inputRef} /> <TextInput {...rest} style={{ margin: 0, padding: 0 }} ref={inputRef} testID={`${testID}-textinput`} />
</Container> </Container>
); );
} }