-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple browsers run tests #190
Comments
I think I have a reasonable solution: In your version of canopy locally paste this in runner.fs at the very bottom
Then in your program.fs replace run() with this
The runFor function will take a list of browsers (start modes) and create a new context for each and open that browser. It takes the list of suites/tests you have defined and duplicates them after each browser you want. It works for me locally. Please test it and see if it gives you the desired results. If it does I will do a nuget build! |
This works perfectly, thanks! On Fri, Apr 3, 2015 at 11:41 AM, Chris Holt [email protected]
|
How about adding possibility to use browser instances instead of only browser start modes? I use phantomjs which I need to start in a rather special way for authentication to work properly (SharePoint site using claims authentication). Scope creeping: -----Original Message----- This works perfectly, thanks! On Fri, Apr 3, 2015 at 11:41 AM, Chris Holt [email protected]
— |
I will work on getting instance to work also. It shouldn't be hard. For parallel there is a problem. 'browser' is a static instance of the current browser that is being used. Since there can be only one all your parallel tests would be fighting over the browser and it would not play nice. I havent tried it but this may be a solution https://msdn.microsoft.com/en-us/library/system.threadstaticattribute%28v=vs.110%29.aspx If I start each parallel run in its own thread it seems like it would have an instance of the browser per thread and not cause conflicts. At the moment I haven't tried it. Do you have any knowledge of how ThreadStatic works? |
I haven't tried the ThreadStatic attribute but it looks pretty I think that there is a need for some refactoring to make it work. The I will give it a go, however it might take me a little while ... On 4 April 2015 at 20:41, Chris Holt [email protected] wrote:
|
Ok cool, I have some ideas in my head too try to make it work (other than thread static). I will try to do some proof of concept works around that. Tonight I will change the runFor method to also accept already running browsers instances so you can try that out too. |
@soerennielsen try this. For me it works for already started browsers or start modes.
|
This is available now in the latest nuget. |
@lefthandedgoat where should the drivers for the multiple browsers live? We have it setup so that there is a "driver" folder in the solution where the chrome driver is at. Is this where we would put the firefox and IE drivers too ? |
@manishdube You can, I use nuget packages to manage drivers https://www.nuget.org/packages/Selenium.WebDriver.ChromeDriver/85.0.4183.3800-beta |
@lefthandedgoat thanks again. I installed the packages but when in Program.fs i try to replace run() with i get an error FS0001: This expression was expected to have type� 'Browsers' �but here has type� ''a list' |
You have to use one of these types: Line 117 in cfe3fa1
|
Try
|
when i comment // run() and use runFor (BrowserStartModes [chrome; firefox; ie]) i still see compile errors :| Sorry Im being embarrassing i know but not sure how to get past this? ... @lefthandedgoat |
@manishdube what version of canopy and dotnet are you using? What are the compile errors? |
.NET Framework 4.7 and Canopy 2.1.5 @olivercoad module Program =
// 0 ` |
@manishdube not sure what TestRunner and ArguParser are so can't try your code. Are they other files in your project? If you look at the implementation of Try doing
|
Thanks @olivercoad your suggestion worked.
|
anyway this could be extended to the browser Edge ? |
Allow for multiple browsers (chrome, ff, ie) to run your test suite and report to TeamCity.
The text was updated successfully, but these errors were encountered: