CYPRESS_BASE_URL
对于运行相同代码的远程计算机,则某些测试失败。
我想我已经把范围缩小到了StencilJS组件的交互。考虑一下:我有一个表单,要求输入用户名、密码等,使用常规的
<input>
对于元素,即:
<input formControlName="username" type="text">
cy.get('[formControlName=fullname]').type(name)
cy.get('[formControlName=username]').type(username)
cy.get('[formControlName=password]').type(passwrod)
我有另一个表单,它使用了一个StencilJS组件,其中嵌入了
<输入>
,因此元素如下所示:
<my-input ngDefaultControl formControlName="newPassword" type="password"></my-input>
<my-input ngDefaultControl formControlName="confirmPassword" type="password"></my-input>
然后,我的代码尝试填充两个字段:
cy.get('[formControlName=newPassword]').find('input').type(updated_password).blur()
cy.get('[formControlName=confirmPassword]').find('input').type(updated_password).blur()
但在这里测试失败了:它实际做的是填写第一个密码,前进到第二个字段并填写第二个字段--但是第一个字段神秘地变成了空白!
Stencil组件是一个简单的
<
:
return (
<input type={ this.type }
value={ this.value }
placeholder={ this.placeholder }
onChange={ this.handleChange.bind(this) }></input>
);
.blur()
.
我试过了,有过也没有过
.then()
.
关于如何使这项工作可靠,还有其他建议吗?