Skip to content

Commit

Permalink
configurable base url
Browse files Browse the repository at this point in the history
  • Loading branch information
corevo committed Apr 17, 2018
1 parent 8a6ce42 commit 411eedb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion packages/selenium-side-runner/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ program
.option("-c, --capabilities [list]", "Webdriver capabilities")
.option("-s, --server [url]", "Webdriver remote server")
.option("-f, --filter [string]", "Filter test cases by name")
.option("-w, --maxWorkers [number]", "Maximum amount of workers that will run your tests, defaults to number of cores")
.option("-w, --max-workers [number]", "Maximum amount of workers that will run your tests, defaults to number of cores")
.option("--base-url [url]", "Override the base URL that was set in the IDE")
.option("--no-sideyml", "Disabled the use of .side.yml")
.option("--debug", "Print debug logs")
.parse(process.argv);
Expand Down Expand Up @@ -73,6 +74,8 @@ if (program.capabilities) {
}
}

configuration.baseUrl = program.baseUrl ? program.baseUrl : configuration.baseUrl;

function runProject(project) {
if (!project.code) {
return Promise.reject(new TypeError(`The project ${project.name} is of older format, open and save it again using the IDE.`));
Expand Down
2 changes: 1 addition & 1 deletion packages/selianize/__tests__/configuration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ describe("configuration code emitter", () => {
const project = {
url: "http://www.seleniumhq.org"
};
expect(ConfigurationEmitter.emit(project)).toBe(`const BASE_URL = '${project.url}';`);
expect(ConfigurationEmitter.emit(project)).toBe(`const BASE_URL = Runner.configuration.baseUrl || '${project.url}';`);
});
});
2 changes: 1 addition & 1 deletion packages/selianize/src/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// under the License.

export function emit(project) {
return `const BASE_URL = '${project.url}';`;
return `const BASE_URL = Runner.configuration.baseUrl || '${project.url}';`;
}

export default {
Expand Down

0 comments on commit 411eedb

Please sign in to comment.