Created
          August 28, 2011 09:28 
        
      - 
      
 - 
        
Save stirno/1176470 to your computer and use it in GitHub Desktop.  
    Fluent Automation API Sample
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | using FluentAutomation.API; | |
| using FluentAutomation.API.Enumerations; | |
| using Microsoft.VisualStudio.TestTools.UnitTesting; | |
| namespace FluentAutomation.Samples | |
| { | |
| /// <summary> | |
| /// Fluent Automation API for the Web - http://www.stirno.com/fluentautomation | |
| /// </summary> | |
| [TestClass] | |
| public class LoginTests : TestClass | |
| { | |
| [TestMethod] | |
| public void Login_HappyPath() | |
| { | |
| I.Use(BrowserType.InternetExplorer); | |
| I.Open("http://www.yoursite.com/Login"); | |
| // Validate expected strings on page | |
| I.Expect.This("Username").In("label.username-field"); | |
| I.Expect.This("Password").In("label.password-field"); | |
| // Perform login | |
| I.Enter("username").In("input.username-field"); | |
| I.Enter("password").In("input.password-field"); | |
| I.Click("input[type='button'].login"); | |
| // Validate login successful | |
| // Forwarded correctly | |
| I.Expect.Url("http://www.yoursite.com/"); | |
| } | |
| [TestMethod] | |
| public void Login_BadPassword() | |
| { | |
| I.Use(BrowserType.InternetExplorer); | |
| I.Open("http://www.yoursite.com/Login"); | |
| // Validate expected strings on page | |
| I.Expect.This("Username").In("label.username-field"); | |
| I.Expect.This("Password").In("label.password-field"); | |
| // Perform login | |
| I.Enter("username").In("input.username-field"); | |
| I.Enter("wrong password").In("input.password-field"); | |
| I.Click("input[type='button'].login"); | |
| // Validate login successful | |
| // Error shown | |
| I.Expect.This("Username/password not correct.").In("div.error"); | |
| } | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment