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

Nightmare should set a partition by default #916

Closed
justinmchase opened this issue Dec 2, 2016 · 3 comments
Closed

Nightmare should set a partition by default #916

justinmchase opened this issue Dec 2, 2016 · 3 comments

Comments

@justinmchase
Copy link
Contributor

this.browser = Nightmare({
  webPreferences: {
    partition: 'nightmare'
  }
});

I got burned pretty hard by the fact that I am starting and stopping the browser and there is some state that is getting stored between instances and it was affecting my tests on subsequent runs.

I would like to make a PR that automatically sets a partition by default. If a user wanted to persist state between tests they could set the partition to be paritition: 'persist: whatever' still to override it or partition: null to revert to the default.

Is there any reason why it would be good or should actually be set to persist between browser runs? If not I will make a PR to change it. Otherwise I may just add to the front page documentation with a tip about setting the partition to prevent this issue.

@overflowz
Copy link

Same problems here. I don't want sessions to be shared across different instances. I was trying to find the 'incognito' mode too, but no luck.

@jekku
Copy link
Contributor

jekku commented Dec 5, 2016

I've been doing 'nopersist' all the time in my main config to avoid Nightmare from persisting states. I use it in integration tests where tests should be initially stateless and also independent from all other tests.

@justinmchase
Copy link
Contributor Author

@jekku Do you mean literally using the name 'nopersist' as your partition name? I think you can use any name for the same effect but yeah that would work. I don't know of any other way to do it and you can get burned pretty hard if you don't.

justinmchase added a commit to justinmchase/nightmare that referenced this issue Dec 5, 2016
The current behavior uses electron default, which creates a partition
for storage which persists between instances. This makes sense for
electron but not necessarily for primary use cases of Nightmare.

This change sets the default partition to be a non-persistent partition
but allows a user to opt back into persistence with simple configuration options.

Fixes segment-boneyard#916
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants