object - E2E Protractor:页面对象映射找不到模块
问题描述
目前,我正在尝试使用页面对象进行 e2e 测试以减少维护工作,并且我能够编写如下内容:
Test1-声明登录页面字段
var xxxx_Page_Mdemo = function () {
var companycode = element(by.id('company-code'));
var username = element(by.id('username'));
var password = element(by.id('password'));
var signclick = element(by.css('section>form>button'));
this.get = function () {
browser.get('https://xxxx.com');
};
this.setCompanycode = function (ccode) {
companycode.sendKeys(ccode);
};
this.setUsername = function (uname) {
username.sendKeys(uname);
};
this.setPassword = function (pasword) {
password.sendKeys(pasword);
};
this.setsignclick = function (signin) {
signclick.click(signin);
};
};
module.exports = new xxxx_Page_Mdemo();
测试2
var xxxxlogin_Page_Mdemo = require('./PageAdminuserlogsuper.js');
describe('xxlogin page', function () {
beforeEach(function () {
browser.waitForAngularEnabled(false);
});
afterEach(function () {
browser.executeScript('window.sessionStorage.clear();');
browser.executeScript('window.localStorage.clear();');
browser.restart();
});
it('should login to thexxx dashboard', function () {
login_Page_Mdemo.get();
var EC = protractor.ExpectedConditions;
browser.wait(EC.visibilityOf($('#company-code')))
.then(function () {
login_Page_Mdemo.setCompanycode('cc90');
login_Page_Mdemo.setUsername('xxxx.com');
xxxx_Page_Mdemo.setPassword('pass');
xxxx_Page_Mdemo.setsignclick();
browser.wait(EC.urlContains('https://.xxx.com/#/xxx/index'), 100000).then(function () {
console.log('xxxx');
browser.sleep(4000);
});
});
});
});
从那里我能够登录到特定页面,我的问题是我必须在登录后导航到应用程序内的其他字段并在单独的页面上执行一些点击。我已经为此创建了相同的页面对象,我无法将登录功能链接到我收到此错误。任何意见?
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
[09:25:28] E/launcher - Process exited with error code 100
Process finished with exit code 4
Empty test suite.
我的 conf 文件是这样的:
'./tests/MainObjects/PageAdminuserlogsuper.js',
'./tests/MainObjects/AdminuserlogPageobjectadopt.js',
'./tests/MainObjects/PageEmployeetemplatesuper.js',
'./tests/MainObjects/QE35CustomizeEmptemplate.js'
解决方案
推荐阅读
- javascript - 如何通过ajax调用数据来扩展表格行以获取更多信息
- python - 安装 PyAudio 给出错误“portaudio.h”文件未找到
- xml - Foreach 循环将元素添加到 XML
- python - Python 父文件夹导入
- typescript - 没有'new'就不能调用TypeORM类构造函数Guild
- visual-studio - Visual Studio 错误:运行所选代码生成器时出错
- python - 我可以避免循环遍历同一操作的向量(Python)吗?
- go - main.go 文件夹中“package main”标记为红色的错误
- java - 有没有办法可以将特定的子类设置为具有相对于父类中的变量的特定值?
- apache-spark - 数据框未显示文件夹路径的正确架构