cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vladimir-kotikov <...@git.apache.org>
Subject [GitHub] cordova-medic pull request: Appium runner improvements
Date Wed, 30 Mar 2016 09:34:23 GMT
Github user vladimir-kotikov commented on a diff in the pull request:

    https://github.com/apache/cordova-medic/pull/85#discussion_r57860571
  
    --- Diff: lib/appium/helpers/wdHelper.js ---
    @@ -0,0 +1,112 @@
    +/* jshint node: true */
    +/* global navigator */
    +/*
    + *
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + *
    +*/
    +
    +'use strict';
    +
    +var APPIUM_SERVER_HOST = 'localhost';
    +var APPIUM_SERVER_PORT = 4723;
    +var WEBVIEW_WAIT_TIMEOUT = 5000;
    +var IMPLICIT_WAIT_TIMEOUT = 10000;
    +
    +var fs = require('fs');
    +var path = require('path');
    +
    +module.exports.getDriver = function (platform) {
    +    var normalizedPlatform;
    +    switch (platform.toLowerCase()) {
    +        case 'android':
    +            normalizedPlatform = 'Android';
    +            break;
    +        case 'ios':
    +            normalizedPlatform = 'iOS';
    +            break;
    +        default:
    +            throw 'Unknown platform: ' + platform;
    +    }
    +
    +    var serverConfig = {
    +        host: APPIUM_SERVER_HOST,
    +        port: APPIUM_SERVER_PORT
    +    };
    +
    +    var driverConfig = {
    +        browserName: '',
    +        'appium-version': '1.5',
    +        platformName: normalizedPlatform,
    +        platformVersion: global.PLATFORM_VERSION || '',
    +        deviceName: global.DEVICE_NAME || '',
    +        app: global.PACKAGE_PATH,
    +        autoAcceptAlerts: true,
    +    };
    +
    +    var driver = global.WD.promiseChainRemote(serverConfig);
    +    module.exports.configureLogging(driver);
    +
    +    return driver
    +        .init(driverConfig)
    +        .setImplicitWaitTimeout(IMPLICIT_WAIT_TIMEOUT);
    +};
    +
    +module.exports.getWD = function () {
    +    return global.WD;
    +};
    +
    +module.exports.getWebviewContext = function (driver) {
    --- End diff --
    
    What if the webview couldn't be loaded somehow? Maybe we need to limit number of attempts?

    ```js
    getWebviewContext = function (driver, maxAttempts) {
    ...
        return getWebviewContext(driver, maxAttempts - 1);
    });
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


Mime
View raw message