Advertisement
Guest User

Untitled

a guest
May 30th, 2015
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. /*
  2. Author: Prateek
  3. Description: This is a casperjs automated test script for showing that, Clicking on the Stop button does not show the results of the cancelled cells
  4. */
  5. //Test begins
  6. casper.test.begin(" After stopping the execution, for cancelled cells result is not displayed", 6, function suite(test) {
  7.  
  8. var x = require('casper').selectXPath;
  9. var github_username = casper.cli.options.username;
  10. var github_password = casper.cli.options.password;
  11. var rcloud_url = casper.cli.options.url;
  12. var functions = require(fs.absolute('basicfunctions'));
  13. var input= 'a<-12; print a';
  14. var errors = [];
  15.  
  16.  
  17. casper.start(rcloud_url, function () {
  18. casper.page.injectJs('jquery-1.10.2.js');
  19. });
  20. casper.wait(10000);
  21.  
  22. casper.viewport(1024, 768).then(function () {
  23. functions.login(casper, github_username, github_password, rcloud_url);
  24. });
  25.  
  26. casper.viewport(1024, 768).then(function () {
  27. this.wait(9000);
  28. console.log("validating that the Main page has got loaded properly by detecting if some of its elements are visible. Here we are checking for Shareable Link and Logout options");
  29. functions.validation(casper);
  30. });
  31.  
  32. functions.create_notebook(casper);
  33.  
  34. casper.then(function(){
  35. //this.click({type:'xpath', path:".//*[@id='command-prompt']/div[2]/div"});
  36. this.wait(2000);
  37. this.sendKeys(({type:'xpath', path:".//*[@id='command-prompt']/div[2]/div"}, input, {keepFocus: true}));
  38. this.page.sendEvent("keypress", casper.page.event.key.Enter);
  39. });
  40.  
  41. casper.wait(3000);
  42.  
  43. //Registering to the page.errors actually not required but still if there are some errors found on the page it will gives us the details
  44. casper.on("page.error", function(msg, trace) {
  45. this.echo("Error: " + msg, "ERROR");
  46. this.echo("file: " + trace[0].file, "WARNING");
  47. this.echo("line: " + trace[0].line, "WARNING");
  48. this.echo("function: " + trace[0]["function"], "WARNING");
  49. errors.push(msg);
  50. });
  51.  
  52. casper.run(function() {
  53. if (errors.length > 0) {
  54. this.echo(errors.length + ' Javascript errors found', "WARNING");
  55. } else {
  56. this.echo(errors.length + ' Javascript errors found', "INFO");
  57. }
  58. test.done();
  59. });
  60. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement