-2
我想只为我的e2e测试使用数据库,并且不使用我的开发数据库。 我需要测试登录,在这一刻测试使用我的开发数据库,并不是我所需要的,我需要在数据库中创建一个用户,然后测试登录重定向到仪表板并显示用户信息 我正在使用节点,角度,量角器和mongo。 感谢如何为量角器e2e测试使用不同的数据库?
login.test.js
describe('login redirects to dashboard and displays user email', function(){
it('should redirect to dashboard and display user email', function() {
var email = '[email protected]';
browser.get('http://localhost:3000/#/login');
element(by.id('username')).sendKeys(email);
element(by.id('password')).sendKeys('none123');
element(by.id('submit-form')).click();
expect(browser.getCurrentUrl()).toBe('http://localhost:3000/#/dashboard');
expect(element(by.css('.username')).getText()).toEqual('Hi, ' + email);
});
});
conf.js
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['*.test.js']
};