File tree 8 files changed +40
-1
lines changed
main/java/io/appium/java_client/pagefactory
test/java/io/appium/java_client/pagefactory_tests/widgets
8 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -61,4 +61,8 @@ public WebDriver getWrappedDriver() {
61
61
public WebElement getWrappedElement () {
62
62
return (WebElement ) element ;
63
63
}
64
+
65
+ public Widget getSelfReference () {
66
+ return this ;
67
+ }
64
68
}
Original file line number Diff line number Diff line change 3
3
import io .appium .java_client .android .AndroidDriver ;
4
4
import io .appium .java_client .pagefactory .AppiumFieldDecorator ;
5
5
import io .appium .java_client .pagefactory .TimeOutDuration ;
6
+ import io .appium .java_client .pagefactory_tests .widgets .android .annotated .AnnotatedAndroidMovie ;
7
+ import io .appium .java_client .pagefactory_tests .widgets .android .simple .AndroidMovie ;
6
8
import io .appium .java_client .remote .MobileCapabilityType ;
7
9
import io .appium .java_client .service .local .AppiumDriverLocalService ;
8
10
import org .apache .commons .lang3 .StringUtils ;
@@ -68,6 +70,7 @@ public void checkACommonWidget() {
68
70
movie .goToReview ();
69
71
70
72
rottenTomatoes .checkSimpleReview ();
73
+ assertTrue (movie .getSelfReference ().getClass ().equals (AndroidMovie .class ));
71
74
}
72
75
73
76
@ Override
@@ -81,6 +84,7 @@ public void checkAnAnnotatedWidget() {
81
84
movie .goToReview ();
82
85
83
86
rottenTomatoes .checkAnnotatedReview ();
87
+ assertTrue (movie .getSelfReference ().getClass ().equals (AnnotatedAndroidMovie .class ));
84
88
}
85
89
86
90
@@ -95,6 +99,7 @@ public void checkAnExtendedWidget() {
95
99
movie .goToReview ();
96
100
97
101
rottenTomatoes .checkExtendedReview ();
102
+ assertTrue (movie .getSelfReference ().getClass ().equals (AnnotatedAndroidMovie .class ));
98
103
}
99
104
100
105
@ Override
Original file line number Diff line number Diff line change 2
2
3
3
import io .appium .java_client .pagefactory .AppiumFieldDecorator ;
4
4
import io .appium .java_client .pagefactory .TimeOutDuration ;
5
+ import io .appium .java_client .pagefactory_tests .widgets .html .annotated .AnnotatedHtmlMovie ;
6
+ import io .appium .java_client .pagefactory_tests .widgets .html .simple .HtmlMovie ;
5
7
import org .apache .commons .lang3 .StringUtils ;
6
8
import org .junit .AfterClass ;
7
9
import org .junit .Before ;
@@ -45,7 +47,7 @@ public static void beforeClass() throws Exception {
45
47
@ Before
46
48
public void setUp () throws Exception {
47
49
if (driver != null )
48
- driver .get ("file:///" + new File ("src/test/java/io/appium/java_client/RottenTomatoesSnapshot.html" ).getAbsolutePath ());
50
+ driver .get ( new File ("src/test/java/io/appium/java_client/RottenTomatoesSnapshot.html" ).toURI (). toString ());
49
51
}
50
52
51
53
@ AfterClass
@@ -65,6 +67,7 @@ public void checkACommonWidget() {
65
67
movie .goToReview ();
66
68
67
69
rottenTomatoes .checkSimpleReview ();
70
+ assertTrue (movie .getSelfReference ().getClass ().equals (HtmlMovie .class ));
68
71
}
69
72
70
73
@ Override
@@ -78,6 +81,7 @@ public void checkAnAnnotatedWidget() {
78
81
movie .goToReview ();
79
82
80
83
rottenTomatoes .checkAnnotatedReview ();
84
+ assertTrue (movie .getSelfReference ().getClass ().equals (AnnotatedHtmlMovie .class ));
81
85
}
82
86
83
87
@@ -92,6 +96,7 @@ public void checkAnExtendedWidget() {
92
96
movie .goToReview ();
93
97
94
98
rottenTomatoes .checkExtendedReview ();
99
+ assertTrue (movie .getSelfReference ().getClass ().equals (AnnotatedHtmlMovie .class ));
95
100
}
96
101
97
102
@ Override
Original file line number Diff line number Diff line change 3
3
import io .appium .java_client .ios .IOSDriver ;
4
4
import io .appium .java_client .pagefactory .AppiumFieldDecorator ;
5
5
import io .appium .java_client .pagefactory .TimeOutDuration ;
6
+ import io .appium .java_client .pagefactory_tests .widgets .ios .annotated .AnnotatedIOSMovie ;
7
+ import io .appium .java_client .pagefactory_tests .widgets .ios .simple .IOSMovie ;
6
8
import io .appium .java_client .remote .MobileCapabilityType ;
7
9
import io .appium .java_client .service .local .AppiumDriverLocalService ;
8
10
import org .apache .commons .lang3 .StringUtils ;
@@ -68,6 +70,7 @@ public void checkACommonWidget() {
68
70
movie .goToReview ();
69
71
70
72
rottenTomatoes .checkSimpleReview ();
73
+ assertTrue (movie .getSelfReference ().getClass ().equals (IOSMovie .class ));
71
74
}
72
75
73
76
@ Override
@@ -81,6 +84,7 @@ public void checkAnAnnotatedWidget() {
81
84
movie .goToReview ();
82
85
83
86
rottenTomatoes .checkAnnotatedReview ();
87
+ assertTrue (movie .getSelfReference ().getClass ().equals (AnnotatedIOSMovie .class ));
84
88
}
85
89
86
90
@@ -95,6 +99,7 @@ public void checkAnExtendedWidget() {
95
99
movie .goToReview ();
96
100
97
101
rottenTomatoes .checkExtendedReview ();
102
+ assertTrue (movie .getSelfReference ().getClass ().equals (AnnotatedIOSMovie .class ));
98
103
}
99
104
100
105
@ Override
Original file line number Diff line number Diff line change @@ -15,4 +15,9 @@ protected Movie(WebElement element) {
15
15
public abstract Object getPoster ();
16
16
17
17
public abstract void goToReview ();
18
+
19
+ @ Override
20
+ public Movie getSelfReference () {
21
+ return (Movie ) super .getSelfReference ();
22
+ }
18
23
}
Original file line number Diff line number Diff line change @@ -12,4 +12,9 @@ protected Movies(WebElement element) {
12
12
public abstract int getMovieCount ();
13
13
14
14
public abstract Movie getMovie (int index );
15
+
16
+ @ Override
17
+ public Movies getSelfReference () {
18
+ return (Movies ) super .getSelfReference ();
19
+ }
15
20
}
Original file line number Diff line number Diff line change @@ -16,4 +16,9 @@ protected Review(WebElement element) {
16
16
public abstract String info ();
17
17
18
18
public abstract Object getPoster ();
19
+
20
+ @ Override
21
+ public Review getSelfReference () {
22
+ return (Review ) super .getSelfReference ();
23
+ }
19
24
}
Original file line number Diff line number Diff line change 3
3
import io .appium .java_client .android .AndroidDriver ;
4
4
import io .appium .java_client .pagefactory .AppiumFieldDecorator ;
5
5
import io .appium .java_client .pagefactory .TimeOutDuration ;
6
+ import io .appium .java_client .pagefactory_tests .widgets .selendroid .annotated .AnnotatedSelendroidMovie ;
7
+ import io .appium .java_client .pagefactory_tests .widgets .selendroid .simple .SelendroidMovie ;
6
8
import io .appium .java_client .remote .AutomationName ;
7
9
import io .appium .java_client .remote .MobileCapabilityType ;
8
10
import io .appium .java_client .service .local .AppiumDriverLocalService ;
@@ -72,6 +74,7 @@ public void checkACommonWidget() {
72
74
movie .goToReview ();
73
75
driver .getPageSource (); //forcing the refreshing hierarchy
74
76
rottenTomatoes .checkSimpleReview ();
77
+ assertTrue (movie .getSelfReference ().getClass ().equals (SelendroidMovie .class ));
75
78
}
76
79
77
80
@ Override
@@ -85,6 +88,7 @@ public void checkAnAnnotatedWidget() {
85
88
movie .goToReview ();
86
89
driver .getPageSource (); //forcing the refreshing hierarchy
87
90
rottenTomatoes .checkAnnotatedReview ();
91
+ assertTrue (movie .getSelfReference ().getClass ().equals (AnnotatedSelendroidMovie .class ));
88
92
}
89
93
90
94
@@ -99,6 +103,7 @@ public void checkAnExtendedWidget() {
99
103
movie .goToReview ();
100
104
driver .getPageSource (); //forcing the refreshing hierarchy
101
105
rottenTomatoes .checkExtendedReview ();
106
+ assertTrue (movie .getSelfReference ().getClass ().equals (AnnotatedSelendroidMovie .class ));
102
107
}
103
108
104
109
@ Override
You can’t perform that action at this time.
0 commit comments