-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']
};