Advertisement
talkingtree

UI Login Test

Mar 19th, 2011
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. component extends="mxunit.framework.TestCase" displayName="Positive Login Tests" output="false" {
  2.  
  3.     // Do before all tests in this file
  4.     public void function setUp() {
  5.         // dataproviders must be in the variables scope
  6.         variables.ValidUsersAll = application.dataproviders['ValidUsersAll'];
  7.         variables.selenium = application.selenium;
  8.     }
  9.    
  10.     // Do after all tests in this file
  11.     public void function tearDown() {
  12.      
  13.     }
  14.  
  15.     // ================ TESTS ================
  16.  
  17.     /**
  18.     * Tests successful login of a user;
  19.     * @mxunit:dataprovider ValidUsersAll
  20.     */
  21.     public void function login_ValidUser_Success_test(required Query argQuery){
  22.         // force logout of any lingering logins
  23.                 LoginPage.logOut();
  24.  
  25.         // Page Object Model - Single snippet that models some page interaction
  26.         LoginPage = new UITests.webtops.awebtop.Pages.Login.Login(selenium);
  27.         LoginPage.login(argQuery.userid, argQuery.password);
  28.  
  29.                 // move the following to a Disclaimer Page model
  30.         assertTrue(selenium.isTextPresent("Do you agree to the disclaimer below?"));
  31.         LoginPage.AgreeButton();
  32.  
  33.         assertEquals(selenium.getTitle(), "An Enterprise Application");
  34.         selenium.selectFrame("main");
  35.         selenium.selectFrame("relative=up");
  36.         assertTrue(selenium.isTextPresent("Welcome #argQuery.firstName# #argQuery.lastName#"));
  37.        
  38.         LoginPage.logOut();
  39.         assertTrue(selenium.isTextPresent("You are now logged out."));
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement