Last active
December 18, 2015 12:08
-
-
Save ianpetzer/5780226 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test("Check editing of a book updates search results", function() { | |
expect(7); | |
visit("/").then(function() { | |
return click("#searchButton"); //Click the search button | |
}).then(function() { | |
throws( | |
function() { | |
find(".searchResult h2:contains('The Great Modification')") ; | |
}, | |
"No existing called the Great Modification" | |
); | |
return click(".searchResult h2:contains('The Great Gatsby') ~ a"); //Select the search result for The Great Gatsby | |
}).then(function() { | |
equal($.trim(find(".tags ul li:first").text()), "Fiction", "Found first tag"); | |
equal($.trim(find(".tags ul li:eq(1)").text()), "Classic", "Found second tag"); | |
return click("#editBook"); //Click the search button | |
}).then(function() { | |
equal(find(".titleInputBox").val(), "The Great Gatsby", "Found book title input box"); | |
fillIn(".titleInputBox", ".editBook", "The Great Modification"); | |
equal(find(".titleInputBox").val(), "The Great Modification", "Title of book changed on edit page"); | |
return click(".saveEditsToBook"); //Save the changes | |
}).then(function() { | |
return click("#searchButton"); //Click the search button | |
}).then(function() { | |
ok(exists(".searchResult h2:contains('The Great Modification')"), "Retrieved modified title from search list"); | |
throws( | |
function() { | |
find(".searchResult h2:contains('The Great Gatsby')") ; | |
}, | |
"The Great Gatbsy title has been changed in the search results!" | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should be good to rename .txt to .js to be more easy to read. Btw it is a good example.