Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package testai;
- import org.junit.jupiter.api.BeforeEach;
- import org.junit.jupiter.api.DisplayName;
- import org.junit.jupiter.api.Test;
- import org.openqa.selenium.By;
- import org.openqa.selenium.WebDriver;
- import org.openqa.selenium.WebElement;
- import org.openqa.selenium.interactions.Actions;
- import selenium.SeleniumNuorodosIrAts;
- import selenium.SeleniumValdymas;
- import static org.junit.jupiter.api.Assertions.assertEquals;
- public class SeleniumTest
- {
- WebDriver driver;
- @BeforeEach
- public void init()
- {
- driver = SeleniumValdymas.initChromeDriver();
- }
- @Test
- @DisplayName("testinis testas")
- public void testinisTestas()
- {
- WebElement searchBox;
- WebElement searchButton;
- WebElement prekesContaineris;
- WebElement prekesIdTekstas;
- driver.get(SeleniumNuorodosIrAts.getBAZINE_NUORODA());
- searchBox = driver.findElement(By.cssSelector("#searchbox .search_query"));
- searchBox.click();
- searchBox.sendKeys("Blouse");
- searchButton = driver.findElement(By.cssSelector("#searchbox .button-search"));
- searchButton.click();
- prekesContaineris = driver.findElement(By.cssSelector(".product_img_link > .replace-2x"));
- prekesContaineris.click();
- prekesIdTekstas = driver.findElement(By.cssSelector("#product_reference"));
- assertEquals(SeleniumNuorodosIrAts.getPAIESKOS_TESTO_EXPECTED_MODELIS(), prekesIdTekstas.getText(), "Surastas modelis neatitinka tokio modelio, koks buvo tikėtasi testuojant");
- }
- @Test
- @DisplayName("antas test")
- public void antarasTestinis() throws InterruptedException
- {
- driver.get(SeleniumNuorodosIrAts.getBAZINE_NUORODA());
- Actions actions = new Actions(driver);
- Thread.sleep(5000);
- WebElement meniuMygtukas = driver.findElement(By.cssSelector(".htmlcontent-item-3 .item-img"));
- // actions.moveToElement(meniuMygtukas);
- // actions.perform();
- meniuMygtukas.click();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement