在为角度应用程序进行自动化测试时,我遇到一个问题,就是每当我尝试使用角度命令ng e2e
运行测试套件时,所有测试都会失败。量角器命令protractor conf.js
通过相同的测试。我想问这种奇怪行为的原因。提供了规范。
谢谢
import { AddMemberClass } from '../../pages/add-member/add-member.page';
import { LoginPage } from '../../pages/login/login.page';
import { browser, promise, by } from 'protractor';
fdescribe('Add Member as Admin',()=>{
let addMemeber: AddMemberClass;
let login : LoginPage;
beforeAll(()=>{
login = new LoginPage();
addMemeber = new AddMemberClass();
return new Promise((resolve)=>{
login.navigateTo().then(()=>{
login.getEmailInput().sendKeys('something@gmail.com');
login.getPasswordInput().sendKeys('13235');
login.getLoginButton().click().then(()=>{
setTimeout(()=>{
expect(browser.getCurrentUrl()).toContain('organization').then(()=>{
resolve();
});
},30000);
});
});
});
});
it('should login successfully', ()=>{
return addMemeber.getMemberMenu().click().then(()=>{
console.log('test1');
return addMemeber.getAddMemberSubMenu().click().then(()=>{
console.log('inside test 1');
return new Promise((resolve)=>{
setTimeout(()=>{
expect(browser.getCurrentUrl()).toContain('directregistration').then(()=>{
resolve();
});
},30000)
})
})
})
});
it('should check member Menu on main page',()=>{
return new Promise((resolve,reject)=>{
setTimeout(()=>{
console.log('Inside test 2 timeout');
expect(addMemeber.getMemberMenu().isPresent()).toBe(true);
resolve();
},5000)
});
});
})
});