GithubHelp home page GithubHelp logo

Comments (16)

janpio avatar janpio commented on July 20, 2024 1

Noticed one more thing in our failing test run on Saucelabs:
image

For the successful dialogs plugin this is just:
image

Does this maybe indicate a failure/timeout in that step that stops execution?

from cordova-plugin-inappbrowser.

alsorokin avatar alsorokin commented on July 20, 2024 1

The command looking for "Allow" button should fail shortly, as it does in dialogs, but for some reason it times out after a minute.

from cordova-plugin-inappbrowser.

janpio avatar janpio commented on July 20, 2024 1

Found the actual workaround you probably meant - we did not bust the permissions for the splashscreen plugin because it was hanging on Android 7. Expanded that to inappbrowser, and voila, it works 🥇

from cordova-plugin-inappbrowser.

janpio avatar janpio commented on July 20, 2024

Compare the failing test here, to a similarly configured one from another plugin:

failing here:
https://travis-ci.org/apache/cordova-plugin-inappbrowser/jobs/435601803
https://saucelabs.com/beta/tests/7e834da3d10d4f08b614d05fcccdfa39/metadata#6

succeeding over there:
https://travis-ci.org/apache/cordova-plugin-geolocation/jobs/435617323
https://saucelabs.com/beta/tests/86c40977eac144848f0342e4b7cfb048/metadata#11

environment, version etc all seem identical.

from cordova-plugin-inappbrowser.

janpio avatar janpio commented on July 20, 2024

Last 2 entries from "Appium Logs":

  ...
  {
    "screenshot": null,
    "between_commands": 0.21913504600524902,
    "suggestion_values": [],
    "request": {
      "using": "xpath",
      "value": "//android.widget.Button[translate(@text, \"alow\", \"ALOW\")=\"ALLOW\"]"
    },
    "HTTPStatus": 500,
    "result": "ERROR user closed connection while waiting for command to complete",
    "suggestion": null,
    "duration": 299.9810121059418,
    "path": "element",
    "method": "POST",
    "timelineSeconds": 20.475893020629883
  },
  {
    "screenshot": 1,
    "between_commands": 237.02974104881287,
    "suggestion_values": [],
    "request": null,
    "HTTPStatus": 200,
    "result": "",
    "suggestion": null,
    "duration": 0.00030684471130371094,
    "path": "/session/7e834da3d10d4f08b614d05fcccdfa39",
    "method": "DELETE",
    "statusCode": 0,
    "timelineSeconds": 320.6760401725769
  }
]

I don't really understand what "//android.widget.Button[translate(@text, \"alow\", \"ALOW\")=\"ALLOW\"]" does and where it comes from.

Update: Got it: https://github.com/apache/cordova-paramedic/blob/31155dfd9287e9c53b034bc00dba4473f7c9bf5c/lib/appium/helpers/wdHelper.js#L282

from cordova-plugin-inappbrowser.

janpio avatar janpio commented on July 20, 2024

Turn out the successful test run in cordova-plugin-geolocation has the same line with alow in it in line 146 the Appium logs - and all the lines before it are identical to our failing test run.

There it results in this:

  {
    "screenshot": null,
    "between_commands": 0.19422101974487305,
    "suggestion_values": [],
    "request": {
      "using": "xpath",
      "value": "//android.widget.Button[translate(@text, \"alow\", \"ALOW\")=\"ALLOW\"]"
    },
    "HTTPStatus": 200,
    "result": {
      "ELEMENT": "1"
    },
    "suggestion": null,
    "duration": 0.032217979431152344,
    "path": "element",
    "method": "POST",
    "statusCode": 0,
    "timelineSeconds": 18.396260023117065
  },

And then the actual testing starts:

{
    "screenshot": 1,
    "between_commands": 0.6282658576965332,
    "suggestion_values": [],
    "request": {},
    "HTTPStatus": 200,
    "result": true,
    "suggestion": null,
    "duration": 3.1124610900878906,
    "path": "element/1/click",
    "method": "POST",
    "statusCode": 0,
    "timelineSeconds": 18.62269902229309
  },
  {
    "screenshot": null,
    "between_commands": 0.5536580085754395,
    "suggestion_values": [],
    "request": {
      "name": "WEBVIEW_io.cordova.hellocordova"
    },
    "HTTPStatus": 200,
    "result": null,
    "suggestion": null,
    "duration": 0.10723495483398438,
    "path": "context",
    "method": "POST",
    "statusCode": 0,
    "timelineSeconds": 22.363425970077515
  },
...

So: Why is this failing for inappbrowser?

from cordova-plugin-inappbrowser.

janpio avatar janpio commented on July 20, 2024

Here is the commit that added the "permissions buster" for Android:
apache/cordova-paramedic@2e7d8da
And here it was adapted for Android 7:
apache/cordova-paramedic@cdb6a23

