File tree Expand file tree Collapse file tree 5 files changed +101
-23
lines changed
src/test/java/org/sayem/webdriver Expand file tree Collapse file tree 5 files changed +101
-23
lines changed Original file line number Diff line number Diff line change
1
+ package org .sayem .webdriver .pages ;
2
+
3
+ import org .openqa .selenium .WebDriver ;
4
+ import org .sayem .webdriver .selenium .Browser ;
5
+
6
+ /**
7
+ * Created by sayem on 1/30/16.
8
+ */
9
+ public class CheckboxPage {
10
+
11
+ private Browser browser ;
12
+
13
+ public CheckboxPage (WebDriver driver ) {
14
+ this .browser = new Browser (driver );
15
+ }
16
+
17
+ public CheckboxPage selectCheckbox (){
18
+
19
+ return this ;
20
+ }
21
+ }
Original file line number Diff line number Diff line change
1
+ package org .sayem .webdriver .pages ;
2
+
3
+ import org .openqa .selenium .WebDriver ;
4
+ import org .sayem .webdriver .selenium .Browser ;
5
+
6
+ /**
7
+ * Created by sayem on 1/30/16.
8
+ */
9
+ public class ContextMenuPage {
10
+
11
+ private Browser browser ;
12
+
13
+ public ContextMenuPage (WebDriver driver ) {
14
+ this .browser = new Browser (driver );
15
+ }
16
+
17
+ public ContextMenuPage selectContextMenu (){
18
+
19
+ return this ;
20
+ }
21
+ }
Original file line number Diff line number Diff line change @@ -16,10 +16,24 @@ public HomePage(WebDriver driver) {
16
16
this .browser = new Browser (driver );
17
17
}
18
18
19
- public DropdownPage goToDropdownPage () {
19
+ private void availableExamples ( String example ) {
20
20
browser .findElements (CssSelector .AVAILABLE_EXAMPLES )
21
- .filter ((s ) -> s .getText ().equals ("Dropdown" ))
21
+ .filter ((s ) -> s .getText ().equals (example ))
22
22
.findAny ().get ().click ();
23
+ }
24
+
25
+ public DropdownPage dropdown (){
26
+ availableExamples ("Dropdown" );
23
27
return TestBase .pageFactory (DropdownPage .class );
24
28
}
29
+
30
+ public CheckboxPage checkboxes (){
31
+ availableExamples ("Checkboxes" );
32
+ return TestBase .pageFactory (CheckboxPage .class );
33
+ }
34
+
35
+ public ContextMenuPage contextMenu (){
36
+ availableExamples ("Context Menu" );
37
+ return TestBase .pageFactory (ContextMenuPage .class );
38
+ }
25
39
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ package org .sayem .webdriver .testcases ;
2
+
3
+ import org .sayem .webdriver .TestBase ;
4
+ import org .sayem .webdriver .pages .HomePage ;
5
+ import org .testng .annotations .Test ;
6
+
7
+ public class TheInternetTest extends TestBase {
8
+
9
+ /***
10
+ * You can override browser and URL
11
+ * Example, System.setProperty("browser", "firefox")
12
+ *
13
+ * You can run single test from command line
14
+ * mvn clean install -Dbrowser=chrome -Dit.test=dropdownTest
15
+ *
16
+ * You can also run test with PhantomJS
17
+ * mvn clean install -Dbrowser=phantomjs
18
+ */
19
+
20
+ @ Test
21
+ public void dropdownTest (){
22
+ System .setProperty ("seleniumUrl" , "http://the-internet.herokuapp.com/" );
23
+ HomePage page = pageFactory (HomePage .class );
24
+ page .dropdown ()
25
+ .selectDropDown ();
26
+ }
27
+
28
+ @ Test
29
+ public void checkboxTest (){
30
+ System .setProperty ("seleniumUrl" , "http://the-internet.herokuapp.com/" );
31
+ HomePage page = pageFactory (HomePage .class );
32
+ page .checkboxes ()
33
+ .selectCheckbox ();
34
+ }
35
+
36
+ @ Test
37
+ public void contextMenuTest (){
38
+ System .setProperty ("seleniumUrl" , "http://the-internet.herokuapp.com/" );
39
+ HomePage page = pageFactory (HomePage .class );
40
+ page .contextMenu ()
41
+ .selectContextMenu ();
42
+ }
43
+ }
You can’t perform that action at this time.
0 commit comments