Using Data Objects while E2E testing with Protractor

你离开我真会死。 提交于 2019-12-06 05:24:05

I use hashes for my data objects. Here's an example from my protractor_example code on GitHub.

Given a data file:

var UserData = function() {
    this.testUser = {'username': 'test', 'password': 'test'};
};
module.exports = new UserData();

Then the spec...

describe ('non-angular login test', function() {
    var loginPage = require('../pages/nonAngularLoginPage.js');
    var userData = require('../data/userData.js');

    it('should goto friend pages on successful login', function() {
        loginPage.loginAs(userData.testUser);

        expect(browser.getTitle()).toContain('Angular JS Demo');
    });
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!