-
Notifications
You must be signed in to change notification settings - Fork 49
fix: remove origin config from protractorArgs if retryConfig is used #94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,7 @@ export default function (options = {}, callback = function noop () {}) { | |
} | ||
|
||
if (parsedOptions.protractorRetryConfig && retry) { | ||
protractorArgs.splice(1, 1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it make sense to actually check what is being spliced and not just blindly assume it's at index 1 ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That would be better. But how can we make sure it's the protractor conf? Maybe a new option named protractorConf instead put the protractor config file in protractorArgs? Then we could search for it and then remove it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think having something explicit here would be good; we could require that a Users could still accidentally supply both the |
||
protractorArgs.push(parsedOptions.protractorRetryConfig) | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -214,16 +214,16 @@ describe('Protractor Flake', () => { | |
}) | ||
|
||
it('uses protractorRetryConfig file for spawned protractor process only after first attempt', () => { | ||
protractorFlake({protractorRetryConfig: __dirname + '/support/protractor.flake.config.js'}) | ||
expect(spawnStub).to.have.been.calledWith('node', [pathToProtractor(), '--params.flake.iteration', 1]) | ||
protractorFlake({protractorArgs: [resolve(__dirname + '/support/protractor.flake.config.js')], protractorRetryConfig: resolve(__dirname + '/support/protractor.flake.retryConfig.js')}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is a unit test we could avoid creating a real file and just pass a path, what do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right. |
||
expect(spawnStub).to.have.been.calledWith('node', [pathToProtractor(), resolve(__dirname + '/support/protractor.flake.config.js'), '--params.flake.iteration', 1]) | ||
spawnStub.dataCallback(failedSingleTestOutput) | ||
spawnStub.endCallback(1) | ||
expect(spawnStub).to.have.been.calledWith('node', [pathToProtractor(), '--params.flake.iteration', 2, '--params.flake.retry', true, '--specs', '/tests/a-flakey.test.js', resolve(__dirname + '/support/protractor.flake.config.js')]) | ||
expect(spawnStub).to.have.been.calledWith('node', [pathToProtractor(), '--params.flake.iteration', 2, '--params.flake.retry', true, '--specs', '/tests/a-flakey.test.js', resolve(__dirname + '/support/protractor.flake.retryConfig.js')]) | ||
}) | ||
|
||
it('uses protractorRetryConfig cli args for spawned protractor process only after first attempt', () => { | ||
protractorFlake({protractorRetryConfig: '--capabilities.browser=chrome --capabilities.sharding=false'}) | ||
expect(spawnStub).to.have.been.calledWith('node', [pathToProtractor(), '--params.flake.iteration', 1]) | ||
protractorFlake({protractorArgs: [resolve(__dirname + '/support/protractor.flake.config.js')], protractorRetryConfig: '--capabilities.browser=chrome --capabilities.sharding=false'}) | ||
expect(spawnStub).to.have.been.calledWith('node', [pathToProtractor(), resolve(__dirname + '/support/protractor.flake.config.js'), '--params.flake.iteration', 1]) | ||
spawnStub.dataCallback(failedSingleTestOutput) | ||
spawnStub.endCallback(1) | ||
expect(spawnStub).to.have.been.calledWith('node', [pathToProtractor(), '--params.flake.iteration', 2, '--params.flake.retry', true, '--specs', '/tests/a-flakey.test.js', '--capabilities.browser=chrome --capabilities.sharding=false']) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// An example configuration file | ||
exports.config = { | ||
// The address of a running selenium server. | ||
seleniumAddress: 'http://localhost:4444/wd/hub', | ||
|
||
// Capabilities to be passed to the webdriver instance. | ||
capabilities: { | ||
browserName: 'chrome' | ||
}, | ||
|
||
// Spec patterns are relative to the configuration file location passed | ||
// to protractor (in this example conf.js). | ||
// They may include glob patterns. | ||
specs: ['example-spec.js'], | ||
|
||
// Options to be passed to Jasmine-node. | ||
jasmineNodeOpts: { | ||
showColors: true // Use colors in the command line report. | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about putting this note on
retryConfig
instead ofprotractorConfig
because this is only an issue when usingretryConfig
?Also minor grammar note, I think the sentence would be better reworded as "Arguments passed to protrractor. The path to the protractor config must be the first argument."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that would be better. If we specify a
protractorConf
option, this note will be outdated.