DEV Community

Preetham Kalpuri
Preetham Kalpuri

Posted on

Playwright - Remember me functionality

Hello Team, I have a scenario i.e. Automate remember me Toggle Functionality.

Below are the steps executed manually:

1. I will be launching an application
2. Once launched I will be logging into application by passing user name and password and checking the toggle i.e. remember me toggle. 
3. Post successful login I will be closing the browser
4. I would open the browser again 
5. I Will be launching the same application (Navigating to URL), so It would be logged in. 
6.Here I will be trying to access any personal information it would ask for the password authentication again on the same session.
Enter fullscreen mode Exit fullscreen mode

So this the manual execution and it is working as expected. When it comes to automation, it is not working as expected.

Below is the script executed in playwright:
const loginInstance = featureInstances['login'] as Login;
await loginInstance.LoginWithRememberMeToggleOn(userData.emailaddress, userData.password);
const storageState = await context.storageState();
console.log(storageState);
await page.close();
const newContext = await browser.newContext({ storageState });
const newPage = await newContext.newPage();
await loginInstance.ValidateRememberMeLoginToggle(newPage);

When I am executing in automation, it just launching the application without populating password authentication page.

Any leads with solution, it would be grateful. Thanks in advance.

Top comments (0)