We are using browser library for UI tests automation. We are using Robot listener’s “close” method to move all reports (including playwright-log) generated during the execution to some other folder. However, We are running into an issue while moving the reports since logs are still being written to playwright-log.txt file while movement of reports are under progress. We assumed that Robot’s listener “Close” method is the last one that goes to execution. Looks like it is not. Please advise on a way to achieve this
Hi Bhushan,
If the playwright-log is still being written to that would indicate it’s still in use? perhaps add this to your Suite Teardown:
Close Browser ALL # Closes all browsers
I also had a look at the documentation for the import options of Browser Library, there doesn’t appear to be a way to set the location for the playwright-log file, but if you ask they might add the option to Browser Library, this might be better log term solution rather than moving it afterwards.
Dave.
Thanks for the response.
Using ‘Close Browser’ keyword did not solve the problem. Just to elaborate on what we are doing, In Robot listener ‘close’ function, We are calling a python snippet that moves all the reports/logs generated by robot/browser framework to some shared drive for future reference. We are able to move all the other files except the playwright-log.txt since it looks it was still being written to, even when we are in listener close method which is actually the last function to be executed as per Robot framework. We are under impression that everything would be completed by the time execution reaches close function of the listener. We see the same issue even when we used ‘Close Browser’ keyword in suite tear down. Any suggestions would be appreciated
Hi Bhushan,
I understood your problem, I was hoping that closing the browser would cause playwright to exit and stop writing to the log file, seems it wasn’t that easy.
And from reading the Listener documentation I’m under the same impression as you, so I can’t see anything wrong with what your trying to do.
I don’t know enough about the Robot Framework internals to give any better info so hopefully someone else can jump in
I was suggesting to ask the Browser Library team if they can give an option to control where the playwright log gets written (raise a feature request here) because if you can direct the file to be written where you want it that’s better than trying to move it later. Unfortunately this is a longer term solution
Dave.