Skip to content
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

fix: remove origin config from protractorArgs if retryConfig is used #94

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Anyman552
Copy link

  • added a note that the protractor config have to be the first option in protractorArgs.
  • Updated the tests for protactorRetryConfig.
  • added a retryConfig example for the tests.

@NickTomlin
Copy link
Owner

Thanks for this! I will hopefully have time to review this tomorrow and get you some feedback.

@@ -61,6 +61,7 @@ export default function (options = {}, callback = function noop () {}) {
}

if (parsedOptions.protractorRetryConfig && retry) {
protractorArgs.splice(1, 1)
Copy link

Choose a reason for hiding this comment

The 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 ?

Copy link
Author

@Anyman552 Anyman552 Jul 13, 2018

Choose a reason for hiding this comment

The 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.

Copy link
Owner

Choose a reason for hiding this comment

The 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 protractorConf option is specified alongside retryConfig; this would mean a breaking change (and major version bump) but I'm okay with that if it makes this feature work.

Users could still accidentally supply both the protractorConf option to flake and a config file in the options passed to protractor after -- but they'd run into the error in #93 so there would be some indication that something is wrong.

@@ -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')})
Copy link
Owner

Choose a reason for hiding this comment

The 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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right.

@@ -61,6 +61,7 @@ export default function (options = {}, callback = function noop () {}) {
}

if (parsedOptions.protractorRetryConfig && retry) {
protractorArgs.splice(1, 1)
Copy link
Owner

Choose a reason for hiding this comment

The 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 protractorConf option is specified alongside retryConfig; this would mean a breaking change (and major version bump) but I'm okay with that if it makes this feature work.

Users could still accidentally supply both the protractorConf option to flake and a config file in the options passed to protractor after -- but they'd run into the error in #93 so there would be some indication that something is wrong.

@@ -47,6 +47,8 @@ protractorFlake({
nodeBin: 'node',
// set color to one of the colors available at 'chalk' - https://github.com/chalk/ansi-styles#colors
color: 'magenta',
// set the arguments for protractor
// note: the protractor config have to be the first option in protractorArgs
Copy link
Owner

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 of protractorConfig because this is only an issue when using retryConfig?

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."

Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants