cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-10639) Camera plugin Appium tests for Android occasionally fail
Date Tue, 23 Feb 2016 19:48:18 GMT

    [ https://issues.apache.org/jira/browse/CB-10639?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15159527#comment-15159527
] 

ASF GitHub Bot commented on CB-10639:
-------------------------------------

Github user vladimir-kotikov commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-camera/pull/177#discussion_r53838196
  
    --- Diff: appium-tests/android/android.spec.js ---
    @@ -295,13 +318,35 @@ describe('Camera tests Android.', function () {
                         .then(function () {
                             return driver; // no-op
                         }, function (error) {
    -                        expect(true).toFailWithMessage(error);
    +                        if (error.message.indexOf('Error response status: 6') >= 0)
{
    +                            // the session has expired but we can fix this!
    +                            console.log('The session has expired. Trying to start a new
one...');
    +                            return getDriver();
    +                        } else {
    +                            expect(true).toFailWithMessage(error);
    +                        }
                         })
    -                    .execute('document.getElementById("info").innerHTML = "' + startingMessage
+ '";')
    +                    .execute('document.getElementById("info").innerHTML = "' + STARTING_MESSAGE
+ '";')
                         .finally(done);
                 }
                 done();
    -        }, 600000);
    +        }, 3 * MINUTE);
    +
    +        afterEach(function (done) {
    +            // recreate the session if there was a critical error in the spec
    +            if (stopFlag) {
    +                return driver
    --- End diff --
    
    This is not obvious that you're `return`'ing a promise here just to avoid second `done`
call at the end of `afterEach`
    
    I'd recommend you to reverse `if` condition to enclose the shortest code path and reduce
nesting, and to explicitly do a return after `done`. Something like:
    ```javascript
    if (!stopFlag) {
        done();
        return;
    }
    // promise chain here 
    ```


> Camera plugin Appium tests for Android occasionally fail
> --------------------------------------------------------
>
>                 Key: CB-10639
>                 URL: https://issues.apache.org/jira/browse/CB-10639
>             Project: Apache Cordova
>          Issue Type: Test
>          Components: Plugin Camera
>            Reporter: Alexander Sorokin
>            Assignee: Alexander Sorokin
>              Labels: android, triaged
>
> Tests occasionally fail to locate camera's shutter or 'Save' buttons.
> {noformat}
> [MEDIC LOG Wed, 17 Feb 2016 12:38:47 GMT] Starting new spec: camera.ui.spec.1 Saving
the picture to photo library
>  > CALL context("WEBVIEW_org.apache.mobilespec") 
>  > POST /session/:sessionID/context {"name":"WEBVIEW_org.apache.mobilespec"}
>  > RESPONSE context("WEBVIEW_org.apache.mobilespec") 
>  > CALL execute("document.getElementById(\"info\").innerHTML = \"Ready for action!\";")

>  > POST /session/:sessionID/execute {"script":"document.getElementById(\"info\").innerHTML
= \"Ready for action!\";","args":[]}
>  > RESPONSE execute("document.getElementById(\"info\").innerHTML = \"Ready for action!\";")
null
>  > CALL context("WEBVIEW_org.apache.mobilespec") 
>  > POST /session/:sessionID/context {"name":"WEBVIEW_org.apache.mobilespec"}
>  > RESPONSE context("WEBVIEW_org.apache.mobilespec") 
> undefined
>  > CALL elementById("info") 
>  > POST /session/:sessionID/element {"using":"id","value":"info"}
>  > RESPONSE elementById("info") {"ELEMENT":"0.30098064825870097-1"}
>  > CALL sleep(5000) 
>  > RESPONSE sleep(5000) 
>  > CALL context("WEBVIEW_org.apache.mobilespec") 
>  > POST /session/:sessionID/context {"name":"WEBVIEW_org.apache.mobilespec"}
>  > RESPONSE context("WEBVIEW_org.apache.mobilespec") 
>  > CALL context("WEBVIEW_org.apache.mobilespec") 
>  > POST /session/:sessionID/context {"name":"WEBVIEW_org.apache.mobilespec"}
>  > RESPONSE context("WEBVIEW_org.apache.mobilespec") 
>  > CALL execute("navigator.camera.getPicture(function (result) { document.getElementById('info').innerHTML
= result.slice(0, 100); }, function (err) { document.getElementById('info').innerHTML = 'ERROR:
' + err; },{\"quality\":50,\"allowEdit\":false,\"sourceType\":1,\"saveToPhotoAlbum\":true});")

>  > POST /session/:sessionID/execute {"script":"navigator.camera.getPicture(function
(result) { document.getElementById('info').innerHTML = result.slice(0, 100); }, function (err)
{ document.getElementById('info').innerHTML = 'ERROR: ' + err; },{\"quality\":50,\"allowEdit\":false,\"sourceType\":1,\"saveToPhotoAlbum\":true});","args":[]}
>  > RESPONSE execute("navigator.camera.getPicture(function (result) { document.getElementById('info').innerHTML
= result.slice(0, 100); }, function (err) { document.getElementById('info').innerHTML = 'ERROR:
' + err; },{\"quality\":50,\"allowEdit\":false,\"sourceType\":1,\"saveToPhotoAlbum\":true});")
null
>  > CALL sleep(5000) 
>  > RESPONSE sleep(5000) 
>  > CALL context("NATIVE_APP") 
>  > POST /session/:sessionID/context {"name":"NATIVE_APP"}
>  > RESPONSE context("NATIVE_APP") 
>  > CALL elementByXPath("//android.widget.ImageView[contains(@resource-id,'shutter')]")

>  > POST /session/:sessionID/element {"using":"xpath","value":"//android.widget.ImageView[contains(@resource-id,'shutter')]"}
> An error occured: [elementByXPath("//android.widget.ImageView[contains(@resource-id,'shutter')]")]
Error response status: 7, , NoSuchElement - An element could not be located on the page using
the given search parameters. Selenium error: An element could not be located on the page using
the given search parameters.
> Failing with message: [elementByXPath("//android.widget.ImageView[contains(@resource-id,'shutter')]")]
Error response status: 7, , NoSuchElement - An element could not be located on the page using
the given search parameters. Selenium error: An element could not be located on the page using
the given search parameters.
> [MEDIC LOG Wed, 17 Feb 2016 12:40:11 GMT] Spec failed: camera.ui.spec.1 Saving the picture
to photo library
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message