angularjs - How can I use a different database for protractor e2e tests? -
i use database e2e tests , not use development database. need test login, in moment test using development database , not need, need create user in database , test login redirects dashboard , displays user information using node, angular, protractor , mongo. thanks
login.test.js
describe('login redirects dashboard , displays user email', function(){ it('should redirect dashboard , display user email', function() { var email = 'john@doe.com'; 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'] };
protractor doesnt database application using.it start testing application of url provided. if want test application on different environment,then need create copy of existing application point different test database , use copied version of application url in protractor test.
Comments
Post a Comment