10 Protractor Tips for Better End-to-End Tests

Reading Time: 1 minuteprotractor-logo

Protractor is an awesome way to write end-to-end tests for your Angular apps. You can write code that acts like an end user by running in a real browser.

In this series, we outline 10 tips for writing protractor tests:

  • Shardul Bagade

    “outputting browser logs” link is taking me to “taking screenshots” article..

  • Sameep Kaushik

    function getBillDetails(){
    var billtodateCharges: Array = new Array();
    var billtodateChargesName: Array = new Array();
    let counter = 0;
    //step 1 count the length of all the list inside the parent div.The value returns 10
    element.all(by.css(“#btd_panel_parent_div li”)).count().then((CountList) => {
    for (counter; counter {
    // billtodateCharges.push(getDivText);
    if (getSecondDivText.includes(“$”)) {
    //how to print each counter value here.Here in each loop display the CountList Value(9) but i need to display (0,1,2,3,4,5,6,7,8,9)
    console.log(“the class variable is ” + counter);//everytime prints 9
    console.log(“the second getText is ” + getSecondDivText);
    billtodateCharges.push(getSecondDivText);//How do i take the value outside of this scope

    }

    });
    element.all(by.css(“#ace_btd_ul_last_bill li”)).get(this.getElementric).all(by.tagName(“div”)).get(0).getText().then((getFirstDivText) => {
    //How do i print getSecondDiv text values here
    console.log(“the class variable is ” + this.getElementric);
    console.log(“the first getText is ” + getFirstDivText);
    billtodateChargesName.push(getFirstDivText);
    });
    this.getElementric++;

    }

    //console.log(“billcounter ” + billtodateCharges);
    });
    //How do i print getSecondDiv text values here
    // console.log(“billcounter xtereme ” + billtodateCharges);
    }