Friday 19 May 2017

Running docker image for end-to-end testing

In my CI (gitlab) I am using docker run like this after the files of a nodeJS application have been build:

docker build -t $CI_REGISTRY_IMAGE:test -f Dockerfile.testing .
docker run --rm --link ubuntu_selenium_1 --link mongodb --link app_core $CI_REGISTRY_IMAGE:test

So with this I can use app_core (which is linked) in some e2e-tests. For example like:

module.exports = {
    'start application': function(browser) {
        browser
            .url('http://app_core')
            .waitForElementVisible('body', 10000)
            .getTitle(function(result) {
                this.assert.equal(result, 'My App')
            })
    }
}

The docker image has the entrypoint:

#!/bin/bash
node main.js & nightwatch

I am running the nodeJS application in the background and then I'm running nightwatchJS e2e tests.

So far it is working great. But nightwatchJS is using the app_core application instead of using the current application. An that is what I want to do. I want to do some e2e testing for the current build. If it is successful, I can deploy everything to app_core

Using browser.url('http://localhost') is not working.

Another idea would be to run the application as an own container and then run the nightwatchJS tests like shown above. But I don't know how to do this either.



via user3142695

No comments:

Post a Comment