Advertisement
Raizekas

Untitled

Apr 12th, 2021
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. package testai;
  2.  
  3. import org.junit.jupiter.api.BeforeEach;
  4. import org.junit.jupiter.api.DisplayName;
  5. import org.junit.jupiter.api.Test;
  6. import org.openqa.selenium.By;
  7. import org.openqa.selenium.WebDriver;
  8. import org.openqa.selenium.WebElement;
  9. import org.openqa.selenium.interactions.Actions;
  10. import selenium.SeleniumNuorodosIrAts;
  11. import selenium.SeleniumValdymas;
  12.  
  13. import static org.junit.jupiter.api.Assertions.assertEquals;
  14.  
  15. public class SeleniumTest
  16. {
  17. WebDriver driver;
  18.  
  19.  
  20. @BeforeEach
  21. public void init()
  22. {
  23. driver = SeleniumValdymas.initChromeDriver();
  24. }
  25.  
  26. @Test
  27. @DisplayName("testinis testas")
  28. public void testinisTestas()
  29. {
  30. WebElement searchBox;
  31. WebElement searchButton;
  32. WebElement prekesContaineris;
  33. WebElement prekesIdTekstas;
  34. driver.get(SeleniumNuorodosIrAts.getBAZINE_NUORODA());
  35.  
  36. searchBox = driver.findElement(By.cssSelector("#searchbox .search_query"));
  37. searchBox.click();
  38. searchBox.sendKeys("Blouse");
  39. searchButton = driver.findElement(By.cssSelector("#searchbox .button-search"));
  40. searchButton.click();
  41.  
  42. prekesContaineris = driver.findElement(By.cssSelector(".product_img_link > .replace-2x"));
  43. prekesContaineris.click();
  44.  
  45. prekesIdTekstas = driver.findElement(By.cssSelector("#product_reference"));
  46.  
  47. assertEquals(SeleniumNuorodosIrAts.getPAIESKOS_TESTO_EXPECTED_MODELIS(), prekesIdTekstas.getText(), "Surastas modelis neatitinka tokio modelio, koks buvo tikėtasi testuojant");
  48. }
  49.  
  50. @Test
  51. @DisplayName("antas test")
  52. public void antarasTestinis() throws InterruptedException
  53. {
  54. driver.get(SeleniumNuorodosIrAts.getBAZINE_NUORODA());
  55. Actions actions = new Actions(driver);
  56.  
  57. Thread.sleep(5000);
  58.  
  59. WebElement meniuMygtukas = driver.findElement(By.cssSelector(".htmlcontent-item-3 .item-img"));
  60. // actions.moveToElement(meniuMygtukas);
  61. // actions.perform();
  62.  
  63. meniuMygtukas.click();
  64. }
  65. }
  66.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement