Git Product home page Git Product logo

intellij-playwright's People

Stargazers

 avatar

Watchers

 avatar  avatar

intellij-playwright's Issues

Cannot run tests, fails with: node not found

$HOME/.config/asdf/installs/nodejs/19.2.0/bin/npx playwright test --reporter /tmp/intellij-playwright-reporter2471405429046563111.js file.spec.ts -g ^(.*[\\\/])?...
/usr/bin/env: ‘node’: No such file or directory

I understand there can be env issues here, but all other js/ts support functions properly in intellij, all other test runners, debugging, etc.

[Bug] Project base from Playwright configuration template is not using

I need to set custom "Project base" that is different from project root (as we have monorepo with multiple apps). But every time when I start a new test via this plugin, it doesn't use a "Project base" from configuration template and I need to stop a test, open Run/Debug configuration and change it for every new test execution.

Webstorm test runner is "stuck" using maestro

I have a mixture of jest and playwright tests in my project.

I want to use maestro for playwright, but the jest runner for my jest tests.

When I try to run jest tests using the icon next to my tests, it tries to use maestro.
image

image

How can I make it so the IDE selects the correct test runner?

Breakpoints no longer work in Playwright

I have been using Maestro for at least a year to debug my automation tests in Playwright but all the sudden yesterday it no longer stops at any breakpoint. My suspicion is that it's the Maestro plugin but I'm not entire sure. This also happened to my co-worker and we have both switched to VS Code in the meantime.

[Feature Request] Allow mechanism to specify how to find project root

I think this relates to the change that closed #3 and #6 - as I understand it Maestro reads up from the current directory the test is in until it finds a dir with a package.json file. This might work for some monorepos, but in my case I am using NX which has only one package.json (at the root), whereas I have multiple applications which have different playwright.config.ts files.

Would it be possible to configure the plugin so that it decides where to stop looking for a project base? In my case (NX) it would be either the existence of project.json, or actually playwright.config.ts.

here's a (cut down) example of the conventional directory structure in NX:

.
├── apps
│   ├── app-a
│   ├── app-a-e2e
│   │   ├── playwright.config.ts
│   │   ├── project.json
│   │   └── tests
│   │       └── example.spec.ts
│   ├── app-b
│   └── app-b-e2e
│       ├── playwright.config.ts
│       ├── project.json
│       └── tests
│           └── example.spec.ts
└── package.json

Plugin breaks Playwright file linting, refactoring, etc.

Heey @mbolotov!

When working with Playwright files, I keep getting an IDE error which seems to break a lot of functionalities for the files (linting, refactoring, etc.). Below stacktrace is what the IDE provides.

Love your plugin so far, but this makes it really unusable sadly 😢 any idea what it might be?


Details

Plugin version 1.1.2

PhpStorm 2022.1.4
Build #PS-221.6008.16, built on July 20, 2022
Runtime version: 11.0.15+10-b2043.56 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.4

Stacktrace

