diff --git a/PlaywrightTestAcademy/.gitignore b/PlaywrightTestAcademy/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/PlaywrightTestAcademy/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/PlaywrightTestAcademy/.idea/encodings.xml b/PlaywrightTestAcademy/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/PlaywrightTestAcademy/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/PlaywrightTestAcademy/.idea/misc.xml b/PlaywrightTestAcademy/.idea/misc.xml new file mode 100644 index 0000000..dd5e3ad --- /dev/null +++ b/PlaywrightTestAcademy/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/PlaywrightTestAcademy/.idea/vcs.xml b/PlaywrightTestAcademy/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/PlaywrightTestAcademy/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PlaywrightTestAcademy/.idea/workspace.xml b/PlaywrightTestAcademy/.idea/workspace.xml new file mode 100644 index 0000000..11e3f0d --- /dev/null +++ b/PlaywrightTestAcademy/.idea/workspace.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1692287544970 + + + + + + \ No newline at end of file diff --git a/PlaywrightTestAcademy/pom.xml b/PlaywrightTestAcademy/pom.xml new file mode 100644 index 0000000..06a25af --- /dev/null +++ b/PlaywrightTestAcademy/pom.xml @@ -0,0 +1,51 @@ + + 4.0.0 + + cz.lukan + PlaywrightTestAcademy + 1.0-SNAPSHOT + jar + + PlaywrightTestAcademy + http://maven.apache.org + + + UTF-8 + + + + + com.microsoft.playwright + playwright + 1.36.0 + + + junit + junit + 3.8.1 + test + + + + org.testng + testng + 7.8.0 + test + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.10.1 + + + 20 + 20 + + + + + diff --git a/PlaywrightTestAcademy/readme.md b/PlaywrightTestAcademy/readme.md new file mode 100644 index 0000000..ad43249 --- /dev/null +++ b/PlaywrightTestAcademy/readme.md @@ -0,0 +1,8 @@ +https://www.youtube.com/watch?v=ycsl8Nd6H4I + +New project --> vybrat org.apache.maven.archetypes:maven-archetype-quickstart +.................................................................... + +TestNG + +playwright \ No newline at end of file diff --git a/PlaywrightTestAcademy/src/main/java/cz/lukan/App.java b/PlaywrightTestAcademy/src/main/java/cz/lukan/App.java new file mode 100644 index 0000000..a0c6033 --- /dev/null +++ b/PlaywrightTestAcademy/src/main/java/cz/lukan/App.java @@ -0,0 +1,13 @@ +package cz.lukan; + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/PlaywrightTestAcademy/src/test/java/cz/lukan/AppTest.java b/PlaywrightTestAcademy/src/test/java/cz/lukan/AppTest.java new file mode 100644 index 0000000..8d9f633 --- /dev/null +++ b/PlaywrightTestAcademy/src/test/java/cz/lukan/AppTest.java @@ -0,0 +1,38 @@ +package cz.lukan; + +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 ); + } +} diff --git a/Selenid_Naeem2023/.gitignore b/Selenid_Naeem2023/.gitignore new file mode 100644 index 0000000..57d0f74 --- /dev/null +++ b/Selenid_Naeem2023/.gitignore @@ -0,0 +1,40 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store + +/build/ \ No newline at end of file diff --git a/Selenid_Naeem2023/.idea/.gitignore b/Selenid_Naeem2023/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/Selenid_Naeem2023/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/Selenid_Naeem2023/.idea/encodings.xml b/Selenid_Naeem2023/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/Selenid_Naeem2023/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Selenid_Naeem2023/.idea/misc.xml b/Selenid_Naeem2023/.idea/misc.xml new file mode 100644 index 0000000..dd5e3ad --- /dev/null +++ b/Selenid_Naeem2023/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Selenid_Naeem2023/.idea/vcs.xml b/Selenid_Naeem2023/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/Selenid_Naeem2023/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Selenid_Naeem2023/Readme.md b/Selenid_Naeem2023/Readme.md new file mode 100644 index 0000000..569cc2d --- /dev/null +++ b/Selenid_Naeem2023/Readme.md @@ -0,0 +1,15 @@ +https://www.youtube.com/watch?v=0V8sqgO9dSA&list=PLAieK72EyQbvCpMt7gThAHdpjfZUVmHPv&index=1 + +Maven + +TestNG + +Selenide + +Na inportovat si: + +import static com.codeborne.selenide.Selenide.*; + +import static com.codeborne.selenide.Condition.*; + +Nezapomenout --> Generata --> MethodTest \ No newline at end of file diff --git a/Selenid_Naeem2023/pom.xml b/Selenid_Naeem2023/pom.xml new file mode 100644 index 0000000..ffeeaa5 --- /dev/null +++ b/Selenid_Naeem2023/pom.xml @@ -0,0 +1,39 @@ + + 4.0.0 + + cz.lukan + Selenid_Naeem2023 + 1.0-SNAPSHOT + jar + + Selenid_Naeem2023 + http://maven.apache.org + + + UTF-8 + 20 + 20 + + + + junit + junit + 3.8.1 + test + + + com.codeborne + selenide + 6.17.0 + test + + + + org.testng + testng + 7.8.0 + test + + + diff --git a/Selenid_Naeem2023/src/main/java/cz/lukan/App.java b/Selenid_Naeem2023/src/main/java/cz/lukan/App.java new file mode 100644 index 0000000..a0c6033 --- /dev/null +++ b/Selenid_Naeem2023/src/main/java/cz/lukan/App.java @@ -0,0 +1,13 @@ +package cz.lukan; + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/Selenid_Naeem2023/src/test/java/cz/lukan/AppTest.java b/Selenid_Naeem2023/src/test/java/cz/lukan/AppTest.java new file mode 100644 index 0000000..8d9f633 --- /dev/null +++ b/Selenid_Naeem2023/src/test/java/cz/lukan/AppTest.java @@ -0,0 +1,38 @@ +package cz.lukan; + +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 ); + } +} diff --git a/Selenid_Naeem2023/src/test/java/cz/lukan/MercuryLoginTest.java b/Selenid_Naeem2023/src/test/java/cz/lukan/MercuryLoginTest.java new file mode 100644 index 0000000..ac3dccd --- /dev/null +++ b/Selenid_Naeem2023/src/test/java/cz/lukan/MercuryLoginTest.java @@ -0,0 +1,31 @@ +package cz.lukan; +import com.codeborne.selenide.Configuration; +import com.codeborne.selenide.SelenideElement; +import com.codeborne.selenide.WebDriverRunner; +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.testng.annotations.Test; + +import static com.codeborne.selenide.Selectors.byXpath; +import static com.codeborne.selenide.Selenide.*; +import static com.codeborne.selenide.Condition.*; + +public class MercuryLoginTest { + @Test + public void testMercuryLogin() { + Configuration.browser="chrome"; + Configuration.browserSize="1000x650"; + Configuration.headless=true; + Configuration.screenshots=true; + Configuration.timeout=13000; + Configuration.holdBrowserOpen=true; + open("https://www.demo.guru99.com/test/newtours/"); + //WebDriverRunner.getWebDriver().manage().window().maximize(); + switchTo().frame(3); + $("#save > .mat-button-wrapper span").click(); + $(By.name("userName")).setValue("test"); + $(By.name("password")).setValue("test"); + $(By.name("submit")).click(); + $("h3").shouldHave(text("Login Successfully")); + } +} diff --git a/Selenium_POM_tutorial/.idea/misc.xml b/Selenium_POM_tutorial/.idea/misc.xml index dd5e3ad..fd26528 100644 --- a/Selenium_POM_tutorial/.idea/misc.xml +++ b/Selenium_POM_tutorial/.idea/misc.xml @@ -8,7 +8,7 @@ - + \ No newline at end of file diff --git a/Selenium_POM_tutorial/readme.md b/Selenium_POM_tutorial/readme.md index 9c03175..9ef29a7 100644 --- a/Selenium_POM_tutorial/readme.md +++ b/Selenium_POM_tutorial/readme.md @@ -11,4 +11,4 @@ TestNG Selenium java -WebDriverManager \ No newline at end of file +konec video 3 \ No newline at end of file diff --git a/Selenium_POM_tutorial/src/main/java/POM/pages/_03/HomePage.java b/Selenium_POM_tutorial/src/main/java/POM/pages/_03/HomePage.java new file mode 100644 index 0000000..c3d6ae2 --- /dev/null +++ b/Selenium_POM_tutorial/src/main/java/POM/pages/_03/HomePage.java @@ -0,0 +1,21 @@ +package POM.pages._03; + +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; + +public class HomePage { + WebDriver driver; + public HomePage(WebDriver driver){ + this.driver = driver; + } + // pole na vyplnění user name password,identifikace polde id + private final By msg_footer = By.xpath("//*[@id=\"page_wrapper\"]/footer/div"); + + + // ověríme text footer + public WebElement get_Msg_footer() { + return driver.findElement(msg_footer); + } + +} diff --git a/Selenium_POM_tutorial/src/main/java/POM/pages/_03/LoginPage.java b/Selenium_POM_tutorial/src/main/java/POM/pages/_03/LoginPage.java new file mode 100644 index 0000000..0966374 --- /dev/null +++ b/Selenium_POM_tutorial/src/main/java/POM/pages/_03/LoginPage.java @@ -0,0 +1,30 @@ +package POM.pages._03; + +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; + +public class LoginPage { + // Webdriver potřebujeme abych mohl vyplňovat pomocí funkce fill + WebDriver driver; + + public LoginPage(WebDriver driver){ + this.driver = driver; + } + // pole na vyplnění user name password,identifikace polde id + private final By textbox_username = By.id("user-name"); + private final By textbox_password = By.name("password"); + private final By btn_login = By.xpath("//*[@id=\"login-button\"]"); + + // Vyplnění údajů + public void fill_Textbox_username(String username) { + driver.findElement(textbox_username).sendKeys(username); + } + public void fill_Textbox_password(String password) { + driver.findElement(textbox_password).sendKeys(password); + } + public void click_Btn_Login() { + driver.findElement(btn_login).click(); + } + + +} diff --git a/Selenium_POM_tutorial/src/test/java/tutorial/POM/tests/Test_03_Login_POM.java b/Selenium_POM_tutorial/src/test/java/tutorial/POM/tests/Test_03_Login_POM.java new file mode 100644 index 0000000..4ae00f8 --- /dev/null +++ b/Selenium_POM_tutorial/src/test/java/tutorial/POM/tests/Test_03_Login_POM.java @@ -0,0 +1,47 @@ +package tutorial.POM.tests; + +import POM.pages._02.HomePage; +import POM.pages._02.LoginPage; +import io.github.bonigarcia.wdm.WebDriverManager; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeDriver; +import org.testng.Assert; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +public class Test_03_Login_POM { + WebDriver driver; + @BeforeMethod + // open website + public void setup() { + WebDriverManager.chromedriver().setup(); + driver = new ChromeDriver(); + + driver.get("https://www.saucedemo.com/"); + driver.manage().window().maximize(); + } + + @Test + public void test_Login_Functionality() { + LoginPage loginPage = new LoginPage(driver); + loginPage.fill_Textbox_username("standard_user"); + loginPage.fill_Textbox_password("secret_sauce"); + loginPage.click_Btn_Login(); + + HomePage homePage = new HomePage(driver); + String actual_msg = homePage.get_Msg_footer().getText(); + String expected_msg = " Sauce Labs. All Rights Reserved. Terms of Service | Privacy Policy"; + + Assert.assertTrue(actual_msg.contains(expected_msg)); + + } + + // close browser + @AfterMethod + public void teardown() { + driver.quit(); + } + + +}