Stefanie Uhl
Stefanie Uhl

Reputation: 324

protractor instance does not do anything

from one to anothet day i cannot interact with the angular page i am testing.

The only result i get:

Started
A Jasmine spec timed out. Resetting the WebDriver Control Flow.
F

the page has this:

<html lang="sv" class="no-js" data-ng-app="app">

So it should work, or not? I tried checking on iFrames and also enhanced the allScriptTimeout: 360000, but nothing helped.

here is my config:

var TIMEOUT = 360000;
var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
var reporter = new HtmlScreenshotReporter({
    dest: 'report/screenshots',
    filename: 'my-report.html'
});
exports.config = {
    seleniumAddress: 'http://dmc-l01-ap08.dmc.de:4448/wd/hub',
    baseUrl: 'https://int.system.com/',

    specs: [
        './UseCases/protractorTestcaseNightly.js',
    ],

    Capabilities: [
        {
            'browserName': 'chrome',
            shardTestFiles: false,
            maxInstances: 1,
            maxSessions: -1,
            restartBrowserBetweenTests: true,
        },
    ],

    getPageTimeout: TIMEOUT,
    allScriptsTimeout: TIMEOUT,
    jasmineNodeOpts: {
        showColors: true,
        defaultTimeoutInterval: TIMEOUT,
        includeStackTrace : true,
        isVerbose : true,
    },
    framework: "jasmine2",
    onPrepare: function () {
        browser.driver.manage().window().maximize();
        browser.driver.manage().deleteAllCookies();

        jasmine.getEnv().addReporter(reporter);

        var reporters = require('jasmine-reporters');
        var junitReporter = new reporters.JUnitXmlReporter({
            savePath: 'report/xml',
            consolidateAll: false,
            filePrefix: 'xmloutput'
        });
        jasmine.getEnv().addReporter(junitReporter);
    }
};

UPDATE: I added

rootElement: 'html',

to my config. But nothing changed. I also took a screenshot from the page before clicking the first element. In the screenshot i can see the element i want to click at.

this is my Testspec:

describe('Start testspec | ', function () {

    it('opens the start', function () {
        browser.get("/de-de/connect/").then(function () {
            console.log("1"); //works
            browser.executeScript('localStorage.clear();sessionStorage.clear();'); //works (?)
            console.log("2"); //works
            expect(element(by.xpath('//*[@class="btn-link"]'))).toBeTruthy(); //works
            console.log("3"); //works


            browser.sleep(3000);  //works
            element(by.css('.ms-linklist-typ-1 a')).click(); //DOES NOT WORK :(
            browser.sleep(3000); //works
        });
    });
});

I do have to click on the "btn-link" / css element, because this is the cookie layer, which has to be clicked first before i can reach any other element... any ideas?

Upvotes: 3

Views: 266

Answers (2)

Stefanie Uhl
Stefanie Uhl

Reputation: 324

it looks like i found the fix. My tests are running again by changing the versions of my installation. I looks like there is incompatibility between some version. It now works with:

Node LTS (6.10.0)
Selenium Server Standalone 3.0.1
[email protected]
[email protected]

Upvotes: 0

AdityaReddy
AdityaReddy

Reputation: 3645

Looks like you are using the timeout configuration incorrectly. allScriptTimeout is only for the backend application scripts is not for the overall Jasmine spec

Please take a look at the three timeouts explained below

So in your case you increase the jasmineNodeOpts.defaultTimeoutInterval to increase the timeout for overall spec

Try making the below change and see if this resolves the issue

   jasmineNodeOpts: {
        showColors: true,
        defaultTimeoutInterval: 120000,
        includeStackTrace : true,
        isVerbose : true,
    },

Also, Protractor assumes your angular-app root element to be body. Please see the below extract from the documentation below. Since your ng-app resides on a different element , may be update the config.js accordingly

/** * CSS Selector for the element housing the angular app - this defaults to * 'body', but is necessary if ng-app is on a descendant of . */

 rootElement?: string;

Upvotes: 1

Related Questions