mardi 25 avril 2017

Protractor running very slow and rendered page looks broken

I have set up e2e testing with protractor for an Angular application.

When running the tests on my machine (mbp 15" late 2012, macOs 10.12.4) I have two very distinct problems:

  1. The tests runs extremely slow
  2. The rendered pages looks broken during the tests (on chrome, please see the attached image)

When running the same tests (with the exact same code) on a colleagues machine, the tests runs allot faster, and the rendered pages looks like they do normally. He has a brand new mbp, that can of course explain the increase in speed, but not why the pages looks broken on my machine and not his.

The consequence of the tests running very slow is that the tests often times out, thus causing the tests to fail.

My question is: Could it be something with the configuration on my machine or is it simply to old to run protractor tests?

I have the following installed: - Version of webdriver: webdriver-manager 12.0.4 - Version ofprotractor: *protractor@5.1.1" - Version of node:v6.9.2

conf.js (My protractor configuration file)

var JasmineSpecReporter = require('jasmine-spec-reporter').SpecReporter;

exports.config = {
  capabilities: {
    'browserName': 'chrome',
    'chromeOptions': {
      'prefs': {
        'credentials_enable_service': false,
        'profile': {
          'password_manager_enabled': false
        }
      }
    }
  },
  allScriptsTimeout: 120000, //webdriver
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 120000,
    isVerbose: true,
    includeStackTrace: true
  },
  onPrepare: function () {
    jasmine.getEnv().addReporter(new HtmlReporter(reporter));
    jasmine.getEnv().addReporter(new JasmineSpecReporter());
    browser.driver.manage().window().setPosition(0, 0);
    browser.driver.manage().window().setSize(720, 900);
  },
  seleniumAddress: 'http://localhost:4444/wd/hub',
  suites: {
    addMedia: './app/library/media/addMedia.spec.js'
  }
};

media.spec.js (Example spec file)

var PageObjects = include('page-objects.js');
var path = require('path');

describe('Testing the functionality of adding a video', function () {
  var loginPage = new PageObjects.LoginPage();
  var addMedia = new PageObjects.AddMedia();
  var navigation = new PageObjects.Navigation();

  beforeEach(function () {
    navigation.openPage(browser.baseUrl);
    loginPage.login();
    browser.waitForAngular();
  });

  it('should upload a mp4 media', function (done) {
    addMedia.openAddMediaModal();
    browser.waitForAngular();
    var filename = 'test-clip.mp4';
    var fileToUpload = './video/' + filename,
      absolutePath = path.resolve(__dirname, fileToUpload);

    element(by.css('input[type="file"]')).sendKeys(absolutePath);
    addMedia.clickUploadButton();
    browser.waitForAngular();
    expect(browser.getCurrentUrl()).toBe(browser.baseUrl + '/#/progress');
    done();
  });
});

Image of broken web page

Aucun commentaire:

Enregistrer un commentaire