gemini-testing / gemini

💀💀💀[DEPRECATED] Use hermione
https://github.com/gemini-testing/hermione
MIT License
1.5k stars 149 forks source link

[Question] Is it possible to set rootUrl in runtime? #964

Closed alexeyoganezov closed 5 years ago

alexeyoganezov commented 5 years ago

Gemini is a great help for our project so far, but one thing makes its usage a little bit inconvenient: I'm speaking about setting rootUrl before test runs.

We have remote Selenoid server and we want to be able to start tests not only from CI-agents, but also from local developer environment that sometimes is placed in various networks. To solve an access problem (NAT/firewalls) we've developed a plugin that creates a public tunnel from URL like https://alexey.localtunnel.me to local web-server and it works perfectly, but since we aren't able to change rootUrl in the plugin we have to do something like this:

package.json

"scripts": {
    "gemini": "gemini_root_url=\"http://$(hostname -s).localtunnel.me\" gemini test",
  },

This step would be completly unnecessary if we could do something like:

gemini.on(gemini.events.START_RUNNER, () => {
   const URL = getTunnel();
   gemini.config.rootUrl = URL;
});

But it doesn't work and I'd like to know if there is a way to set rootUrl somehow from plugin API. And if there isn't would you accept a pull request than enables this functionality?

j0tunn commented 5 years ago

Hi you should change rootUrl for each browser:

gemini.on(events.START_RUNNER, async () => {
    const URL = getTunnel();

    gemini.config.getBrowserIds().forEach((id) => {
        const rootUrl = url.parse(gemini.config.forBrowser(id).rootUrl);

        gemini.config.forBrowser(id).rootUrl = url.format({
            host: URL,
            pathname: rootUrl && rootUrl.path || ''
        });
    });
});

All data in gemini.config - are just the default value for each browser config.

j0tunn commented 5 years ago

@alexeyoganezov and I'd suggest you to migrate to hermione. gemini will be deprecated soon

alexeyoganezov commented 5 years ago

Alright, we'll try it. Thank you for the fast response.