Guest User

Untitled

a guest
Mar 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. package PortfolioTests;
  2.  
  3. import PortfolioTests.Utilities.Utils;
  4. import org.apache.commons.io.FileUtils;
  5. import org.openqa.selenium.*;
  6. import org.openqa.selenium.interactions.Action;
  7. import org.openqa.selenium.interactions.Actions;
  8. import org.testng.Assert;
  9. import org.testng.annotations.AfterMethod;
  10. import org.testng.annotations.BeforeMethod;
  11. import org.testng.annotations.Test;
  12.  
  13. import static PortfolioTests.Utilities.Utils.driver;
  14.  
  15. public class Portfolio {
  16. @BeforeMethod
  17. public void setUp() {
  18. Utils.instantiate();
  19. }
  20.  
  21. @AfterMethod
  22. public void tearDown() {
  23. driver.close();
  24. }
  25.  
  26. @Test(testName = "Access Positive Test", description = "Check that you can access the 01 Drums page", groups = {"01Drums"})
  27. public void accessDrumsPositiveTest() {
  28.  
  29. driver.findElement(By.xpath("/html/body/div[2]/div[1]")).click();
  30. Assert.assertEquals(driver.getTitle(), "JS30: 01 Drums");
  31. }
  32.  
  33. @Test(testName = "Access Negative Test", description = "Check that you can access the correct 01Drums page", groups = {"01Drums"})
  34. public void accessDrumsNegativeTest() {
  35.  
  36. driver.findElement(By.xpath("/html/body/div[2]/div[1]")).click();
  37. Assert.assertNotEquals(driver.getTitle(), "Lorem Ipsum");
  38. }
  39.  
  40. @Test(testName = "Back from Drums Test", description = "Check that you can go back from the 01 Drums page", groups = {"01Drums"})
  41. public void backFromDrumsTest() {
  42.  
  43. driver.findElement(By.xpath("/html/body/div[2]/div[1]")).click();
  44. driver.navigate().back();
  45. Assert.assertEquals(driver.getTitle(), "JavaScript 30 Portfolio by Andrei Dobra");
  46. }
  47.  
  48. }
Add Comment
Please, Sign In to add comment