java.lang.NoClassDefFoundError: org/intellij/plugins/intelliLang/inject/InjectorUtils
	at com.github.mbolotov.playwright.selector.inject.SelectorInjectorKt$isLangFromComment$1.invoke(selectorInjector.kt:156)
	at com.github.mbolotov.playwright.selector.inject.SelectorInjectorKt$isLangFromComment$1.invoke(selectorInjector.kt:156)
	at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:210)
	at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:170)
	at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:194)
	at com.github.mbolotov.playwright.selector.inject.SelectorInjectorKt.isLangFromComment(selectorInjector.kt:215)
	at com.github.mbolotov.playwright.selector.inject.SelectorInjectorKt.isPlaywrightJsSelector(selectorInjector.kt:146)
	at com.github.mbolotov.playwright.selector.inject.PlaywrightJsSelectorInjector.getLanguagesToInject(selectorInjector.kt:34)
	at com.intellij.psi.impl.source.tree.injected.InjectedLanguageManagerImpl.processInPlaceInjectorsFor(InjectedLanguageManagerImpl.java:442)
	at com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtilBase.probeElementsUp(InjectedLanguageUtilBase.java:246)
	at com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtilBase.enumerate(InjectedLanguageUtilBase.java:176)
	at com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtilBase.enumerate(InjectedLanguageUtilBase.java:146)
	at com.intellij.psi.impl.source.tree.injected.InjectedLanguageManagerImpl.enumerate(InjectedLanguageManagerImpl.java:318)
	at com.intellij.lang.jsgraphql.ide.notifications.GraphQLScopeEditorNotificationProvider$1.visitElement(GraphQLScopeEditorNotificationProvider.java:93)
	at com.intellij.lang.javascript.psi.impl.JSLiteralExpressionImpl.accept(JSLiteralExpressionImpl.java:133)
	at com.intellij.psi.impl.source.tree.CompositePsiElement.acceptChildren(CompositePsiElement.java:65)
	at com.intellij.psi.PsiRecursiveElementVisitor.visitElement(PsiRecursiveElementVisitor.java:41)
	at com.intellij.lang.jsgraphql.ide.notifications.GraphQLScopeEditorNotificationProvider$1.visitElement(GraphQLScopeEditorNotificationProvider.java:99)
	at com.intellij.lang.javascript.psi.impl.JSArgumentListImpl.accept(JSArgumentListImpl.java:58)
	at com.intellij.psi.impl.PsiElementBase.acceptChildren(PsiElementBase.java:58)
	at com.intellij.psi.PsiRecursiveElementVisitor.visitElement(PsiRecursiveElementVisitor.java:41)
	at com.intellij.lang.jsgraphql.ide.notifications.GraphQLScopeEditorNotificationProvider$1.visitElement(GraphQLScopeEditorNotificationProvider.java:99)
	at com.intellij.lang.javascript.psi.impl.JSCallExpressionImpl.accept(JSCallExpressionImpl.java:94)
	at com.intellij.psi.impl.source.tree.CompositePsiElement.acceptChildren(CompositePsiElement.java:65)
	at com.intellij.psi.PsiRecursiveElementVisitor.visitElement(PsiRecursiveElementVisitor.java:41)
	at com.intellij.lang.jsgraphql.ide.notifications.GraphQLScopeEditorNotificationProvider$1.visitElement(GraphQLScopeEditorNotificationProvider.java:99)
	at com.intellij.lang.javascript.psi.impl.JSExpressionStatementImpl.accept(JSExpressionStatementImpl.java:50)
	at com.intellij.psi.impl.source.tree.SharedImplUtil.acceptChildren(SharedImplUtil.java:185)
	at com.intellij.psi.impl.source.PsiFileImpl.acceptChildren(PsiFileImpl.java:754)
	at com.intellij.psi.PsiRecursiveElementVisitor.visitElement(PsiRecursiveElementVisitor.java:41)
	at com.intellij.lang.jsgraphql.ide.notifications.GraphQLScopeEditorNotificationProvider$1.visitElement(GraphQLScopeEditorNotificationProvider.java:99)
	at com.intellij.psi.PsiElementVisitor.visitFile(PsiElementVisitor.java:35)
	at com.intellij.psi.PsiRecursiveElementVisitor.visitFile(PsiRecursiveElementVisitor.java:60)
	at com.intellij.extapi.psi.PsiFileBase.accept(PsiFileBase.java:60)
	at com.intellij.lang.javascript.psi.impl.JSFileImpl.accept(JSFileImpl.java:92)
	at com.intellij.lang.jsgraphql.ide.notifications.GraphQLScopeEditorNotificationProvider.showNotification(GraphQLScopeEditorNotificationProvider.java:86)
	at com.intellij.lang.jsgraphql.ide.notifications.GraphQLScopeEditorNotificationProvider.createNotificationPanel(GraphQLScopeEditorNotificationProvider.java:49)
	at com.intellij.lang.jsgraphql.ide.notifications.GraphQLScopeEditorNotificationProvider.createNotificationPanel(GraphQLScopeEditorNotificationProvider.java:36)
	at com.intellij.ui.EditorNotifications$Provider.lambda$collectNotificationData$0(EditorNotifications.java:66)
	at com.intellij.ui.EditorNotificationsImpl.lambda$updateEditor$6(EditorNotificationsImpl.java:171)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$safeTransferToEdt$6(NonBlockingReadActionImpl.java:596)
	at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:200)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:873)
	at com.intellij.openapi.application.impl.ApplicationImpl$3.run(ApplicationImpl.java:511)
	at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:69)
	at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:112)
	at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:42)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:898)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:746)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:439)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:803)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:438)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106)
	at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:604)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:436)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:873)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:484)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
