Lakmal Rajith
Lakmal Rajith

Reputation: 71

Protractor test fails on CI

Currently I am trying a setup an end to end protractor tests to a a bitbucket pipelines with set up an headless chrome and i am currently getting some error message:

Failed: This driver instance does not have a valid session ID (did you call WebDriver.quit()?) and may no longer be used. Any clue for this? how ever running tests locally is working fine; Can i set a constant session id? Thanks

Upvotes: 0

Views: 188

Answers (1)

Sergey Pleshakov
Sergey Pleshakov

Reputation: 8948

Check out your configuration file for this object

capabilities: {
        "browserName": "chrome",
        "chromeOptions": {
            "args": ["incognito", "--window-size=1920,1080", "disable-extensions", "--no-sandbox", "start-maximized", "--test-type=browser"],
            "prefs": {
                "download": {
                    "prompt_for_download": false,
                    "directory_upgrade": true,
                    "default_directory": path.join(process.cwd(), "__test__reports/downloads")
                    }
                }
        }
    },

When you find it, make sure you included "--no-sandbox" argument into args property.

What this guy does is it allows your tests to be ran from a remote container. In the meantime, if you include the argument when you run your tests on your machine, it has side effects like described here Chrome Instances don't close after running Test Case in Protractor

Upvotes: 1

Related Questions