microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.42k stars 3.63k forks source link

[Regression]: VSCode runner arguments stripped #33215

Open rahul-sharma-uipath opened 2 hours ago

rahul-sharma-uipath commented 2 hours ago

Last Good Version

1.43.1

First Bad Version

1.44.0

Steps to reproduce

Current Version (v1.48.1)

  1. npx playwright init
  2. create global-setup.ts and enable in playwright.config.ts with content

    export default function (config: FullConfig) {
    console.log(process.argv);
    
    return config;
    }
  3. outputs
    Running global setup if any…
    [
    '/Users/rahul/.nvm/versions/node/v18.20.4/bin/node',
    '/Users/rahul/uipath/playwright/node_modules/@playwright/test/cli.js',
    'test-server',
    '-c',
    '/Users/rahul/uipath/playwright/playwright.config.ts'
    ]

Last Working Version (v1.43.1)

  1. npx playwright init
  2. create global-setup.ts with same content as above
  3. outputs
    [
    '/Users/rahul/.nvm/versions/node/v18.20.4/bin/node',
    '/Users/rahul/uipath/playwright/node_modules/@playwright/test/cli.js',
    'test',
    '-c',
    'playwright.config.ts',
    '--project=chromium',
    '--repeat-each=1',
    '--retries=0',
    '--headed',
    '--workers=1',
    '--trace=off',
    '/Users/rahul/uipath/playwright/tests/example\\.spec\\.ts:3'
    ]

Expected behavior

I expect the arguments while calling the script to remain the same

Actual behavior

The playwright CLI arguments do not include arguments such as

  '--project=chromium',
  '--repeat-each=1',
  '--retries=0',
  '--headed',
  '--workers=1',
  '--trace=off',

Additional context

Currently, our global-setup script parses the given arguments to set some specific parameters in the process.env that can later be accessed by the tests.

With this change, we are unable to upgrade our playwright version, and its unclear why this change is needed.

Alternatively, if there's some other way the arguments are exposed, that can work too.

Environment

System: OS: macOS 14.7 CPU: (10) arm64 Apple M1 Pro Memory: 331.67 MB / 32.00 GB Binaries: Node: 18.20.4 - ~/.nvm/versions/node/v18.20.4/bin/node Yarn: 1.22.21 - /opt/homebrew/bin/yarn npm: 10.7.0 - ~/.nvm/versions/node/v18.20.4/bin/npm IDEs: VSCode: 1.93.1 - /usr/local/bin/code Languages: Bash: 3.2.57 - /bin/bash npmPackages: @playwright/test: 1.43.1 => 1.43.1 / 1.48.1 => 1.48.1

mxschmitt commented 2 hours ago

We internally changed the way how tests are getting executed when using the VSCode extension. In what arguments are you interested in? Could you elaborate how you use them?

rahul-sharma-uipath commented 2 hours ago

we overloaded the project keyword in playwright to be able to point tests against different environments.

for example, we have an alpha, staging and production environment and to use different passwords on each env during setup we do something like the following

const project = getProjectFromArguments()

process.env.PASSWORD = getPasswordFromProject(project)

minimally, if we are able to get access to the current project that is selected in the VSCode extension toolbar then we can make it work