Repository navigation
Expand file tree
/
Copy pathBringItOnTest.java
More file actions
74 lines (52 loc) · 2.47 KB
/
Copy pathBringItOnTest.java
File metadata and controls
74 lines (52 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package second_test;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
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;
import javax.annotation.Syntax;
import java.util.concurrent.TimeUnit;
public class BringItOnTest {
private WebDriver driver;
@BeforeMethod(alwaysRun = true)
public void browserSetup() {
driver = new ChromeDriver();
}
@Test
public void bringItOnMySecondTest() {
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);
driver.manage().timeouts().setScriptTimeout(10, TimeUnit.SECONDS);
driver.get("https://pastebin.com/");
WebElement searchInput = driver.findElement(By.id("postform-text"));
searchInput.sendKeys("git config --global user.name \"New Sheriff in Town\"\n" +
"git reset $(git commit-tree HEAD^{tree} -m \"Legacy code\")\n" +
"git push origin master --force\n");
driver.findElement(By.xpath("//div[label='Syntax Highlighting:']")).click();
driver.findElement(By.xpath("//input[@type='search']")).sendKeys("Bash" + Keys.ENTER);
driver.findElement(By.id("select2-postform-expiration-container")).click();
driver.findElement(By.xpath("//li[text()='10 Minutes']")).click();
driver.findElement(By.xpath("//div[label ='Paste Name / Title:']")).click();
driver.findElement(By.id("postform-name")).sendKeys("how to gain dominance among developers" + Keys.ENTER);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
Assert.assertEquals("how to gain dominance among developers - Pastebin.com", driver.getTitle());
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
//driver.quit();
// String bodyText = driver.findElement(By.tagName("body")).getText();
// Assert.assertTrue("Text not found!", bodyText.contains(text));
}
// @AfterMethod(alwaysRun = true)
// public void browserTearDown() {
// driver.quit();
// driver = null;
// }
}