Code Monkey home page Code Monkey logo

Comments (8)

migueldlt10 avatar migueldlt10 commented on October 10, 2024

@vandanak-allegion According to the docs: If the path provided to storageState() is a relative path, then it is resolved relative to current working directory. Ensure that you are accessing the correct file path in your playwright config file. Also, I encountered issues where playwright was attempting to access the storageState.json file prematurely, a workaround is to use a boolean value checking if the file exists using FS module.

ex: const foundStorageState = fs.existsSync('storageState.json');
...
use: {
baseURL: 'https://test.com', //dummy url
storageState: foundStorageState ? 'storage.json' : undefined,
trace: 'on-first-retry',
},
...

from playwright.

vishvan92 avatar vishvan92 commented on October 10, 2024

I included the check and also debugged by simply plugging in the absolute path. I also had a fixture that included this check for every test. For simplicity and triaging I removed the fixture

from playwright.

vishvan92 avatar vishvan92 commented on October 10, 2024

I have also tried beforeEach, again it works for the first test and again the second test is prompting to login

test.beforeEach(async () => {
   const browser = await chromium.launch();
   const context = await browser.newContext({ storageState: 'absolute/path/to/json' });
   page = await context.newPage();
   await page.goto("/");
  });

from playwright.

vishvan92 avatar vishvan92 commented on October 10, 2024

I am also logging the cookies within each test which works fine

const cookies = await page.context().cookies();
console.log(`cookies: ${JSON.stringify(cookies, null, 2)}`);

from playwright.

dgozman avatar dgozman commented on October 10, 2024

@vishvan92 Could you please provide a full repro that we can run locally? Unfortunately, the dummy url https://test.com or the generateOTP function that is not defined anywhere, do not allow us to reproduce the issue.

from playwright.

ksvvandana avatar ksvvandana commented on October 10, 2024

@vishvan92 Could you please provide a full repro that we can run locally? Unfortunately, the dummy url https://test.com or the generateOTP function that is not defined anywhere, do not allow us to reproduce the issue.

This is from an testing an internal application. Using the below for generateOTP, where the secret is from deciphering the QR code from an authenticator app.

import * as speakeasy from 'speakeasy';

async function generateOTP(secret: string) {
return speakeasy.totp({
secret: secret,
encoding: 'base32',
});
}

from playwright.

mxschmitt avatar mxschmitt commented on October 10, 2024

We unfortunately need a self-contained reproduction, which we can run locally to reproduce your issue. Ideally something with expected and actual. Otherwise we can't act on it. Thanks for your understanding!

from playwright.

mxschmitt avatar mxschmitt commented on October 10, 2024

Closing as per above - feel free to get back to us if you have a reproduction which you can share. Thanks for your understanding!

from playwright.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.