Advertisement
Guest User

Untitled

a guest
Mar 29th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var url = 'http://c3605h5.saig.frd.global';
  2.     testString = 'To Do List';
  3.     testSuccess = 'Verify "To Do List" exists.'
  4.  
  5.  
  6. casper.test.begin('Login Tests', 4, function (test) {
  7.     casper.start(url, function () {
  8.  
  9.        
  10.         test.assertTitle("Compliance 360", "Verify homepage title is Compliance 360");
  11.         test.assertExists('form[name="Default"]', "Verify main form exists");
  12.         //fill in the 3 fields with login info
  13.        
  14.         casper.fill('form[name="Default"]', {
  15.             Organization: 'c3605h5',
  16.             UserName: 'admin',
  17.             Password: 'password'
  18.         }, true);
  19.  
  20. /*
  21. test.assertExists('#Login', "Verify Login Button exists");
  22. casper.then(function() {
  23. //Click login button
  24. this.click('#Login');
  25. });
  26. */
  27.  
  28. var loginBtn = document.getElementById("Login");
  29.  
  30. test.assertExists(loginBtn, "Verify Login Button exists");
  31.  
  32. casper.then(function() {
  33.   this.evaluate(function() {
  34.     document.getElementById("Login").click();
  35.   });
  36. });
  37.  
  38. casper.then(function() {
  39.     console.log('After attempting to click, url is now: ' + this.getCurrentUrl());
  40. });
  41.  
  42.         //Test for "to do" text on page
  43.         test.assertTextExists(testString, testSuccess);
  44.  
  45.     });
  46.  
  47.     casper.run(function () {
  48.         test.done();
  49.     });
  50. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement