Created
April 22, 2015 19:57
-
-
Save rafaelcs/38c96d41fcc9d348b668 to your computer and use it in GitHub Desktop.
Example to run Nunit in order
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using NUnit.Framework; | |
using OpenQA.Selenium; | |
using OpenQA.Selenium.Chrome; | |
using OpenQA.Selenium.Support.UI; | |
using OpenQA.Selenium.Remote; | |
using OpenQA.Selenium.Interactions; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
namespace Serviços__SSX_.Website | |
{ | |
public class EfetuaReservaSomenteReserva | |
{ | |
public IWebDriver driver; | |
public String baseURL; | |
[TestFixtureSetUp] | |
public void Setup() | |
{ | |
baseURL = "http://site.com"; | |
driver = new ChromeDriver(@"D:\automatedtests\tools\drivers"); | |
driver.Manage().Window.Maximize(); | |
} | |
[Test] | |
public void a_AcessarSistema() | |
{ | |
driver.Navigate().GoToUrl(baseURL); | |
} | |
[Test] | |
public void b_FazerLoginB2B() | |
{ | |
driver.FindElement(By.Id("p_lt_ctl01_LoggedMenu_1_lkbMyReserves")).Click(); | |
} | |
[Test] | |
public void c_EfetuarPesquisa() | |
{ | |
driver.FindElement(By.CssSelector("#tabsX > li.Atividades > a")).Click(); | |
driver.FindElement(By.Id("p_lt_ctl03_pageplaceholder_p_lt_ctl01_SSXBuscador_1_txtSearchLocation_txtDestinations_txtDescription")).SendKeys("fortaleza"); | |
WebDriverWait esperaAutoPreenchimentoLocal = new WebDriverWait(driver, TimeSpan.FromSeconds(10)); | |
esperaAutoPreenchimentoLocal.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(".ac_results"))); | |
} | |
[Test] | |
public void d_SelecionaAtividade() | |
{ | |
driver.FindElement(By.Name("selecionar")).Click(); | |
} | |
[Test] | |
public void e_PreencheDadosReserva() | |
{ | |
driver.FindElement(By.Id("adultName00")).SendKeys("rafael"); | |
new Actions(driver).MoveToElement(driver.FindElement(By.Id("bornDate00"))).Click().SendKeys("10021991").Build().Perform(); | |
SelectElement sexo = new SelectElement(driver.FindElement(By.Name("sexo"))); | |
sexo.SelectByValue("m"); | |
driver.FindElement(By.Id("lblOnlyBooking")).Click(); | |
new Actions(driver).MoveToElement(driver.FindElement(By.Id("txtCellphoneDDD"))).Click().SendKeys("51").Build().Perform(); | |
new Actions(driver).MoveToElement(driver.FindElement(By.Id("txtCellphone"))).Click().SendKeys("95368585").Build().Perform(); | |
} | |
[TestFixtureTearDown] | |
public void TearDown() | |
{ | |
driver.Quit(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment