diff --git a/src/main/java/JavaExersices/App2.java b/src/main/java/JavaExersices/App2.java index 6019c0b..cad1336 100644 --- a/src/main/java/JavaExersices/App2.java +++ b/src/main/java/JavaExersices/App2.java @@ -2,7 +2,7 @@ public class App2 { public static void main(String[] args) { - int xx = 100; + int xx = 15; fizzbuzz(xx); } diff --git a/src/main/java/JavaExersices/App3.java b/src/main/java/JavaExersices/App3.java new file mode 100644 index 0000000..2d9b234 --- /dev/null +++ b/src/main/java/JavaExersices/App3.java @@ -0,0 +1,15 @@ +package JavaExersices; + +import java.util.ArrayList; +import java.util.List; + +public class App3 { + public static void main(String[] args) { + String string = "whatever"; + String reverse = new StringBuffer(string).reverse().toString(); + String number = "12345"; + String numberReverse = new StringBuffer(number).reverse().toString(); + System.out.println(reverse); + System.out.println(numberReverse); + } +} diff --git a/src/main/java/JavaExersices/App4.java b/src/main/java/JavaExersices/App4.java new file mode 100644 index 0000000..67318a3 --- /dev/null +++ b/src/main/java/JavaExersices/App4.java @@ -0,0 +1,22 @@ +package JavaExersices; + +public class App4 { + public static void main(String[] args) { + ///FizzBuzz + for (var i=1;i<100;i++){ + /// System.out.println(i); + fizzBuzz(i); + } + } + private static void fizzBuzz(int i) { + if(i%3==0 && i%5==0) { + System.out.println(i +"FizzBuzz"); + }else + if(i%3==0) { + System.out.println(i +"Fizz"); + }else + if(i%5==0) { + System.out.println(i +"Buzz"); + } +} +} diff --git a/src/main/java/JavaExersices/Solutions.java b/src/main/java/JavaExersices/Solutions.java new file mode 100644 index 0000000..e69de29 diff --git a/src/main/java/hw12/AutomationTester.java b/src/main/java/hw12/AutomationTester.java new file mode 100644 index 0000000..04ac548 --- /dev/null +++ b/src/main/java/hw12/AutomationTester.java @@ -0,0 +1,5 @@ +package hw12; + +public interface AutomationTester { + void autoScripts(); +} diff --git a/src/main/java/hw12/Gapp.java b/src/main/java/hw12/Gapp.java new file mode 100644 index 0000000..5e9a415 --- /dev/null +++ b/src/main/java/hw12/Gapp.java @@ -0,0 +1,11 @@ +package hw12; + +public class Gapp { + public static void main(String[] args) { + StartUp rila = new StartUp("Senior", "No refernce", 90); + rila.autoScripts(); + rila.bugReports(); + rila.hired(); + + } +} diff --git a/src/main/java/hw12/Google.java b/src/main/java/hw12/Google.java new file mode 100644 index 0000000..301eb27 --- /dev/null +++ b/src/main/java/hw12/Google.java @@ -0,0 +1,13 @@ +package hw12; + +public class Google implements ManualTester{ + + public void bugReports() { + System.out.println("Bug reprts fro Google"); + + } + public void testCases() { + System.out.println("Test cases good for Google"); + + } +} diff --git a/src/main/java/hw12/ManualTester.java b/src/main/java/hw12/ManualTester.java new file mode 100644 index 0000000..4d96d94 --- /dev/null +++ b/src/main/java/hw12/ManualTester.java @@ -0,0 +1,7 @@ +package hw12; + +public interface ManualTester { + void bugReports(); + void testCases(); + +} diff --git a/src/main/java/hw12/StartUp.java b/src/main/java/hw12/StartUp.java new file mode 100644 index 0000000..acd98b5 --- /dev/null +++ b/src/main/java/hw12/StartUp.java @@ -0,0 +1,42 @@ +package hw12; + +import org.w3c.dom.ls.LSOutput; + +public class StartUp implements ManualTester, AutomationTester{ + private String level; + private String reference; + private int salary; + + public StartUp(String level, String reference, int salary) { + this.level = level; + this.reference = reference; + this.salary = salary; + } + + public void hired(){ + System.out.println("Hired"); + } + public void fired(){ + System.out.println("Fired"); + } + + @Override + public String toString() { + return "StartUp{" + + "level='" + level + '\'' + + ", reference='" + reference + '\'' + + ", salary=" + salary + + '}'; + } + + public void autoScripts() { + System.out.println("I can write Auto Scripts"); + } + public void bugReports() { + System.out.println("I can write bug reports"); + } + + public void testCases() { + System.out.println("I can write test cases"); + } +} diff --git a/src/main/java/hw5/Work.java b/src/main/java/hw5/Work.java new file mode 100644 index 0000000..4870f7e --- /dev/null +++ b/src/main/java/hw5/Work.java @@ -0,0 +1,11 @@ +package hw5; + +public class Work { + public static void main(String[] args) { + + String[] row = {"Mary","Sam","Donald","Goerge","Geffrey","Sandra","Pamela"}; + System.out.println(row.length); + + System.out.println(row[row.length-3]); + } +} diff --git a/src/main/java/hw66/First.java b/src/main/java/hw66/First.java new file mode 100644 index 0000000..fc1e582 --- /dev/null +++ b/src/main/java/hw66/First.java @@ -0,0 +1,23 @@ +package hw66; + +public class First { + + int[] arr = {2,3,5,6,7,8}; + int sumofarray; + public static void main(String[] args) { + + int[] arr = {2,3,5,6,7,8}; + int sumofarray = sum(arr); + System.out.println(sumofarray); + + } + + private static int sum(int[] arr) { + + int sum = 0; + for(int v: arr){ + sum+=v; + } + return sum; + } +} diff --git a/src/test/java/diceJobSearch/JobSearch.java b/src/test/java/diceJobSearch/JobSearch.java new file mode 100644 index 0000000..87d9cdc --- /dev/null +++ b/src/test/java/diceJobSearch/JobSearch.java @@ -0,0 +1,55 @@ +package diceJobSearch; + +import org.openqa.selenium.*; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.support.ui.FluentWait; +import org.openqa.selenium.support.ui.WebDriverWait; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import java.time.Duration; + +public class JobSearch { +@Test + public void search() throws InterruptedException { + //open Dice + System.setProperty("webdriver.chrome.driver","chromedriver"); + WebDriver driver = new ChromeDriver(); + + driver.get("https://www.dice.com"); + Thread.sleep(5000); + + + WebElement loginRegister = driver.findElement(By.id("navbarDropdown-11")); + loginRegister.click(); + + WebElement login = driver.findElement(By.xpath("//*[@id=\"navbarSupportedContent\"]/ul[2]/li[3]/div/a[1]")); + login.click(); + Thread.sleep(5000); + + WebElement email = driver.findElement(By.id("email")); + WebElement password = driver.findElement(By.id("password")); + WebElement signIn = driver.findElement(By.xpath("//*[@id=\"loginDataSubmit\"]/div[3]/div/button")); + + email.sendKeys("shamasovaiaz@gmail.com"); + password.sendKeys(""); + signIn.click(); + Thread.sleep(5000); + + WebElement searchTerm = driver.findElement(By.xpath("//*[@id=\"searchInput-div\"]/form/div/div[1]/div/dhi-new-typeahead-input/div/input")); + WebElement searchJobs = driver.findElement(By.xpath("//*[@id=\"searchInput-div\"]/form/div/div[3]")); + searchTerm.sendKeys("QA Engineer"); + searchJobs.click(); + Thread.sleep(5000); + + WebElement easyApply = driver.findElement(By.xpath("//*[@id=\"facets\"]/dhi-accordion[6]/div[2]/div/js-single-select-filter/div/div/span")); + easyApply.click(); + Thread.sleep(3000); + + WebElement qaJob = driver.findElement(By.xpath("/html/body/dhi-js-dice-client/div/dhi-search-page-container/dhi-search-page/div/dhi-search-page-results/div/div[3]/js-search-display/div/div[2]/dhi-search-cards-widget/div/dhi-search-card[5]/div/div[1]/div/div[2]/div[1]/h5/a")); + qaJob.click(); + +} + +} diff --git a/src/test/java/helper/BrowserFabric.java b/src/test/java/helper/BrowserFabric.java index 4e91f0c..e26e2a7 100644 --- a/src/test/java/helper/BrowserFabric.java +++ b/src/test/java/helper/BrowserFabric.java @@ -42,7 +42,7 @@ private static WebDriver getChromeDriver() { ChromeOptions options = new ChromeOptions(); options.addArguments("window-size=1400,1000"); // options.addArguments("--headless"); - System.setProperty("webdriver.chrome.driver","chromedriver.exe"); + System.setProperty("webdriver.chrome.driver","chromedriver"); return new ChromeDriver(options); } } diff --git a/src/test/java/simpleTest/GoogleSearch.java b/src/test/java/simpleTest/GoogleSearch.java index 9907e97..afa0cdb 100644 --- a/src/test/java/simpleTest/GoogleSearch.java +++ b/src/test/java/simpleTest/GoogleSearch.java @@ -12,7 +12,7 @@ public class GoogleSearch { @Test public void searchJavaInGoogle_ResultReturned() { // Arrange - System.setProperty("webdriver.chrome.driver","chromedriver.exe"); + System.setProperty("webdriver.chrome.driver","chromedriver"); WebDriver driver = new ChromeDriver(); driver.get("https://www.google.com"); @@ -40,7 +40,7 @@ public void searchJavaInGoogle_ResultReturned() { @Test public void searchJavaInGoogleUsingSearchButton_ResultReturned() { // Arrange - System.setProperty("webdriver.chrome.driver","chromedriver.exe"); + System.setProperty("webdriver.chrome.driver","chromedriver"); WebDriver driver = new ChromeDriver(); driver.get("https://www.google.com"); diff --git a/src/test/java/simpleTest/KoelApp.java b/src/test/java/simpleTest/KoelApp.java index c75cd6c..bd9a82a 100644 --- a/src/test/java/simpleTest/KoelApp.java +++ b/src/test/java/simpleTest/KoelApp.java @@ -18,7 +18,7 @@ public class KoelApp { private FluentWait fluentWait; @BeforeMethod public void startUp(){ - System.setProperty("webdriver.chrome.driver","chromedriver.exe"); + System.setProperty("webdriver.chrome.driver","chromedriver"); driver = new ChromeDriver(); wait = new WebDriverWait(driver,10); fluentWait = new FluentWait(driver) diff --git a/src/test/java/simpleTest/UdemyTest.java b/src/test/java/simpleTest/UdemyTest.java index 2b9ba7f..16c2edc 100644 --- a/src/test/java/simpleTest/UdemyTest.java +++ b/src/test/java/simpleTest/UdemyTest.java @@ -20,7 +20,7 @@ public class UdemyTest { private FluentWait fluentWait; @BeforeMethod public void startUp(){ - System.setProperty("webdriver.chrome.driver","chromedriver.exe"); + System.setProperty("webdriver.chrome.driver","chromedriver"); driver = new ChromeDriver(); wait = new WebDriverWait(driver,20); fluentWait = new FluentWait(driver) @@ -66,4 +66,33 @@ public void clickSignUpButton() { WebElement signUpMessage = driver.findElement(By.id("auth-to-udemy-title")); Assert.assertEquals(signUpMessage.getText(),"Sign Up and Start Learning!"); } + @Test + public void clickTeachOnUdemy() { + fluentWait.until(x->x.findElement(By.xpath("//*[text()='Teach on Udemy']"))); + WebElement teachOnUdemy = driver.findElement(By.xpath("//*[text()='Teach on Udemy']")); + teachOnUdemy.click(); + + fluentWait.until(x->x.findElement(By.cssSelector("[data-purpose='bai-cta']"))); + WebElement becomeAnInstructor = driver.findElement(By.cssSelector("[data-purpose='bai-cta']")); + Assert.assertEquals(becomeAnInstructor.getText(), "Become an instructor"); + } + @Test + public void clickOnBecomeAnInsructor() throws InterruptedException { + fluentWait.until(x->x.findElement(By.xpath("//*[text()='Teach on Udemy']"))); + WebElement teachOnUdemy = driver.findElement(By.xpath("//*[text()='Teach on Udemy']")); + teachOnUdemy.click(); + + fluentWait.until(x->x.findElement(By.xpath("//*[text()='Become an instructor']"))); + WebElement becomeAnInstructor = driver.findElement(By.xpath("//*[text()='Become an instructor']")); + becomeAnInstructor.click(); + + fluentWait.until(x->x.findElement(By.id("auth-to-udemy-title"))); + WebElement signUpButton = driver.findElement(By.id("auth-to-udemy-title")); + Thread.sleep(5000); + //signUpButton.click(); + Assert.assertEquals(signUpButton.getText(),"Become a Udemy Instructor!"); + //"auth-to-udemy-title" + + } +// }