getgauge / taiko

A node.js library for testing modern web applications
https://taiko.dev
MIT License
3.55k stars 450 forks source link

Chrome local storage is getting cleared for every time loading the page #274

Closed dharmadurai closed 5 years ago

dharmadurai commented 5 years ago

We are using node express framework, after login we are storing the user informations in local storage of the browser..

After login site will redirect to home page, but local storage is cleared, So it is again redirecting to login page.. Is there any way to maintain the local storage?

zabil commented 5 years ago

Have you tried using using a custom --user-data-dir for e.g.

openBrowser({args: ["--user-data-dir=c:\foo"]})   

Here a list of options for openBrowser you can override any chromium option using the args parameter.

NivedhaSenthil commented 5 years ago

Local storage are by default cleared on newDocumentLoad by taiko as the behaviour was different on headful and headless modes, using user-data-dir may not be helpful now. In headless mode local storage was persisted, whereas in headless mode it was cleared by chrome. Will it be helpful if there is an config option set when opening browser like await openBrowser({localStorage:true}) ? Like @zabil mentioned even when this option is provided custom --user-data-dir has to used to persist the value in headless mode.

dharmadurai commented 5 years ago

Thanks @zabil and @NivedhaSenthil we will try this.

NivedhaSenthil commented 5 years ago

@dharmadurai currently await openBrowser({localStorage:true}) is not available, it has to be added

dharmadurai commented 5 years ago

Ok.. thanks @NivedhaSenthil

negiDharmendra commented 5 years ago

Few points from the discussed with the team.