Caused by: java.lang.ClassNotFoundException: org.intellij.plugins.intelliLang.inject.InjectorUtils PluginClassLoader(plugin=PluginDescriptor(name=Maestro, id=com.github.mbolotov.playwrightintellij, descriptorPath=plugin.xml, path=~/Library/Application Support/JetBrains/Toolbox/apps/PhpStorm/ch-0/221.6008.16/PhpStorm.app.plugins/Maestro, version=1.1.2, package=null, isBundled=false), packagePrefix=null, instanceId=89, state=active)
	at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:215)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	... 70 more

Webstorm 2022.2 support

Hello.

First of all - thanks for a great plugin.
I'm using Webstorm 2022.2 EAP and it's not yet supported by plugin.
Can you please add a support for the latest version?

Thanks.

env: node: No such file or directory

When run test:

/Users/$USER/.nvm/versions/node/v16.14.2/bin/npx playwright test --reporter /var/folders/9j/hwjc9f0s7nvg_fvkvzhrr4r00000gn/T/intellij-playwright-reporter921040841234507514.js src/api/api-create-conf.spec.ts -g ^(.*[\\\/])?api-create-conf.spec.ts.API: Create conference and related stuff - events, calls
env: node: No such file or directory

Why?

Node exists
/Users/$USER/.nvm/versions/node/v16.14.2/bin/npx — working in console and exists. What's wrong and how to fix this?

Doesn't pick up the configuration automatically

Hi,

I'm giving a try to this extension but found an issue for my use case:

Configuration file not set automatically

My folder structure:

/app
  /tests
    /e2e
      test.spec.ts
  playwright.config.ts

The playwright.config.ts is not used when running the tests, which makes the tests fail (because I have a dedicated webServer.command).

Works after changing the Run Configuration setting, Program arguments option with the value -c /app/playwright.config.ts.

How can I define the --config flag?

I use NX and so my tests are fairly nested within a folder. The npm script I run to get headed tests is

yarn playwright test --config ./apps/my-app-e2e/playwright.config.ts --headed

I don't have anything special in the config file, but I suspect the testDir: './src/tests', field is what is causing this plugin to fail to find my tests?

Out of the box if I try to run a test from the gutter I get

Screenshot 2022-05-03 at 04 15 30

the console shows

/Users/zak/.nvm/versions/node/v14.17.1/bin/node /Users/zak/.nvm/versions/node/v14.17.1/lib/node_modules/yarn/bin/yarn.js run playwright test --reporter /var/folders/j8/hkdrcxfn7819nyspt0mqq0tm0000gn/T/intellij-playwright-reporter11570315857909753255.js optimize.spec.ts -g "^optimize.spec.ts.Optimize.should have the form initialised$"
yarn run v1.22.15
$ playwright test --reporter /var/folders/j8/hkdrcxfn7819nyspt0mqq0tm0000gn/T/intellij-playwright-reporter11570315857909753255.js optimize.spec.ts -g '^optimize.spec.ts.Optimize.should have the form initialised$'

