0

I am currently designing a protractor script that will allow me to connect to any website in order to perform daily tests to see if our platform works properly.

For that, we used BrowserStack which will allow us to make E2E tests and also check if our platform is compatible on all our formats (possibly see if there are bugs).

Being a beginner on this technology, I am currently experiencing a bug, which has been bothering me since this morning. My script generates a lot of errors and it doesn't work on some platforms.

I will let you see in detail what I have been able to develop at the moment. Nothing complicated indeed.

File test.conf.js:

exports.config = {
    'specs': [ 'lavan/single.js' ],
    'seleniumAddress': 'http://hub-cloud.browserstack.com/wd/hub',

    'commonCapabilities': {
        'browserstack.user': process.env.BROWSERSTACK_USERNAME || 'BROWSERSTACK_USERNAME',
        'browserstack.key': process.env.BROWSERSTACK_ACCESS_KEY || 'BROWSERSTACK_ACCESS_KEY',
        'build': 'SmartscreeningIO',
        'name': 'Connexion',
        'browserstack.local': true,
        'browserstack.debug': 'true'
    },

    'multiCapabilities': [
        {
            'browserName': 'Chrome'
        },
        {
            'browserName' : 'Firefox',
            'browser_version' : '60.0 beta',
            'os' : 'Windows',
            'os_version' : '10',
            'resolution' : '2048x1536',
        },
        {
            'browserName' : 'Safari',
            'browser_version' : '11.0',
            'os' : 'OS X',
            'os_version' : 'High Sierra',
            'resolution' : '1920x1080',
        },
        {
            'browserName' : 'iPhone',
            'device' : 'iPhone 8',
            'realMobile' : 'true',
            'os_version' : '11.0',
        },
        {
            'browserName' : 'android',
            'device' : 'Samsung Galaxy S8',
            'realMobile' : 'true',
            'os_version' : '7.0',
        }
    ],
};

// Code to support common capabilities
exports.config.multiCapabilities.forEach(function(caps){
    for(var i in exports.config.commonCapabilities) caps[i] = caps[i] || exports.config.commonCapabilities[i];
});

File test.js

describe('Smartscreening connexion', function() {
    it('can click to button after fill textfields', function(done) {
        browser.driver.get('http://smartscreening.io/#/login/company').then(function() {
            element(by.name('mail')).sendKeys(mail);
            element(by.name('pwd')).sendKeys(pwd);
            element(by.buttonText('Continuer')).click();
        });
    });
});

Could you help me clear up my worries... Thank you very much

Lavan350
  • 1
  • 1
  • Could you tell us which platforms it fails on and what errors you're getting. – phuzi Mar 26 '18 at 14:15
  • @phuzi- Hi, I have an error on all platforms but the error is unique that is: `Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.` – Lavan350 Mar 26 '18 at 14:23

1 Answers1

0

Having an argument in your it function will cause it to attempt an async call.

//this block signature will trigger async behavior.
it("should work", function(done){
//...
});


//this block signature will run synchronously
it("should work", function(){
//...
});

It doesn't make a difference what the done argument is named, its existence is all that matters. I ran into this issue from too much copy/paste.

Credit: jasmine: Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL

BountyHunter
  • 1,413
  • 21
  • 35
  • Hi, I removed the argument that was in the function. Looks like it's working better. However, I still have the same mistake on an iPhone, and the program doesn't even go through with it. I have the impression that it remains frozen on the same page during 1 minute. – Lavan350 Mar 26 '18 at 14:54
  • Have you tried adding explicit wait towards the beginning of your test script to ensure an expected element is visible before subsequent commands as triggered? – BountyHunter Mar 26 '18 at 15:11
  • Thanks for your help. On the other hand, I have my page which displays well and all the elements which seem to be loaded (indeed as you could see my code, I ask to fill two fields text and click on a button). And yet, he can't do anything as I told you in my previous message, apart from loading the page. The script lasts abnormally more than one minute, whereas for the other "devices", it takes about ten seconds. – Lavan350 Mar 27 '18 at 08:10