lefthandedgoat / canopy Goto Github PK
View Code? Open in Web Editor NEWf# web automation and testing library, built on top of Selenium (friendly to c# also)
Home Page: http://lefthandedgoat.github.io/canopy/
License: MIT License
f# web automation and testing library, built on top of Selenium (friendly to c# also)
Home Page: http://lefthandedgoat.github.io/canopy/
License: MIT License
UI automation goes really fast, maybe they go a tiny bit slower if they are a wip test?
new context code will run only the wips in a given context, but if you have more than one context it will run the manys/tests for other contexts too.
Found a need for running a shared setup...trying to think of ways to run a shared setup between tests...here is one idea:
context(fun _ ->
describe "returning a borrowed game"
before(fun _ ->
logOff()
requestGame()
logOff()
)
test(fun _ ->
describe "borrower returns game"
loginAs "user2"
is (elementsWithText "#wantedGames .brand" "Borrowed").Length 1
click deleteGameLink
is (elementsWithText "#wantedGames .brand" "Borrowed").Length 0
)
test(fun _ ->
describe "lender marks game as returned"
loginAs "user1"
is (numberOfRequestedGames()) 1
click gameReturnedLink
is (numberOfRequestedGames()) 0
)
)
example:
click "#page1Element"
click "#page2Element"
between is a page transition and the implicit wait of the 2nd click will wait 5 seconds, but maybe the user should do an explicit wait via on "newurl".
log all actions in a collection then do some simple pattern matching to detect potential issues and print as warnings at the end of the test run.
The polling mechanism fails to see the right message for an element that fades in (it looks like it's capturing the last innerhtml of the element as opposed to the last one that wasn't blank) '
Video of bug: http://dl.dropbox.com/u/10614633/canopybug4.mp4
I get the following warning on the quit() method:
C:\Development\Oak\Sample Apps\BorrowedGames\BorrowedGames.UI.Tests\Program.fs(48,1): warning FS0020: This expression sh
ould have type 'unit', but has type 'bool'. Use 'ignore' to discard the result of the expression, or 'let' to bind the r
esult to a name. [C:\Development\Oak\Sample Apps\BorrowedGames\BorrowedGames.UI.Tests\BorrowedGames.UI.Tests.fsproj]
Just thought it would be in the canopy module. I tried using intellesense and typed
canopy.
and didn't see the before hook (turns out it was in the runner module):
In the message that reads "Element not found in the allotted time ..." where it says "elementTimeout <- 10" should read "elementTimeout <- 10.0"
... I know ... picking nits here.
does't look like elements with text polls, see video:
http://dl.dropbox.com/u/10614633/CanopyBug5.mp4
I've checked in the commit to borrowed games if you want to run it:
amirrajan/Oak@f8a886e
do it
UI automation test take a long time to run, would be good if canopy kept track of recent failures so it can run those tests first (this is going under the assumption that all tests are independent...so something they opt into)
Need some way to send key down
Got this output:
Passed
Suggestion: as a best practice you should check that you are on a page before
accessing an element on it
you were on about:blank
then on http://localhost:3000/Account/LogOn?ReturnUrl=%2f
Suggestion: as a best practice you should check that you are on a page before
accessing an element on it
you were on http://localhost:3000/Account/LogOn?ReturnUrl=%2f
then on http://localhost:3000/Account/Register
for the following test:
url "http://localhost:3000"
click "a[href='/Account/Register']"
write "#Email" email
write "#Password" "Password"
write "#PasswordConfirmation" "Password"
click "input[value='register']"
url "http://localhost:3000/account/logoff"
let is expected actual =
if expected <> actual then System.Console.WriteLine("FAIL") else System.Console.WriteLine("PASS")
()
5 |> is 3
is true false
is true true
I started using elementsWithText and found myself wanting to pass the output into a click method.
It would be nice if I could do:
click (elementsWithText "#wantedGames .brand" "Borrowed").Head
or
click (elementWithText "#wantedGames .brand" "Borrowed")
(I may lean towards wanting this feature for write, read, etc)....thoughts?
there are times where (with browser switching), I want to be able to see window side by side, this can be done through javascript and would be nice if there was a method to tile a set of browser windows. Here are links to manipulate windows via javascript:
get current resolution of monitor:
http://www.w3schools.com/jsref/prop_screen_width.asp
move window:
http://www.w3schools.com/jsref/met_win_moveto.asp
resize window:
http://www.w3schools.com/jsref/met_win_resizeto.asp
Need a way to clear what's in a text box. The write method appends to what's already in the text box. Do you think it'd be better for write to just clear what's there and write the new value?
Would be nice to have a sleep method that understood seconds. So I don't have to enter System.Threading.Thread.Sleep(milliseconds).
The UI automation goes really fast, so when I'm authoring a test, there are times where I want things to happen more slowly, thoughts?
Aaron had a great suggestion.
When running a test in wip mode, highlight the element that is being interacted with.
I am thinking set the current element to an orange color, then when done set it to yellow to show that it was interacted with at some point in the test.
Can we get a value from the DOM? In jQuery, I'd go
var x = $('#hiddenField').val();
Can we do this with canopy? If so, how?
the quit() method needs to close all browser if there are multiple browsers open
there are times where I want to comment out a test. would be nice if there was a method called xtest so that I can turn this:
test(fun _ -> describe "registering a user" reset() registerUser "[email protected]")
into
xtest(fun _ -> describe "registering a user" reset() registerUser "[email protected]")
as opposed to having to do
//test(fun _ -> // describe "registering a user" // reset() // registerUser "[email protected]")
if one test fails dont run anymore tests in that script
Is there a way to double click an element?
I need the ability to say that a css selector "#requestedGames a" has a certain number of elements (needs to poll simliar to how *= and *!= polls)
It would be helpful to have a runtime mode for a script that ran at WIP speeds but used some form of on screen cursor to highlight the element that the script is currently inspecting or changing. For instance, a colored semi-transparent overlay shown over the element currently being read, with one color reserved to display a read and a different color to show that it's modifying the element.
This code worked on
http://scrumy.com/silenter39delayed
let (>>) a b =
let a1 = element a
let b1 = element b
(new Actions(browser)).DragAndDrop(a1, b1).Perform();
start firefox
url "http://scrumy.com/silenter39delayed"
click ".plus-button a img"
"#task_title" << "Demo"
click "#task_editor_buttons .save_button"
".handle" >> ".inprogress"
speculation for research tomorrow. context starts null so when you go to print it you probably get null ref.
got latest, but now the test fails for a different reason, link to video: http://dl.dropbox.com/u/10614633/canopybug2.mp4
Ctrl, + if the video is too small
The spectator mode is great when the script actually finds what it's looking for but it's common for a script to be stuck trying to find something that is actually not on the page. It would be helpful to show a blinking green light (analogous to a hd seek indicator light) with the locator (xpath/css/etc) of the thing it's looking for.
got tripped up on using *=. I forgot to include something in the CSS selector that I used which caused the failure. It would be good if the failure message contained all the innerhtml that WAS found (it would have shown me that I had the CSS selector partially wrong)
If a failure in click, type or etc occurs, canopy should tell me if it failed because it couldn't find the element or it failed because the element was in the dom but not visible (these kind of hints would help in diagnosing problems)
Ability to verify a message in an modal alert box (and dismiss it).
maybe something like the following commands:
alert() == "Your item has been saved"
clickOk()
clickCancel()
Create it for them if it doesn't exist!
Would be nice if there was a function that could be set that would be initially consulted before allow a click or write to continue.
For example:
waitFor <- loadingDivToDisappear()
click "#save" //this would wait until loadingDivToDisappear() returns
with multiple browsers (and when a failure occurs), it's hard to tell which browser had the failure. some visual indicator or something in the console stating which browser is currently selected would be good.
jQuery provides the pseudo-selectors ":first" & ":last".
Is there a way to grab just one? I'd like to arbitrarily grab the nth child element.
Got a failure stating that an element couldn't be found in the allotted time. Would be nice if the failure would tell me that I have the ability to increase the time outs (compareTimeout, elementTimeout, pageTimeout).
Example:
"Element not found in the allotted time. If you want to increase the time, put elementTimeout <- {your new time} at the beginning of your test file, k thnks bye"
Need some way to assert that an element exists on that page, or doesn't exist. It should poll for the existence of the element (like write does).
Maybe something along the lines of:
isThere "#requestedGames div"
and
isNotThere "#requestGames div"
When running UI tests, I got a warning stating that I didn't do url validation when all of my helper methods validate the url, Video attached:
change element function to test for visiblity, add domElement that returns anything w/o doing a vislibity test.
element is visible on page but is not clickable immediately it looks like.
Adding random thread.sleeps solved the issue, but maybe reliability should be built into the click method to try multiple time if an element isn't immediately found.
Here is a link to a video that I recorded showing the problem.
If the video resolution is too high using ctrl+- to make the video fit.
displayed "somecss" would poll until the element shows up
notDisplayed "somecss" would poll until the element goes away
Need to be able to specify a value in a dropdown like
"#ID" << "Value"
If "Value" isn't a valid choice, it should fail.
Need a way to find an element with a given innerHtml/text:
elementWithText "cssSelector" "regex"
I would say the the second parameter should be a regex string
If a css selector fails, it would be nice of the framework helped the developer find what the problem is. for example:
if someone defines an element with the following misspelling "grwlInfo", and in the test they say
".growlInfo" == "some message"
it would be good if canopy could say:
unable to find element growlinfo, did you mean grwlinfo?
We can currently assert that an element is exactly equal to a value with "selector == value". Can we have one that says that the element has the value somewhere inside it?
If it could honor Regex, that would be fantastic! Like ...
selector .= /regex/;
or
selector.match(/regex/)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.