nothing in that command has the relative path to the spec file so I think the config needs to be passed for discovery (or maybe the plugin can pass the full path directly?)

"No tests were found", but running the command output by yarn does work

I've had an issue that I think I managed to fix temporarily by uninstalling the plugin and reinstalling, but it has come back now.

When I run a test by clicking play in the margin, I get the following output:

/Users/zak/.nvm/versions/node/v16.14.2/bin/node /Users/zak/.nvm/versions/node/v16.14.2/lib/node_modules/yarn/bin/yarn.js run playwright test --headed --config ./apps/my-app-e2e/playwright.config.ts --reporter /var/folders/j8/hkdrcxfn7819nyspt0mqq0tm0000gn/T/intellij-playwright-reporter8187597544205581974.js test.spec.ts -g "^test.spec.ts.Example.should foo bar$"
yarn run v1.22.18
$ playwright test --headed --config ./apps/my-app-e2e/playwright.config.ts --reporter /var/folders/j8/hkdrcxfn7819nyspt0mqq0tm0000gn/T/intellij-playwright-reporter8187597544205581974.js test.spec.ts -g '^test.spec.ts.Example.should foo bar'

If I run the first command that was output, I get the same result:

$ playwright test --headed --config ./apps/my-app-e2e/playwright.config.ts --reporter /var/folders/j8/hkdrcxfn7819nyspt0mqq0tm0000gn/T/intellij-playwright-reporter8187597544205581974.js test.spec.ts -g '^test.spec.ts.Example.should foo bar'
##teamcity[enteredTheMatrix]
##teamcity[testingStarted]
##teamcity[testCount count='0']
##teamcity[testingFinished]
error Command failed with exit code 1.

however, if I then run the exact command that was printed by yarn, it works fine:

➜ playwright test --headed --config ./apps/my-app-e2e/playwright.config.ts --reporter /var/folders/j8/hkdrcxfn7819nyspt0mqq0tm0000gn/T/intellij-playwright-reporter8187597544205581974.js test.spec.ts -g '^test.spec.ts.Example.should foo bar'
##teamcity[enteredTheMatrix]
##teamcity[testingStarted]
##teamcity[testCount count='1']
##teamcity[testSuiteStarted nodeId='1756085739' parentNodeId='0' name='chromium' running='false' nodeType='suite' location
...etc

Any idea what I can fix to resolve this issue?

Question

I have a set of playwright tests which use a playwright.config.ts file to set the baseURL
How do I set the path to the config file in the test config?
It's in an NX repo with the e2e playwright tests in their own project .
The tests run from the command line when running in the run profile its faile to find the baseUrl variable the ts config

Any ideas

Run Configuration doesn't heed the runner configured nor the nodes environment from the IntelliJ Settings

The debugger seems to use the system node instead of the one configured. I am running on Ubuntu with IntelliJ Ultimate.

The error issued is:
You are running Node.js 12.22.9. Playwright requires Node.js 14 or higher. Please update your version of Node.js.

This is the version from /usr/bin/nodes

It looks like when I run intellij from an interactive shell, where nvm is configured properly, it works, But anyway, the plugin ignores the runner.

[Question] Default Run Config when enabled

Hi, leaving this question here for now.

When using Maestro and having the plugin enabled, it works great so far with running playwright. However, if I switch to another project within intellij that I used a different runner for (say protractor), it starts defaulting those test runs to the playwright maestro runner instead.

Is there anyway to fix that besides disabling Maestro plugin?

"Test directory" generates weird path

I setup my run configuration like this:

Screenshot from 2022-07-05 09-50-15

when I hit run, it generates the following command:

/usr/bin/node /home/samuelv/Projects/myproject/node_modules/@playwright/test/cli.js test --config=tests/playwright.config.ts --reporter /tmp/intellij-playwright-reporter260356059687260141.js ../../tests