This does work on almost all plugins, just not this one.

from cordova-plugin-inappbrowser.

janpio avatar janpio commented on July 20, 2024

Unfortunately the logs for the last succeeding test run in this repo are not archived on Saucelabs any more, so no way to check what was happening back then when it last succeeded.

from cordova-plugin-inappbrowser.

janpio avatar janpio commented on July 20, 2024

Similar situation in the Appium Server log as before in the normal Appium log: First 281 lines are identical, ending with this:

...
2018-10-01 13:26:30:209 - [debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["xpath","//android.widget.Button[translate(@text, \"alow\", \"ALOW\")=\"ALLOW\"]","2e31ca5a-b13c-4abe-af4b-5e94c0b560c1"]
2018-10-01 13:26:30:210 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2018-10-01 13:26:30:211 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2018-10-01 13:26:30:211 - [debug] [BaseDriver] Waiting up to 0 ms for condition
2018-10-01 13:26:30:215 - [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//android.widget.Button[translate(@text, \"alow\", \"ALOW\")=\"ALLOW\"]","context":"","multiple":false}}
2018-10-01 13:26:30:217 - [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//android.widget.Button[translate(@text, \"alow\", \"ALOW\")=\"ALLOW\"]","context":"","multiple":false}}
2018-10-01 13:26:30:217 - [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
2018-10-01 13:26:30:218 - [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
2018-10-01 13:26:30:218 - [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding '//android.widget.Button[translate(@text, "alow", "ALOW")="ALLOW"]' using 'XPATH' with the contextId: '' multiple: false

then our failing run is just this:

2018-10-01 13:31:30:186 - [HTTP] <-- POST /wd/hub/session/2e31ca5a-b13c-4abe-af4b-5e94c0b560c1/element - - ms - - 
2018-10-01 13:31:30:326 - [HTTP] --> POST /wd/hub/session/2e31ca5a-b13c-4abe-af4b-5e94c0b560c1/context {"name":"WEBVIEW_io.cordova.hellocordova"}
2018-10-01 13:31:30:327 - [debug] [MJSONWP] Calling AppiumDriver.setContext() with args: ["WEBVIEW_io.cordova.hellocordova","2e31ca5a-b13c-4abe-af4b-5e94c0b560c1"]

(note the 5 minutes time difference here - so just nothing happened for 5 minutes)

while the succeeding one continues:

2018-10-01 13:52:46:542 - [debug] [AndroidBootstrap] Received command result from bootstrap
2018-10-01 13:52:46:544 - [debug] [MJSONWP] Responding to client with driver.findElement() result: {"ELEMENT":"1"}
2018-10-01 13:52:46:544 - [HTTP] <-- POST /wd/hub/session/36a4d6ba-50d0-4135-8adb-5bd90b912d45/element 200 29 ms - 87 
2018-10-01 13:52:46:545 - [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":{"ELEMENT":"1"}}
2018-10-01 13:52:47:176 - [HTTP] --> POST /wd/hub/session/36a4d6ba-50d0-4135-8adb-5bd90b912d45/element/1/click {}
2018-10-01 13:52:47:176 - [debug] [MJSONWP] Calling AppiumDriver.click() with args: ["1","36a4d6ba-50d0-4135-8adb-5bd90b912d45"]
2018-10-01 13:52:47:177 - [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:click","params":{"elementId":"1"}}
2018-10-01 13:52:47:178 - [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"1"}}
2018-10-01 13:52:47:181 - [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
2018-10-01 13:52:47:181 - [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: click
2018-10-01 13:52:50:282 - [debug] [AndroidBootstrap] Received command result from bootstrap
2018-10-01 13:52:50:284 - [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":true}
2018-10-01 13:52:50:284 - [debug] [MJSONWP] Responding to client with driver.click() result: true
2018-10-01 13:52:50:285 - [HTTP] <-- POST /wd/hub/session/36a4d6ba-50d0-4135-8adb-5bd90b912d45/element/1/click 200 3109 ms - 76 
2018-10-01 13:52:50:841 - [HTTP] --> POST /wd/hub/session/36a4d6ba-50d0-4135-8adb-5bd90b912d45/context {"name":"WEBVIEW_io.cordova.hellocordova"}
2018-10-01 13:52:50:842 - [debug] [MJSONWP] Calling AppiumDriver.setContext() with args: ["WEBVIEW_io.cordova.hellocordova","36a4d6ba-50d0-4135-8adb-5bd90b912d45"]
2018-10-01 13:52:50:842 - [debug] [AndroidDriver] Getting a list of available webviews
2018-10-01 13:52:50:843 - [debug] [ADB] Getting connected devices...
2018-10-01 13:52:50:852 - [debug] [ADB] 1 device(s) connected
2018-10-01 13:52:50:852 - [debug] [ADB] Running '/home/chef/android-sdk-linux/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","cat","/proc/net/unix"]
2018-10-01 13:52:50:863 - [debug] [AndroidDriver] WEBVIEW_3775 mapped to pid 3775
2018-10-01 13:52:50:864 - [debug] [AndroidDriver] Getting process name for webview
2018-10-01 13:52:50:864 - [debug] [ADB] Getting connected devices...
2018-10-01 13:52:50:870 - [debug] [ADB] 1 device(s) connected
2018-10-01 13:52:50:870 - [debug] [ADB] Running '/home/chef/android-sdk-linux/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","ps"]
2018-10-01 13:52:50:887 - [debug] [AndroidDriver] Parsed pid: 3775 pkg: io.cordova.hellocordova!
2018-10-01 13:52:50:887 - [debug] [AndroidDriver] from: u0_a72,3775,1361,2355300,113052,ep_poll,0000000000,S,io.cordova.hellocordova
2018-10-01 13:52:50:889 - [debug] [AndroidDriver] returning process name: io.cordova.hellocordova
2018-10-01 13:52:50:889 - [debug] [AndroidDriver] Found webviews: ["WEBVIEW_io.cordova.hellocordova"]
2018-10-01 13:52:50:890 - [debug] [AndroidDriver] Available contexts: ["NATIVE_APP","WEBVIEW_io.cordova.hellocordova"]
2018-10-01 13:52:50:890 - [debug] [AndroidDriver] Connecting to chrome-backed webview context 'WEBVIEW_io.cordova.hellocordova'
...

(here it continues right away)

from cordova-plugin-inappbrowser.

janpio avatar janpio commented on July 20, 2024

Preliminary result

This code here hangs:
https://github.com/apache/cordova-paramedic/blob/5bed039d6dfbb758a19e066d27a2aa1c1739b2f5/lib/appium/helpers/wdHelper.js#L281-L284
Either it doesn't find the button or is blocked somehow else.
Then after the timeout is over, the tests return and fail.

(I don't understand why the final screenshot for the failing test after the timeout shows successful Jasmin test run though - makes no sense to me.)

from cordova-plugin-inappbrowser.

janpio avatar janpio commented on July 20, 2024

(Maybe the test is actually already run - and Appium is trying to take care of other stuff)

In the successful run for geolocation, I noticed that after clicking that button it does somethign with window_handles. Turns out, that is actually some code specifically there for inappbrowser:

https://github.com/apache/cordova-paramedic/blob/5bed039d6dfbb758a19e066d27a2aa1c1739b2f5/lib/appium/helpers/wdHelper.js#L217-L227

(But as this code is not even run in the failing tests, this of course can not be the reason for the failure.)

from cordova-plugin-inappbrowser.

janpio avatar janpio commented on July 20, 2024

Watching the video of the test run at https://saucelabs.com/beta/tests/7e834da3d10d4f08b614d05fcccdfa39/watch#5 confirm that the tests are actually run during the first 35seconds of the video, then just nothing happens any more for the rest of the video.

Test successful test run for geolocation also executes the tests right from the beginning, but then gets an actual permission prompt that can be allowed:
image
https://saucelabs.com/beta/tests/86c40977eac144848f0342e4b7cfb048/watch#7
This happens, and then the test finishes after ~40 seconds.

This means, that geolocation is probably not a good comparison.

from cordova-plugin-inappbrowser.

janpio avatar janpio commented on July 20, 2024

So probably better comparison is cordova-plugin-dialogs:
https://travis-ci.org/apache/cordova-plugin-dialogs/jobs/435622691
https://saucelabs.com/beta/tests/1473fce577824bf89398aae88369dc1c/watch#10
Tests run, then a few seconds nothing and then the test finishes. No permission prompt.

from cordova-plugin-inappbrowser.

janpio avatar janpio commented on July 20, 2024

Observation on the Saucelabs "Commands" tab:

No red border for "POST element" line:
image

Then a red border for our failing inappbrowser:
image

But also a red border for the dialogs plugin:
image

So this probably just means that it couldn'T find the element (remember: This is looking for an "Allow" button to click). Which is also why dialogs doesn't have the POST element/1/click line that geolocation does.

Remains the question: Why does nothing happen here on inAppBrowser?

These are the steps that should follow but never do:
image

from cordova-plugin-inappbrowser.

alsorokin avatar alsorokin commented on July 20, 2024

It might be some trouble with context switching on Appium. We've already had something similar, and with InAppBrowser again, and I vaguely remember having to code some workaround in Paramedic for that.

from cordova-plugin-inappbrowser.

janpio avatar janpio commented on July 20, 2024

We've already had something similar, and with InAppBrowser again, and I vaguely remember having to code some workaround in Paramedic for that.

Yeah, I linked to that above:
#307 (comment)

from cordova-plugin-inappbrowser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.