如何解决包括:依赖项注入CodeceptJS / Puppeteer-缺少什么?
我显然缺少与CodeceptJS和Puppeteer依赖注入有关的东西。我正在尝试关注文档,但尚未成功。
目标:创建页面对象类,从我的测试场景访问该页面对象类中的方法。
简单的测试用例
Feature('Common logon/logoff scenarios');
Scenario.only('Test drawer class',(I,loginAs,menu) => {
I.amOnPage('/login');
loginAs('admin');
menu.dashboard();
});
包含我的codeceptjs.config.js文件中的部分
include: {
I: "./steps_file.js",menu: "./src/fragments/menu.js"
},
菜单页面对象类(menu.js)
const { I } = inject();
module.exports = {
// Navigation drawer locators
item: {
dashboard: 'a[href="#/"]',admin: 'li[id="resources.admin.name"]',permissions: 'a[href="#/user-claims"]',sites: 'a[href="#/site"]',reportTemplates: 'a[href="#/reporttemplates"]',stations: 'a[href="#/station"]',supervisor: 'li[id="resources.supervisor.name"]',people: 'a[href="#/people"]',supervisorPressPallets: 'a[href="#/presspalletbuilder"]',stationIdentify: 'a[href="#/stationadopt"]',operator: 'li[id="resources.operator.name"]',operatorPressPallets: 'a[href="resources.operator.name"]'
},// Methods to access nav drawer menu items
dashboard() {
I.click(this.item.dashboard);
},admin() {
I.click(this.item.admin);
},permissions() {
I.click(this.item.permissions);
},sites() {
I.click(this.item.sites);
},reportTemplates() {
I.click(this.item.reportTemplates);
},stations() {
I.click(this.item.stations);
},supervisor() {
I.click(this.item.supervisor);
},people() {
I.click(this.item.people);
},supervisorPressPallets() {
I.click(this.item.supervisorPressPallets);
},stationIdentify() {
I.click(this.item.stationIdentify);
},operator() {
I.click(this.item.operator);
},operatorPressPallets() {
I.click(this.item.operatorPressPallets);
}
}
当我尝试运行测试时,出现以下错误
1) Common logon/logoff scenarios
Test drawer class:
Cannot read property 'react' of undefined
在这里我所缺少的任何帮助将不胜感激。
谢谢,全部
鲍勃
解决方法
结果证明我输入的代码正确无误,这最终导致我的编辑器无法很好地完成代码补全,因此感兴趣的方法无法按我期望的方式显示。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。