这是我使用Field组件的代码:
interface EditProfileFormProps extends FormProps {
defaults: object;
submit: () => {};
initialValues: object;
roles: object[];
specialties: object[];
}
const EditProfileForm: React.StatelessComponent<EditProfileFormProps> = (props: EditProfileFormProps) => {
return (
<Form onSubmit={props.submit}>
<div>
<Field name="firstName" component={FirstName} type="text" />
</div>
<div>
<Field name="lastName" component={LastName} type="text" />
</div>
<div>
<Field name="role" props={{ roles: props.roles }} component={Role} type="select" />
</div>
</Form>
);
};
//FirstName.tsx
export const FirstName: React.StatelessComponent<React.InputHTMLAttributes<HTMLInputElement>> = ({
input,
}: React.InputHTMLAttributes<HTMLInputElement> & WrappedFieldProps) => (
<FormGroup>
<Label for="firstName">First Name</Label>
<Input {...input} type="text" …Run Code Online (Sandbox Code Playgroud)我正在尝试在我的 testcafe 测试运行时通过 rest API (Zephyr) 将测试标记为通过/失败。我想知道是否有可能在after或afterEach钩子中知道测试是否通过/失败,以便我可以根据结果运行一些脚本。
就像是:
test(...)
.after(async t => {
if(testFailed === true) { callApi('my test failed'); }
})Run Code Online (Sandbox Code Playgroud)