Skip to content
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

Expose handy selenium wrappers to C# #327

Closed
KevM opened this issue Jan 12, 2017 · 13 comments
Closed

Expose handy selenium wrappers to C# #327

KevM opened this issue Jan 12, 2017 · 13 comments

Comments

@KevM
Copy link
Collaborator

KevM commented Jan 12, 2017

I am working on a team with zero F# experience and intent to adopt F# πŸ™β€β™‚οΈ I'm working on that but in the meanwhile we are starting to do a lot of end to end testing with Selenium. I am running into issues where their polling FindElement(s) wrappers are not as battle tested as Canopy's.

What if we could export the excellent mechanisms to be something consumable in C#. Maybe a string extension or some such. No idea where this could go but not re-inventing the Selenium wrapper wheel in C# would be really nice.

@lefthandedgoat
Copy link
Owner

I will make a new class that exposes everything properly to C#.

I can work on that some today. It should not be too hard fortunately.

@lefthandedgoat
Copy link
Owner

Before I go further, can you look at the C# version

https://github.com/lefthandedgoat/canopy/blob/cswrapper/csharptests/Program.cs

compared to the F# version

https://github.com/lefthandedgoat/canopy/blob/cswrapper/tests/basictests/Program.fs

And see that the API is acceptable to you?

lefthandedgoat added a commit that referenced this issue Jan 12, 2017
lefthandedgoat added a commit that referenced this issue Jan 13, 2017
@lefthandedgoat
Copy link
Owner

I actually think I am done. Give the commits a review and let me know what you think.

@KevM
Copy link
Collaborator Author

KevM commented Jan 13, 2017

Thank you! I like it. I'll have some time next week to put together a POC. We have a whole lot of tests that might be a lot more reliable on top of something like Canopy.

@lefthandedgoat
Copy link
Owner

Ok cool. I will do a build tonight/tomorrow for you and publish to nuget.

@lefthandedgoat
Copy link
Owner

https://www.nuget.org/packages/canopy/1.1.0

Please let me know if you have any problems, find gaps, or need help!

Enjoy!

@amirrajan
Copy link
Collaborator

Worth mentioning here. /cc @KevM

Consider using indexers:

_.test["Value 1 listed in #value_list"] = () =>
{
    _.url(testpage);
    _.startEq("", "");
}
public Action this[string key]
{
    set { /* */ }
}

@spindev
Copy link

spindev commented Jan 24, 2017

We're a C#-Dev team, too. All testing in nunit so far. I started with canopy in f# as a poc for web testing and the team was excited. Now I discovered the new C# wrapper, which fits completely our needs.

Currently I'm getting the following exception when using _.displayed(".alert-danger"):

canopy.types+CanopyNotStringOrElementException : Can't check displayed on canopy.core+value@1034-1 because it is not a string or webelement

A short look at csharp.fs shows:

+    static member selected selector = selected value
+
+    static member deselected selector = deselected value
+
+    static member displayed selector = displayed value
+
+    static member notDisplayed selector = notDisplayed value
+
+    static member enabled selector = enabled value
+
+    static member disabled selector = disabled value

It should be selector instead value, shouldn't it?

Sorry when I posted it in the wrong section. I'm still very new to the github workflow :-)

Thanks in advance!

@lefthandedgoat
Copy link
Owner

Yep you found a bug. Let me fix it and review all the other methods for copy/paste errors and I will create a new build for you.

@lefthandedgoat
Copy link
Owner

Good find. Sorry the whole thing was done rather quickly with limited testing. You can find a fixed build here:

https://www.nuget.org/packages/canopy/1.1.2

Thanks again!

@spindev
Copy link

spindev commented Jan 24, 2017

I have to thank for the quick response and the new nuget package.

@lefthandedgoat
Copy link
Owner

Sure no problem!

@amirrajan
Copy link
Collaborator

@lefthandedgoat this has been done right? Link?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants