Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run protractor tests using this container #6

Open
adokania opened this issue Dec 9, 2016 · 18 comments
Open

Unable to run protractor tests using this container #6

adokania opened this issue Dec 9, 2016 · 18 comments

Comments

@adokania
Copy link

adokania commented Dec 9, 2016

I constantly get the following error :

unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 4.4.24-moby x86_64) [18:30:50] E/launcher - WebDriverError: unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 4.4.24-moby x86_64) at WebDriverError (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:27:10) at Object.checkLegacyResponse (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:639:15) at parseHttpResponse (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:538:13) at /usr/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:472:11 at ManagedPromise.invokeCallback_ (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1379:14) at TaskQueue.execute_ (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2913:14) at TaskQueue.executeNext_ (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2896:21) at /usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2820:25 at /usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:639:7 at process._tickCallback (node.js:369:9)

Following is my protractor.conf.js :

NOTE: (I have tried with and w/o directConnect and SeleniumServerJar)

exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  framework: "jasmine2",
  specs: ['../abc/*.js'],
  // Chrome is not allowed to create a SUID sandbox when running inside Docker
  directConnect: 1,
  seleniumServerJar: '/usr/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-2.53.1.jar',

  capabilities: {
    'browserName': 'chrome',
    'chromeOptions': {
      'args': ['no-sandbox', '--test-type=browser']
    }
  }
};
@adokania
Copy link
Author

Anything on this? anyone running into it?

@mrsheepuk
Copy link
Owner

It works for me at the moment, but I might not have pulled the latest version recently... I use the following protractor.conf.js:

exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  framework: "jasmine2",
  onPrepare: function () {
    var JUnitXmlReporter = require('jasmine-reporters').JUnitXmlReporter;
    jasmine.getEnv().addReporter(new JUnitXmlReporter({
      savePath: 'target',
      consolidateAll: false
    }));
  },
  specs: ['*.spec.js'],
  // Chrome is not allowed to create a SUID sandbox when running inside Docker  
  capabilities: {
    'browserName': 'chrome',
    'chromeOptions': {
      'args': ['no-sandbox']
    }
  }
};

@adokania
Copy link
Author

Do you have a *.spec.js file in you current dir and see that the test passed? I am having trouble with the chrome version. Will try the conf. file mentioned here.

@adokania
Copy link
Author

adokania commented Dec 14, 2016

When I run as is using the above conf. file with appropriate spec file, i see the following:

[21:48:21] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[21:48:21] I/launcher - Running 1 instances of WebDriver
[21:48:21] E/launcher - Error code: 135
[21:48:21] E/launcher - Error message: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444
[21:48:21] E/launcher - Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444
    at ClientRequest.<anonymous> (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:381:15)
    at emitOne (events.js:77:13)
    at ClientRequest.emit (events.js:169:7)
    at Socket.socketErrorListener (_http_client.js:269:9)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at emitErrorNT (net.js:1269:8)
    at nextTickCallbackWith2Args (node.js:442:9)
    at process._tickCallback (node.js:356:17)
From: Task: WebDriver.createSession()
    at Function.createSession (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:329:24)
    at Builder.build (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/builder.js:458:24)
    at Hosted.DriverProvider.getNewDriver (/usr/lib/node_modules/protractor/built/driverProviders/driverProvider.js:37:33)
    at Runner.createBrowser (/usr/lib/node_modules/protractor/built/runner.js:190:43)
    at /usr/lib/node_modules/protractor/built/runner.js:264:30
    at _fulfilled (/usr/lib/node_modules/protractor/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/usr/lib/node_modules/protractor/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/usr/lib/node_modules/protractor/node_modules/q/q.js:796:13)
    at /usr/lib/node_modules/protractor/node_modules/q/q.js:556:49
    at runSingle (/usr/lib/node_modules/protractor/node_modules/q/q.js:137:13)

@mrsheepuk
Copy link
Owner

I'll update my build server to the latest version of the image and give it a go to see if I see the same.

@mrsheepuk
Copy link
Owner

OK I've pulled the latest version of this image (i.e. mrsheepuk/protractor from the docker hub) down into my environment and it's working perfectly. Here's a spec I'm using successfully:

