TestStack / TestStack.Seleno

Seleno helps you write automated UI tests in the right way by implementing Page Objects and Page Components and by reading from and writing to web pages using strongly typed view models.
http://teststack.github.com/TestStack.Seleno/
MIT License
180 stars 60 forks source link

AngularJS support #190

Open jason-roberts opened 9 years ago

jason-roberts commented 9 years ago

Hi all, been thinking about this for a little while and someone on the Pluralsight discussions also asked how to test SPA apps with Seleno.

Was just wondering regarding angular in particular, what the recommended approach is with Seleno? There is this .NET port of protractor (https://github.com/bbaia/protractor-net/search?utf8=%E2%9C%93&q=WaitForAngular) that checks to see if DOM is ready after client side angular changes. Would be truly great to be able to use Seleno (in conjunction with other .NET libs eg BDDfy etc) to test angular apps - especially for .NET APS.NET devs using Visual Studio etc to write the actual app - for them to be able to stay in the ".NET world".

Just thinking out loud :)

robdmoore commented 9 years ago

Hi Jason,

Short answer is yes - you can definitely use Seleno for testing Angular apps.

Longer answer: I think there is some features that are probably needed to make it easier. I know that @mwhelan was looking into adding some a while back - not sure if you got anywhere with that mate?

That WaitForAngular method in the protractor port is the sort of thing I'm thinking. It would be interesting for one of us to get across that protractor port and see what it has that isn't in Seleno and then add anything that makes sense. I think the value you get in Seleno means that it's worth using it for testing SPAs.

robdmoore commented 9 years ago

btw - it probably makes sense to release a TestStack.Seleno.Angular package if we end up adding Angular specific code in there. Like what we will eventually get around to for MVC (btw - I got about 50% of the MVC split out working on my computer late last year).

jason-roberts commented 9 years ago

Yeah I was thinking the same about sep package, also would be awesome to be able to use Seleno page object models for angular apps, not sure what changes might be required for that though (e.g. when a whole new angular view is loaded, etc" ??

Another option is to have a config setting that can be enabled to automatically add angular waits after all page interactions?? From a Seleno end-user perspective this could be amazing - may also be useful if a site (e.g. ASP.NET MVC) is mostly non-SPA with small pockets of SPA...

Alternately on the page object have a "SPA wait provider" (with maybe an angular provider to start with) that will automatically be used if set to wait for DOM ready?

Sorry just blurting out random ideas :)

robdmoore commented 9 years ago

I like where you are going with that thinking.

If we can take care of waiting as a cross cutting concern that would be awesome.

Then the only thing left is if we need new selectors e.g. To pick up scope values or something?

On 1 Jan 2015, at 1:51 pm, Jason Roberts notifications@github.com wrote:

Yeah I was thinking the same about sep package, also would be awesome to be able to use Seleno page object models for angular apps, not sure what changes might be required for that though (e.g. when a whole new angular view is loaded, etc" ??

Another option is to have a config setting that can be enabled to automatically add angular waits after all page interactions?? From a Seleno end-user perspective this could be amazing - may also be useful if a site (e.g. ASP.NET MVC) is mostly non-SPA with small pockets of SPA...

Alternately on the page object have a "SPA wait provider" (with maybe an angular provider to start with) that will automatically be used if set to wait for DOM ready?

Sorry just blurting out random ideas :)

— Reply to this email directly or view it on GitHub.

jason-roberts commented 9 years ago

Maybe scope/model selectors would be best in a separate package? Or is this something that makes sense, rather than just selecting elements in the normal existing way? Interesting ideas though :) I think maybe adding the wait provider is a good first step, once that's released then the extra value adds like selectors? I'm sure there's a whole can of worms that can be opened ;)

justinhomes commented 7 years ago

was there a package created for this? or is current nuget have support for angular?