我正在尝试在 ios UITest 中编辑 TextInput React Native 组件的文本。我已将testID道具添加到组件中。
两个问题:
应用程序.js
import React from "react";
import { StyleSheet, TextInput, View } from "react-native";
export default function App() {
return (
<View>
<TextInput testID="username" placeholder="Enter your username" />
</View>
);
}
Run Code Online (Sandbox Code Playgroud)
TestappUITests.swift
import XCTest
class TestappUITests: XCTestCase {
...
func testExample() {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launch()
// Write test code …Run Code Online (Sandbox Code Playgroud)