describe('usermanagement', function () {

  describe('register', function () {

    beforeEach(function () {
      // Ensure we're logged out before each test.
      browser.get('/logout/');
    });

    it('should have a register link on the home page, which shows the registration page when clicked.', function () {
      browser.get('/');
      expect(element(by.linkText('Register')).isPresent()).toBeTruthy();

      element(by.linkText('Register')).click();

      expect(browser.getLocationAbsUrl()).toMatch('/register/');
      expect(element(by.id('email')).isPresent()).toBeTruthy();
      expect(element(by.id('sheepname')).isPresent()).toBeTruthy();
      expect(element(by.id('password')).isPresent()).toBeTruthy();
    });

    it('should register when details are valid', function () {
      browser.get('/');
      element(by.linkText('Register')).click();
      element(by.id('email')).sendKeys('test@test.com');
      element(by.id('sheepname')).sendKeys('testuser');
      element(by.id('password')).sendKeys('password');
      element(by.id('registerButton')).click();

      // Registered message should be displayed, and form should not be visible.
      expect(element(by.id('registeredMsg')).isDisplayed()).toBeTruthy();
      expect(element(by.id('email')).isDisplayed()).not.toBeTruthy();
      expect(element(by.id('sheepname')).isDisplayed()).not.toBeTruthy();
      expect(element(by.id('password')).isDisplayed()).not.toBeTruthy();
      expect(element(by.id('registerButton')).isDisplayed()).not.toBeTruthy();

      // We should now be logged in, so the log-out link should be visible and the
      // register link should be hidden.
      expect(element(by.linkText('Register')).isPresent()).toBe(false);
      expect(element(by.linkText('Log out')).isDisplayed()).toBeTruthy();
    });

    it('should not register if the email is already used', function () {
      browser.get('/');
      element(by.linkText('Register')).click();
      element(by.id('email')).sendKeys('test@test.com');
      element(by.id('sheepname')).sendKeys('testuser2');
      element(by.id('password')).sendKeys('password');
      element(by.id('registerButton')).click();

      // Not registered message should be displayed.
      expect(element(by.id('emailInUse')).isDisplayed()).toBeTruthy();
    });

    it('should not register if the sheepname is already used', function () {
      browser.get('/');
      element(by.linkText('Register')).click();
      element(by.id('email')).sendKeys('test2@test.com');
      element(by.id('sheepname')).sendKeys('testuser');
      element(by.id('password')).sendKeys('password');
      element(by.id('registerButton')).click();

      // Not registered message should be displayed.
      expect(element(by.id('sheepnameInUse')).isDisplayed()).toBeTruthy();
    });

  });
});

@mrsheepuk
Copy link
Owner

@adokania Did you have any luck getting it to work?

@adokania
Copy link
Author

adokania commented Dec 20, 2016

No luck , I ran the following command with the above mentioned conf file and got the connection refused error -

docker run --rm -v /Users/Adity/Kensho/zentreefish/projects/zentreefish/app/tests:/project mrsheepuk/protractor protractor ./project/protractor_tests/utils/protractor.conf.js

I get the following error:

09:28:02] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[09:28:02] I/launcher - Running 1 instances of WebDriver
[09:28:02] E/launcher - Error code: 135
[09:28:02] E/launcher - Error message: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444
[09:28:02] E/launcher - Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444
    at ClientRequest.<anonymous> (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:381:15)
    at emitOne (events.js:77:13)
    at ClientRequest.emit (events.js:169:7)
    at Socket.socketErrorListener (_http_client.js:269:9)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at emitErrorNT (net.js:1269:8)
    at nextTickCallbackWith2Args (node.js:442:9)
    at process._tickCallback (node.js:356:17)
From: Task: WebDriver.createSession()
    at Function.createSession (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:329:24)
    at Builder.build (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/builder.js:458:24)
    at Hosted.DriverProvider.getNewDriver (/usr/lib/node_modules/protractor/built/driverProviders/driverProvider.js:37:33)
    at Runner.createBrowser (/usr/lib/node_modules/protractor/built/runner.js:190:43)
    at /usr/lib/node_modules/protractor/built/runner.js:264:30
    at _fulfilled (/usr/lib/node_modules/protractor/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/usr/lib/node_modules/protractor/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/usr/lib/node_modules/protractor/node_modules/q/q.js:796:13)
    at /usr/lib/node_modules/protractor/node_modules/q/q.js:556:49
    at runSingle (/usr/lib/node_modules/protractor/node_modules/q/q.js:137:13)
[09:28:02] E/launcher - Process exited with error code 135

@adokania
Copy link
Author

On removing the seleniumAddress param from the conf file I get past the connection refused error but I constantly see that the chrome browser exited abnormally. Same error when i originally created the issue.

@mrsheepuk
Copy link
Owner

What version of docker are you using? I'm wondering if it's something environmental...

@adokania
Copy link
Author

Docker version 1.12.2, build bb80604,

@Pablodotnet
Copy link

I'm having the same issue :(

@janjaali
Copy link

janjaali commented May 9, 2017

same here

@michelle-chiang
Copy link

same here

@michelle-chiang
Copy link

@mrsheepuk Could you update Protractor to the newest version, 5.1.2?

@gauravpm
Copy link

gauravpm commented Jun 15, 2017

i am also facing same issue. I am using protractor 5.1.2. Can you please help me.
Below is my config file
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['functional/home-functional-test.js', 'functional/portfolio-functional-test.js',
'functional/portfolio-functional-test.js','functional/volatility-trend-functional-test.js'],
framework: 'jasmine2',
onPrepare: function() {
var jasmineReporters = require('jasmine-reporters');
jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
consolidateAll: true,
savePath: '',
filePrefix: 'sqdashboard-E2E'
}));
},
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
'args': ['no-sandbox']
}
}
};

@y4nnick
Copy link

y4nnick commented Nov 29, 2017

Any update on this? Otherwise this repo seems useless. :/

@SaifJerbi
Copy link

same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants