1

I want to run the Protractor E2E Test for my Angular Application on a Bamboo Linux Build Server using XFVB to run Chrome resp. Chromium headless, exactly like in this gist: https://gist.github.com/nwinkler/f0928740e7ae0e7477dd.

But first I wanted to check if it works on the OSX machine I'm developing on.

Question: Is this even possible on OSX and if yes, what am I doing wrong?

In my Gruntfile I have:

grunt.loadNpmTasks('grunt-shell-spawn');
grunt.loadNpmTasks('grunt-env');
grunt.loadNpmTasks('grunt-protractor-runner');

And:

protractor: {
        options: {
            configFile: "test/protractor.conf.js",
            keepAlive: false
        },
        run: {}
    },

    shell: {
        xvfb: {
            command: 'Xvfb :50 -ac -screen 0 1600x1200x24',
            options: {
                async: true
            }
        }
    },
    env: {
        xvfb: {
            DISPLAY: ':50'
        }
    }

And finally:

grunt.registerTask('protractor-xvfb', [
        'clean:server',
        'wiredep',
        'includeSource',
        'concurrent:server',
        'autoprefixer:server',
        'connect:e2e',
        'shell:xvfb',
        'env:xvfb',
        'protractor:run',
        'shell:xvfb:kill'
    ]);

(Do not mind the tasks up to shell:xvfb, they work)

And in my protractor.conf.js:

exports.config = {
framework: 'jasmine2',
seleniumServerJar: '../node_modules/protractor/selenium/selenium-server-standalone-2.45.0.jar',
seleniumPort: 4444,
chromeDriver: '../node_modules/protractor/selenium/chromedriver',
troubleshoot: false,
basePath: '../',
specs: ['protractor/***/**/*.js'],
baseUrl: 'http://localhost:9000',
capabilities: {
    browserName: 'chrome'
}};

What this does at the moment is:

  1. Serve the application on localhost:9000
  2. Start xvfb asychnronuously in the background
  3. Successfully start a standalone Selenium Server on localhost:4444:wd/hub
  4. Open a Chrome window and successfully run the test.
  5. As soon as the test is finished kill the xfvb process.

But I can't see any indices that Selenium actually connects to the xvfb framebuffer.

MethDamon
  • 55
  • 11
  • Are the tests failing? What output do you see from protractor/selenium? Can you run this w/o using Xvfb (ie- using the normal display) on your machine? – Andrew Eisenberg Jul 27 '15 at 17:36
  • Sorry, I forgot to write that. There is a Selenium Standalone Server starting successfully and the test completes successfully in a newly opened Chrome window. This is on a Macbook Pro Mid 2012 OSX 10.10.2 – MethDamon Jul 27 '15 at 17:41
  • I'm confused then. What are you expecting to see that you are not? Xvfb is a *virtual* frame buffer, so you should not see anything from that screen. – Andrew Eisenberg Jul 27 '15 at 19:01
  • I can see a Chrome window opening on my screen and Protactor navigating through the application. I would not expect that to happen if Selenium was successfully connected to xvfb exactly because of the reason you described. I am expcecting no visual feedback from the test at all, no browser window, only feedback from Protractor on the command line. Or am I wrong? – MethDamon Jul 27 '15 at 19:26

1 Answers1

0

I think the problem you are having is described here.

Essentially, there is no virtual frame buffer support on Mac for browsers. Your best bet would be to try this again on a linux machine. My guess is that this will work for you.

Andrew Eisenberg
  • 28,387
  • 9
  • 92
  • 148