@@ -35,7 +35,7 @@ describe("Facebook tests", async function () {
3535
3636 it ( "should log in via custom button" , async function ( ) {
3737 if ( isAndroid ) {
38- var userNameLabelElement = "[@text=' Nativescript User'] " ;
38+ var userNameLabelElement = "Nativescript User" ;
3939 } else {
4040 var userNameLabelElement = "[@name='Nativescript User']" ;
4141 }
@@ -44,12 +44,14 @@ describe("Facebook tests", async function () {
4444 await facebookButton . click ( ) ;
4545
4646 if ( isAndroid ) {
47- const allFields = await driver . findElementsByClassName ( driver . locators . getElementByName ( "textfield" ) ) ;
47+ await driver . wait ( 1000 ) ;
48+ const allFields = await driver . findElementsByClassName ( "android.widget.EditText" ) ;
49+ // driver.locators.getElementByName("android.widget.EditText")
4850 const wd = driver . wd ( ) ;
4951 const action = new wd . TouchAction ( driver . driver ) ;
5052 action
51- . press ( { x : 52 , y : 499 } )
52- . moveTo ( { x : - 2 , y : - 294 } )
53+ . press ( { x : 380 , y : 720 } )
54+ . moveTo ( { x : 380 , y : 410 } )
5355 . release ( ) ;
5456 await action . perform ( ) ;
5557 await driver . wait ( 1000 ) ;
@@ -73,19 +75,17 @@ describe("Facebook tests", async function () {
7375 if ( isAndroid ) {
7476 const logInButton = await driver . findElementByClassName ( driver . locators . button ) ;
7577 await logInButton . click ( ) ;
76- const continueButton = await driver . findElementByText ( "Continue" ) ;
78+ const continueButton = await driver . findElementByAccessibilityId ( "Continue" ) ;
7779 await continueButton . click ( ) ;
7880 } else {
7981 const logInButton = await driver . findElementByText ( "Log In" ) ;
8082 await logInButton . click ( ) ;
8183 const continueButton = await driver . findElementByText ( "Continue" ) ;
8284 await continueButton . click ( ) ;
8385 }
84- const userNameLabel = await driver . findElementByXPath (
85- "//" + driver . locators . getElementByName ( "label" ) + userNameLabelElement
86- ) ;
87- const userName = await userNameLabel . text ( ) ;
88- expect ( userName ) . to . equal ( USER_NAME , "Not logged with the same user" ) ;
86+ await driver . wait ( 1000 ) ;
87+ const userNameLabel = await driver . findElementByText ( "Nativescript User" , SearchOptions . contains ) ;
88+ expect ( userNameLabel ) . to . exist ;
8989 } ) ;
9090
9191 it ( "should log out via custom button" , async function ( ) {
@@ -102,6 +102,9 @@ describe("Facebook tests", async function () {
102102 const allFields = await driver . findElementsByClassName ( driver . locators . getElementByName ( "textfield" ) ) ;
103103 await allFields [ 1 ] . sendKeys ( PASSWORD ) ;
104104 await allFields [ 0 ] . sendKeys ( USERNAME ) ;
105+ try {
106+ await driver . driver . hideDeviceKeyboard ( "Done" ) ;
107+ } catch ( error ) { }
105108 const logInButton = await driver . findElementByClassName ( driver . locators . button ) ;
106109 await logInButton . click ( ) ;
107110 } else {
0 commit comments