- Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathSample7Task.java
More file actions
Latest commit
86 lines (74 loc) · 2.72 KB
/
Copy pathSample7Task.java
File metadata and controls
86 lines (74 loc) · 2.72 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
75
76
77
78
79
80
81
82
83
84
85
86
packageselenium.sample;
importorg.junit.After;
importorg.junit.Before;
importorg.junit.Test;
importorg.openqa.selenium.By;
importorg.openqa.selenium.WebDriver;
importorg.openqa.selenium.WebElement;
importorg.openqa.selenium.chrome.ChromeDriver;
importorg.openqa.selenium.support.ui.Select;
importjava.io.File;
importjava.util.List;
importstaticorg.junit.Assert.*;
publicclassSample7Task {
WebDriverdriver;
Stringbase_url = "https://kristinek.github.io/site/examples/actions";
// method which is being run before each test
@Before
publicvoidstartingTests() throwsException {
// from Sample 1:
StringlibWithDriversLocation = System.getProperty("user.dir") + File.separator + "lib" + File.separator;
System.setProperty("webdriver.chrome.driver", libWithDriversLocation + "chromedriver" + newselenium.ChangeToFileExtension().extension());
// declaration above:
driver = newChromeDriver();
//open page:
driver.get(base_url);
}
// method which is being run after each test
@After
publicvoidendingTests() throwsException {
driver.close();
}
@Test
publicvoidselectCheckBox() throwsException {
// TODO:
// check that none of the checkboxes are ticked
// tick "Option 2"
// check that "Option 1" and "Option 3" are not ticked, but "Option 2" is ticked
// tick "Option 3"
// click result
// check that text 'You selected value(s): Option 2, Option 3' is being displayed
}
@Test
publicvoidselectRadioButton() throwsException {
// TODO:
// check that none of the radio are selected
// select "Option 3"
// check that "Option 1" and "Option 2' are not select, but "Option 3" is selected
// select "Option 1"
// check that "Option 2" and "Option 3' are not select, but "Option 1" is selected
// click result
// check that 'You selected option: Option 1' text is being displayed
}
@Test
publicvoidselectOption() throwsException {
// select "Option 3" in Select
// check that selected option is "Option 3"
// select "Option 2" in Select
// check that selected option is "Option 2"
// click result
// check that 'You selected option: Option 2' text is being displayed
}
@Test
publicvoidchooseDateViaCalendarBonus() throwsException {
// TODO:
// enter date '4 of July 2007' using calendar widget
// check that correct date is added
}
@Test
publicvoidchooseDateViaTextBoxBonus() throwsException {
// TODO:
// enter date '2 of May 1959' using text
// check that correct date is added
}
}