manykarim / robotframework-doctestlibrary

Robot Framework DocTest library. Simple Automated Visual Document Testing.
Apache License 2.0
46 stars 20 forks source link

VisualTest init broken: IntelliJ Idea robotframework-languageserver can't import DocTest.VisualTest #44

Open eliaspaulpeschke opened 2 years ago

eliaspaulpeschke commented 2 years ago

I'm on MacOs 12.3 using IntelliJ Idea. When I import DocTest.VisualTest, IntelliJ Idea (with the newest languageserver plugin) tells me the following:

Unresolved library: DocTest.VisualTest. Error generating libspec: Initializing library 'DocTest.VisualTest' with no arguments failed: OSError: [Errno 30] Read-only file system: '/screenshots'

The Problem has to do with VisualTest.__init__(), because, when I outcomment both the os.makedirs() statements in there in my site package, everything works as expected - minus the screenshots, sadly. For me, it looks like the library needs another way of handling the screenshot directory, but i'm not apt enough to make that into a sensible pull request right now.

manykarim commented 2 years ago

Oh wow, thanks a lot for reporting that. Unfortunately I have no access to any MacOS here. Need to think about how to test that properly. I'll look into it how other libraries solve similar cases on MacOS and come back to you.

Does it help if you start the test execution from a folder for which you have write access? Or create the screenshots folder there before manually?

manykarim commented 2 years ago

I'm sure we'll find a solution together and you can do the pull request. I believe my problem is, trying to create that screenshot folder in the current directory. I should ensure to create it inside the output directory of Robot Framework...

eliaspaulpeschke commented 2 years ago

The tests were all in a folder where I had write access - I started them via a gradle task that starts a python script though, maybe the problem lies somewhere there. I got it to run on my machine by importing it with the Import Library keyword instead of in the resources file's settings section. Maybe creating the screenshot directory - if it doesn't exist yet - when a screenshot is actually produced would be the solution here. Selenium does it that way it seems.