lefthandedgoat / canopy

f# web automation and testing library, built on top of Selenium (friendly to c# also)
http://lefthandedgoat.github.io/canopy/
MIT License
507 stars 115 forks source link

Parallel support #410

Closed haf closed 6 years ago

haf commented 6 years ago

I think we should rid ourselves of the global variables as well; move all those to a record and keep that with the browser instance.

haf commented 6 years ago

Also, we should have an opt-in warning of using the global browser instance/alt opt-in crash on using it.

lefthandedgoat commented 6 years ago

You mean pass in all options when you start the browser?

I moved them all to a record and made it mutable one time, and it was not that great.

haf commented 6 years ago

Not sure how yet. I haven't looked into it; but passing around a context with that configuration is a nice way to make it thread safe. We'll still have the singleton static for the non-thread-safe default.

lefthandedgoat commented 6 years ago

Yes I am happy with anything that is 'more correct'.

Ultimately need two results:

1) Mostly backwards compat 'classic' version, people like it because its low barrier of entry and really simple/clean API, even though its not idiomatic. 2) Idiomatic F# + Parallel friendly version. I don't have conventional feelings about what idiomatic F# is, so I am happy to follow community guidelines there.

haf commented 6 years ago

If you can add travis testing it would ensure I don't inadvertently break something.

haf commented 6 years ago

I think I have something that could work... Now it needs testing. I'm going to revert all XX functions now.

haf commented 6 years ago

Also, it would be nice to have this running on .Net Core and perhaps even on NodeJS?

lefthandedgoat commented 6 years ago

There is another WIP for .net core support, but I think its stale.

When you say node js, you mean a javascript version of the library?

haf commented 6 years ago

Food time

haf commented 6 years ago

Ok, that's that. Compiles again and should support passing the browser. Next up:

haf commented 6 years ago

I'm not going to tackle the naming yet.

haf commented 6 years ago

To consider: making the thread sleep async in wait.fs.

haf commented 6 years ago

What do you say about moving the test framework to another assembly to keep it lean?

haf commented 6 years ago

You should definitely document companion.fsx — it looks sweet!

lefthandedgoat commented 6 years ago

For now I would like to keep the runner part together.

You can check out companion here: https://chrome.google.com/webstore/detail/canopy-companion-css-sele/jehfnloleecojodohcdfpbhjahhaplje

It works pretty well!

haf commented 6 years ago

Nice tool :)

A split would look like this:

Canopy.Core — what was just changed
Canopy — depends on Canopy.Core and Canopy.Runner
Canopy.Runner — the runner

That way, people who reference Canopy still get the same stuff.

I convert this to .Net Core if you let me.

haf commented 6 years ago

Also; can I convert the naming of modules to F# standard PascalCase?

lefthandedgoat commented 6 years ago

I am fine with PascalCase for everything except classic mode. Converting to .Net core is great also. I am not a fan of code organization through assemblies, but I will think on it.

haf commented 6 years ago

Left to do: sort out the TODOs about global variables and configuration. Leaving for the evening. Parallel running should work now.

I'm thinking we have supply a Context = { browser: IWebDriver; conf: CanopyConfig } and then we have a type that exposes all functions from Canopy.Core curried with the browser instance; that way we can create a browser instance with all the convenience functions and still be thread safe.