El Nubro
El Nubro

Reputation: 624

Protractor test not working with IE but it does with FF/Chrome/Safari

I'm currently dealing with a problem with my protractor test against IE.

I'm using Protractor + Jasmine + Node.js

The portion of page that I'm testing is the following:

<h2 collapser="" class="title text-center text-uppercase active">Tech Specs <i class="plus-icon"></i></h2>

I've the following test:

it('User should be able to see module 11 Tech Specs collapsing and uncolapsing', function () {
    basePage.techSpecCollapser.click();
    browser.sleep(1000);
    expect(basePage.techSpecContainer.isDisplayed()).toBeTruthy();

});

This is the console output:

 Landing page module verification -->
  User should be able to see module 11 Tech Specs collapsing and uncollapsing - fail


  1) New Landing page module verification --> User should be able to see module 11 Tech Specs collapsing and uncolapsing
  at 15.446s [Thu, 28 May 2015 14:23:08 GMT]
   Message:
     Expected false to be truthy.
   Stacktrace:
     Error: Failed expectation
    at [object Object].<anonymous> (/Users/test/Documents/Dev/test/sandBox/specs/landing_page_spec.js:44:58)

Finished in 15.448 seconds
1 test, 1 assertion, 1 failure

By watching the test running, I saw that part of the web page is not getting displayed. I tried:

Did anyone run into the same issue? can make it to work and it's very simple test!

Upvotes: 1

Views: 1331

Answers (1)

alecxe
alecxe

Reputation: 473803

There are multiple things you can try to solve it:

  • maximize the browser window before running the tests. Add this to onPrepare():

    browser.driver.manage().window().maximize();
    
  • remove the unreliable browser.sleep() and explicitly wait for the element to become visible with visibilityOf expected condition:

    var EC = protractor.ExpectedConditions;
    basePage.techSpecCollapser.click();
    browser.wait(EC.visibilityOf(basePage.techSpecContainer), 10000);
    
  • move to the element:

    browser.executeScript("arguments[0].scrollIntoView();", basePage.techSpecContainer.getWebElement());
    

Upvotes: 1

Related Questions