从 0.9.19 升级到 1.1.0 似乎破坏了 Page 对象
Upgrading from 0.9.19 to 1.1.0 seems to break Page objects
我有一个包含此代码的页面对象:
var MyToolComp = require('./MyToolComponent').MyToolComponent;
var MyToolCommand = {
get: function (cssLocator, timeout) {
return new MyToolComp({client: this, locator: cssLocator, timeout: timeout});
},
assertMyToolCount: function (expectedMyToolesCount, timeoutMs) {
console.log('Validate number of MyTool in the page to be [' + expectedMyToolesCount + ']');
this.waitForElementsCount(this.section.john_container.selector, expectedMyToolesCount, timeoutMs);
return this;
},
};
module.exports = {
commands: [MyToolCommand],
sections: {
john_container: {
selector: '.john_container',
elements: {
john_MyTool: {
selector: '.john_MyTool'
},
header: {
selector: '.john_MyTool_header'
}
}
},
multi_widget: {
selector: '.john_multi_widget'
}
}
};
升级到 1.1.0 后,我无法运行测试此代码:
var myToolPage = browser.page.myTool();
myToolPage.assertMyToolCount(1);
调试时,我看到 myToolPage 有 "section" 变量,但没有命令。
如果我删除部分并且只做
module.exports = MyToolCommand;
或
module.exports = {
commands: [MyToolCommand]
}
那我可以运行
myToolPage.assertMyToolCount(1);
但后来失败了
this.section.john_container.selector
未定义。
我做错了什么?我找不到任何东西 here or here。还有什么我可以阅读的东西可以帮助我吗?升级 NW 时我还应该知道什么? (这是我第一次看到与守夜人相关的东西,所以我有点必须边走边学)。
提前致谢:)
我解决这个问题的方法是替换
module.exports = {
commands: [MyToolCommand],
sections: {
john_container: {
selector: '.john_container',
elements: {
john_MyTool: {
selector: '.john_MyTool'
},
header: {
selector: '.john_MyTool_header'
}
}
},
multi_widget: {
selector: '.john_multi_widget'
}
}
};
有
exports.commands = MyToolCommand;
exports.sections = {
john_container: {
selector: '.john_container',
elements: {
john_MyTool: {
selector: '.john_MyTool'
},
header: {
selector: '.john_MyTool_header'
}
}
},
multi_widget: {
selector: '.john_multi_widget'
}
};
我有一个包含此代码的页面对象:
var MyToolComp = require('./MyToolComponent').MyToolComponent;
var MyToolCommand = {
get: function (cssLocator, timeout) {
return new MyToolComp({client: this, locator: cssLocator, timeout: timeout});
},
assertMyToolCount: function (expectedMyToolesCount, timeoutMs) {
console.log('Validate number of MyTool in the page to be [' + expectedMyToolesCount + ']');
this.waitForElementsCount(this.section.john_container.selector, expectedMyToolesCount, timeoutMs);
return this;
},
};
module.exports = {
commands: [MyToolCommand],
sections: {
john_container: {
selector: '.john_container',
elements: {
john_MyTool: {
selector: '.john_MyTool'
},
header: {
selector: '.john_MyTool_header'
}
}
},
multi_widget: {
selector: '.john_multi_widget'
}
}
};
升级到 1.1.0 后,我无法运行测试此代码: var myToolPage = browser.page.myTool(); myToolPage.assertMyToolCount(1);
调试时,我看到 myToolPage 有 "section" 变量,但没有命令。
如果我删除部分并且只做
module.exports = MyToolCommand;
或
module.exports = {
commands: [MyToolCommand]
}
那我可以运行
myToolPage.assertMyToolCount(1);
但后来失败了
this.section.john_container.selector
未定义。
我做错了什么?我找不到任何东西 here or here。还有什么我可以阅读的东西可以帮助我吗?升级 NW 时我还应该知道什么? (这是我第一次看到与守夜人相关的东西,所以我有点必须边走边学)。
提前致谢:)
我解决这个问题的方法是替换
module.exports = {
commands: [MyToolCommand],
sections: {
john_container: {
selector: '.john_container',
elements: {
john_MyTool: {
selector: '.john_MyTool'
},
header: {
selector: '.john_MyTool_header'
}
}
},
multi_widget: {
selector: '.john_multi_widget'
}
}
};
有
exports.commands = MyToolCommand;
exports.sections = {
john_container: {
selector: '.john_container',
elements: {
john_MyTool: {
selector: '.john_MyTool'
},
header: {
selector: '.john_MyTool_header'
}
}
},
multi_widget: {
selector: '.john_multi_widget'
}
};