which doesn't work. When I run the tests manually I just run npx playwright test --config=tests/playwright.config.ts, no directory necessary.

When I want to run a single file, I run npx playwright test --config=tests/playwright.config.ts <path relative to playwright.config.ts>, i.e. given the following directory:

node_modules/
tests/
  setup/
  usecases/
    login-and-logout.ts
  playwright.config.ts

I would run npx playwright test --config tests/playwright.config.ts usecases/login-and-logout.ts.

When I hit the "Run this test" button in the gutter, it generates a command like:

/usr/bin/node /home/samuelv/Projects/code_expert/node_modules/@playwright/test/cli.js test --reporter /tmp/intellij-playwright-reporter260356059687260141.js login-and-logout.ts -g ^login-and-logout.ts.Log in and log out$

which doesn't work for multiple reasons:

  1. it passes login-and-logout.ts when it should pass usecases/login-and-logout.ts
  2. it passes -g "^login-and-logout.ts.Log in and log out$, when it should either omit the ^ or prepend the whole path, i.e. usecases/login-and-logout.

[Feature Request] Add support for playwright fixtures

First off, I have to say that I am really loving Maestro, keep up the great work!

I'm currently introducing playwright fixtures to my workflow, and unfortunately this means that Maestro is unable to present the play buttons in the margin which is my primary workflow.

I'm guessing the plugin does something like finding usages of the test function imported from @playwright/test, however this doesn't work with fixtures as the test function import come from a local path instead.

I wonder if this can be fixed by adding a configuration panel to the plugin with a field to configure a regex that defines how the test function import should be matched?

on change of files - maestro debugging fails - need restart ide

it's happening since version 1.2

each time there's a change in the test data, the debug session button becomes white (instead of red) and it fails to catch the change

lets say i had a param:

let x=3

and then i changed to:

let x = 4

when i press debug, it will skip the change as if there wasnt a debug point there.
see image below of 'white debugging point'
image

only after restrat of the IDE it works.

Typescript support for playwright config

I'm running the demo SevlteKit app.
When I try to run the test suite using the configuration I get this error:

my-app – test ts 2022-12-16 at 9 34 50 AM

contexts of ./playwright.congif.ts

import type { PlaywrightTestConfig } from '@playwright/test';

const config: PlaywrightTestConfig = {
	webServer: {
		command: 'npm run build && npm run preview',
		port: 4173
	},
	testDir: 'tests'
};

export default config;

Does not work under Windows

This plugin does not work if I try to use it under Windows. It creates this command:

"C:\Program Files\nodejs\npx.cmd" playwright test --reporter C:\Users\xxxx\AppData\Local\Temp\intellij-playwright-reporter13237922888003142249.js tests\create-folders.spec.ts

The problem is the tests\create-folders.spec.ts. The plugin must replace the \ with a / (or with \\, but just a / should be better).

Unable to run tests

Hi,

I'm trying to run tests within Webstorm but I'm always getting errors.

I'm on Linux, Ubuntu 20, and I have WebStorm 2022.2.3 installed and I'm using Maestro 1.2

This is my config for this file:
image

And this is the result when I try to run the tests
image

Note: My playwright directory is in the same level as src.

If I select Headed or Debug then I get yarn: error: no such option: --headed or yarn: error: no such option: --debug

I'm wondering what I am doing wrong.

Thank you

Pattern Matching of Test Not Working -> Error: No tests found

Hi there,

I am trying to run a specific test.

When I run the test, it cannot find the test using the provided pattern.

image

Result:

image

If I copy over the command to a terminal and change it to something like this:

/var/lib/snapd/snap/bin/npx playwright test --reporter /tmp/intellij-playwright-reporter3214380591270717897.js tests/example.spec.ts -g get started link$

it works.

OS: Linux (Fedora)
IDE: Webstorm 2022.3.2
Plugin Version: 1.3.1

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.