如何显示创建配置文件的用户名?

时间:2018-07-31 07:37:36

标签: protractor

嗨,我在量角器中创建了3个页面对象。添加员工(添加员工页面)后,我使用电子邮件ID(登录页面)登录,并希望获取仪表板页面中用户的个人资料名称。你能帮我这个忙吗?

  1. 添加员工页面

    var addEmployee_page = function(){
        this.firstName = function(fname){
        element(by.model('addnewemployee.empDetails.FirstName')).sendKeys(fname)
        };
        this.middleName = function(mname){
        element(by.model('addnewemployee.empDetails.MiddleName')).sendKeys(mname)
        };
        this.lastName = function(lname){
        element(by.model('addnewemployee.empDetails.LastName')).sendKeys(lname)
        };
        this.officialEmail = function(email){
        element(by.model('addnewemployee.empDetails.EmailId')).sendKeys(email)
        };
        this.clickSave = function(){
        element(by.css('[ng-click="addnewemployee.submit()"]')).click();
        };
        };
        module.exports = new addEmployee_page();
    
    2. loginpage.js
    
    var login_page = function(){
    this.enterFieldValue = function(username){
        element(by.model('account.username')).sendKeys(username);
    };
    this.enterFieldValue1 = function(password){
        element(by.model('account.password')).sendKeys(password);
    };
    this.clickSignin = function(){
        element(by.buttonText('Sign In')).click();
        return require('./Dashboard_page.js');
    };
    };
    module.exports = new login_page();
    

    3.Dashboard_page

    var login_page = require('../page/Login_page.js');
    var addEmployee_page = require('../page/AddEmployee_page.js');
    var dashboard_page = function(){
    this.verifyDashboardText = function(){
    element(by.css('[class="hidden-xs ng-binding"]')).getText().then(function(text){
    console.log("Dashboard verified Text-",text);
    if(text==Welcome to the xxxx application){
    console.log("Employee login verified successfully");
    }
    else{
    console.log("Login failed");
    }
    });
    };
    module.exports = new dashboard_page();
    

0 个答案:

没有答案