从下面的代码中,我正在分配新值并在另一个黄瓜的Page对象方法中验证相同的值,但是我得到了 this.SelectedwheelValue" variable value as "
(即,在调用VerifyForWheelValueChange()
之后步骤定义方法),请帮助我解决此问题。
class Checkwheel {
constructor() {
this.SelectedwheelValue = "";
}
async assignwheel() {
const status = ['L', 'H', 'M', 'S'];
const actualvalue = await cy.xpath("//div[@name='model']").invoke('text').then(e => e)
.then((e) => {
return e;
})
.promisify();
for (let i = 0; i < status.length; i++) {
if (actualvalue !== status[i]) {
this.SelectedwheelValue = status[i];
break;
}
}
cy.xpath("//div[@name='model']").invoke('attr', 'title', this.SelectedwheelValue);
}
VerifyForWheelValueChange() {
cy.xpath("//div[@name='model']")
.should('have.attr', 'title', this.SelectedwheelValue);
}
}