series - elemn
This commit is contained in:
@ -0,0 +1,9 @@
|
||||
<archetype>
|
||||
<id>BrowserStackJunit</id>
|
||||
<sources>
|
||||
<source>src/main/java/App.java</source>
|
||||
</sources>
|
||||
<testSources>
|
||||
<source>src/test/java/AppTest.java</source>
|
||||
</testSources>
|
||||
</archetype>
|
@ -0,0 +1,15 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>$cz.kankys</groupId>
|
||||
<artifactId>$BrowserStackJunit</artifactId>
|
||||
<version>$1.0-SNAPSHOT</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -0,0 +1,13 @@
|
||||
package $cz.kankys;
|
||||
|
||||
/**
|
||||
* Hello world!
|
||||
*
|
||||
*/
|
||||
public class App
|
||||
{
|
||||
public static void main( String[] args )
|
||||
{
|
||||
System.out.println( "Hello World!" );
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package $cz.kankys;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
/**
|
||||
* Unit test for simple App.
|
||||
*/
|
||||
public class AppTest
|
||||
extends TestCase
|
||||
{
|
||||
/**
|
||||
* Create the test case
|
||||
*
|
||||
* @param testName name of the test case
|
||||
*/
|
||||
public AppTest( String testName )
|
||||
{
|
||||
super( testName );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the suite of tests being tested
|
||||
*/
|
||||
public static Test suite()
|
||||
{
|
||||
return new TestSuite( AppTest.class );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rigourous Test :-)
|
||||
*/
|
||||
public void testApp()
|
||||
{
|
||||
assertTrue( true );
|
||||
}
|
||||
}
|
30
BrowserStackJunit/src/test/java/tests/KiwiTest.java
Normal file
30
BrowserStackJunit/src/test/java/tests/KiwiTest.java
Normal file
@ -0,0 +1,30 @@
|
||||
package tests;
|
||||
|
||||
import com.codeborne.selenide.WebDriverRunner;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.openqa.selenium.Cookie;
|
||||
|
||||
import static com.codeborne.selenide.Selectors.byAttribute;
|
||||
import static com.codeborne.selenide.Selectors.byXpath;
|
||||
import static com.codeborne.selenide.Selenide.*;
|
||||
|
||||
public class KiwiTest {
|
||||
@Test
|
||||
void itShouldOpenMainPage() {
|
||||
open("https://www.kiwi.com/en");
|
||||
|
||||
// Cookie (org.openqa.selenium), tento způsob nepůjde na všech webech. Všude to je jinde
|
||||
//cookie_consent, agreed --> takto si to pojmenovalo kiwi
|
||||
// nakonec za komentovaný způsob nešel použil jsem xpath
|
||||
/*
|
||||
Cookie cookie = new Cookie("cookie_consent", "agreed");
|
||||
WebDriverRunner.getWebDriver().manage().addCookie(cookie);
|
||||
//refresh();
|
||||
*/
|
||||
|
||||
$(byXpath("//*[@id=\"cookies_accept\"]")).click();
|
||||
$(byAttribute("data-test" ,"LandingSearchButton")).click();
|
||||
System.out.println("");
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package tests;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static com.codeborne.selenide.Selectors.byAttribute;
|
||||
import static com.codeborne.selenide.Selectors.byXpath;
|
||||
import static com.codeborne.selenide.Selenide.$;
|
||||
import static com.codeborne.selenide.Selenide.open;
|
||||
|
||||
public class OveritCenuLetenkyTest {
|
||||
@Test
|
||||
void OverimeCenuLetenky() {
|
||||
// jdeme na web kiwi
|
||||
open("https://www.kiwi.com/cz/");
|
||||
// potvrdíme cooki
|
||||
$(byXpath("//*[@id=\"cookies_accept\"]")).click();
|
||||
// kliknu na hlavni strane na prozkoumat
|
||||
$(byAttribute("data-test" ,"LandingSearchButton")).click();
|
||||
// kliknu na prvni nabídku na strance
|
||||
$(byAttribute("data-test" ,"PictureCardContent")).click();
|
||||
// pockam na nactení letenek
|
||||
// ulozim si cenu letenky do promenne
|
||||
// otevrem detail letenky a porovnam cenu
|
||||
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user