Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Exercicio.POM;
- using NUnit.Framework;
- using OpenQA.Selenium;
- using OpenQA.Selenium.Chrome;
- using OpenQA.Selenium.Support.UI;
- using System;
- namespace Exercicio
- {
- public class Tests
- {
- private IWebDriver driver;
- [SetUp]
- public void Setup()
- {
- driver = new ChromeDriver();
- driver.Manage().Window.Maximize();
- }
- //Teste de login com sucesso
- [Test, Order(1)]
- public void TesteLoginSucesso()
- {
- PageInicialPO inicial = new PageInicialPO(driver);
- inicial.AcessarLogin();
- PageLoginPO PageLogin = new PageLoginPO(driver);
- PageLogin.RealizarLogin("tomsmith", "SuperSecretPassword!");
- //Validação se o login foi feito com sucesso
- bool ConfirmarLogin = new WebDriverWait(driver, TimeSpan.FromSeconds(10)).Until
- (nav => nav.PageSource.Contains("You logged into a secure area!"));
- Assert.IsTrue(ConfirmarLogin);
- }
- //Teste senha invalida
- [Test, Order(2)]
- public void TesteLoginSenhaInvalida()
- {
- PageInicialPO inicial = new PageInicialPO(driver);
- inicial.AcessarLogin();
- PageLoginPO PageLogin = new PageLoginPO(driver);
- PageLogin.RealizarLogin("tomsmith", "SenhaErrada");
- bool ConfirmarFalhaSenha = new WebDriverWait(driver, TimeSpan.FromSeconds(10)).Until
- (nav => nav.PageSource.Contains("Your password is invalid!"));
- Assert.IsTrue(ConfirmarFalhaSenha);
- }
- [Test, Order(3)]
- public void TesteLoginLoginInvalido()
- {
- PageInicialPO inicial = new PageInicialPO(driver);
- inicial.AcessarLogin();
- PageLoginPO PageLogin = new PageLoginPO(driver);
- PageLogin.RealizarLogin("loginErrado", "SuperSecretPassword!");
- bool ConfirmarFalhaLogin = new WebDriverWait(driver, TimeSpan.FromSeconds(10)).Until
- (nav => nav.PageSource.Contains("Your username is invalid!"));
- Assert.IsTrue(ConfirmarFalhaLogin);
- }
- [TearDown]
- public void TearDown()
- {
- driver.Close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement