You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ti...@apache.org on 2020/08/30 15:18:47 UTC

[cordova-paramedic] 01/01: fix: re-add proxy

This is an automated email from the ASF dual-hosted git repository.

timbru31 pushed a commit to branch feat/ios-nightly
in repository https://gitbox.apache.org/repos/asf/cordova-paramedic.git

commit 216fb49fd3854532acff868700f2967976c797c6
Author: Tim Brust <gi...@timbrust.de>
AuthorDate: Sat Aug 29 22:44:05 2020 +0200

    fix: re-add proxy
---
 .github/workflows/debug.yml | 50 +++++++++++++++++++++++++++++++++++
 .travis.yml                 | 64 +++++++++++++++++++++++----------------------
 lib/ParamedicApp.js         |  2 +-
 lib/ParamedicSauceLabs.js   |  9 ++++---
 lib/paramedic.js            |  5 ++--
 5 files changed, 92 insertions(+), 38 deletions(-)

diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml
new file mode 100644
index 0000000..3e286e3
--- /dev/null
+++ b/.github/workflows/debug.yml
@@ -0,0 +1,50 @@
+# 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.
+
+name: Node CI
+
+on: [push, pull_request]
+
+jobs:
+  test:
+    name: NodeJS ${{ matrix.node-version }} on ${{ matrix.os }}
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        node-version: [12.x]
+        os: [ubuntu-latest]
+
+    steps:
+      - uses: actions/checkout@v2
+
+      - name: Use Node.js ${{ matrix.node-version }}
+        uses: actions/setup-node@v1
+        with:
+          node-version: ${{ matrix.node-version }}
+
+      - name: Environment Information
+        run: |
+          node --version
+          npm --version
+      - name: npm install and test
+        run: |
+          npm i -g cordova
+          npm ci
+          npm run test-saucelabs-browser -- --sauceUser cordova
+        env:
+          CI: true
+          SAUCE_ACCESS_KEY : ${{ secrets.SAUCE_ACCESS_KEY  }}
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index 2584cb5..85829b0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -16,6 +16,8 @@
 # under the License.
 
 addons:
+  sauce_connect:
+    username: cordova
   jwt:
     # SAUCE_ACCESS_KEY
     secure: "3ZtWdybHvGm9uVJjMeMfGcbptdI+9xALUt8T5iLZWFE6yE10ulP4Svn7RvtCspQVRqKdmDeAHmKl8Rm84WQCh+hy2N9Vn4CW+ZfVg2R5/DAgG3ChMWcDOggoPMtr9I8iw8GLz6/78CY+RV+QOunRsUhTrjiSiegWek+0BUuz4rV9n4VVJJ3r63HXkY1ylJJpSOrQf/ZbXW/fz33Inlk5LUhAokjrD2NsrMtcMFcketFo4s61qu/SyRmD/vwi2dWhDUqLyiOFyWGr85h6zIYifniep72ijsD/v7gw3yM+yePStHAwgMaM3DMxnMmiikYGE4WSRwU79lxmug7VmbSYdZxNztwnrCr3Yy82wFmahDC/tQcNb+XdCLD1qrGhVR26KBDbHVBtK/PJLq8gQ+rZrX2qTm7aNsasw65rHgRGxaj5ndYBNM+0Kgwk+s0SrwRw49fHjaZYCqGLooedlYT7KU/iYtl8ysd [...]
@@ -53,14 +55,14 @@ _android: &_android
 matrix:
   include:
     # additional `npm test` in directory
-    - env: ADDITIONAL_TESTS_DIR=./spec/testable-plugin/tests/foo
-      <<: *_ios
+    # - env: ADDITIONAL_TESTS_DIR=./spec/testable-plugin/tests/foo
+    #   <<: *_ios
 
-    # local tests, without saucelabs
-    - env: PLATFORM=local/browser
-      <<: *_ios
-    - env: PLATFORM=local/ios-10.0
-      <<: *_ios
+    # # local tests, without saucelabs
+    # - env: PLATFORM=local/browser
+    #   <<: *_ios
+    # - env: PLATFORM=local/ios-10.0
+    #   <<: *_ios
 
     # many tests with saucelabs
     - env: PLATFORM=browser-chrome
@@ -68,29 +70,28 @@ matrix:
     - env: PLATFORM=browser-safari
     - env: PLATFORM=browser-edge
 
-    - env: PLATFORM=ios-11.3
-      <<: *_ios
-    - env: PLATFORM=ios-12.0
-      <<: *_ios
-    - env: PLATFORM=ios-12.2
-      <<: *_ios
-
-    - env: PLATFORM=android-5.1
-      <<: *_android
-    - env: PLATFORM=android-6.0
-      <<: *_android
-    - env: PLATFORM=android-7.0
-      <<: *_android
-    - env: PLATFORM=android-7.1
-      <<: *_android
-    - env: PLATFORM=android-8.0
-      <<: *_android
-    - env: PLATFORM=android-8.1
-      <<: *_android
-    - env: PLATFORM=android-9.0
-      <<: *_android
-    - env: PLATFORM=android-10.0
-      <<: *_android
+    # - env: PLATFORM=ios-11.3
+    #   <<: *_ios
+    # - env: PLATFORM=ios-12.0
+    #   <<: *_ios
+    # - env: PLATFORM=ios-12.2
+    #   <<: *_ios
+    # - env: PLATFORM=android-5.1
+    #   <<: *_android
+    # - env: PLATFORM=android-6.0
+    #   <<: *_android
+    # - env: PLATFORM=android-7.0
+    #   <<: *_android
+    # - env: PLATFORM=android-7.1
+    #   <<: *_android
+    # - env: PLATFORM=android-8.0
+    #   <<: *_android
+    # - env: PLATFORM=android-8.1
+    #   <<: *_android
+    # - env: PLATFORM=android-9.0
+    #   <<: *_android
+    # - env: PLATFORM=android-10.0
+    #   <<: *_android
 
 before_install:
   # manually install Node for `language: android`
@@ -98,7 +99,7 @@ before_install:
   - node --version
   - if [[ "$PLATFORM" =~ android ]]; then gradle --version; fi
   - if [[ "$PLATFORM" =~ ios ]]; then npm install -g ios-deploy; fi
-  - npm install -g cordova
+  - npm install -g cordova serve
   # install paramedic if not running on paramedic repo
   - if ! [[ "$TRAVIS_REPO_SLUG" =~ cordova-paramedic ]]; then npm install -g github:apache/cordova-paramedic; fi
 
@@ -129,6 +130,7 @@ before_script:
     echo "PARAMEDIC_BUILDNAME=$PARAMEDIC_BUILDNAME"
 
 script:
+  - serve . &
   - $TEST_COMMAND
   - |
     if [[ "$ADDITIONAL_TESTS_DIR" != "" ]]; then
diff --git a/lib/ParamedicApp.js b/lib/ParamedicApp.js
index 887bb42..8555e29 100644
--- a/lib/ParamedicApp.js
+++ b/lib/ParamedicApp.js
@@ -120,7 +120,7 @@ class ParamedicApp {
                         this.runner.browserPatched = true;
                     } else {
                         cordovaRunFile = path.join(this.tempFolder.name, 'platforms', 'browser', 'cordova', 'lib', 'run.js');
-                        if (appPatcher.monkeyPatch(cordovaRunFile, /return server\.launchBrowser\(\{'target': args\.target, 'url': projectUrl\}\);/, '// no pop-up please')) {
+                        if (appPatcher.monkeyPatch(cordovaRunFile, /return server\.launchBrowser\(\{\s*'target': args\.target, 'url': projectUrl\s*\}\);/, '// no pop-up please')) {
                             logger.info('cordova-paramedic: success!');
                             this.runner.browserPatched = true;
                         } else {
diff --git a/lib/ParamedicSauceLabs.js b/lib/ParamedicSauceLabs.js
index bd61d21..d3202b7 100644
--- a/lib/ParamedicSauceLabs.js
+++ b/lib/ParamedicSauceLabs.js
@@ -319,9 +319,9 @@ class ParamedicSauceLabs {
             // setting from env.var here and not in the config
             // because for any other platform we don't need to put the sauce connect up
             // unless the tunnel id is explicitly passed (means that user wants it anyway)
-            if (!caps.tunnelIdentifier && process.env[utilities.SAUCE_TUNNEL_ID_ENV_VAR]) {
-                caps.tunnelIdentifier = process.env[utilities.SAUCE_TUNNEL_ID_ENV_VAR];
-            } else if (!caps.tunnelIdentifier) {
+            if (!caps['sauce:options'] && process.env[utilities.SAUCE_TUNNEL_ID_ENV_VAR]) {
+                caps['sauce:options'].tunnelIdentifier = process.env[utilities.SAUCE_TUNNEL_ID_ENV_VAR];
+            } else if (!caps['sauce:options']) {
                 throw new Error('Testing browser platform on Sauce Labs requires Sauce Connect tunnel. Please specify tunnel identifier via --sauceTunnelId');
             }
             break;
@@ -365,7 +365,7 @@ class ParamedicSauceLabs {
     connectSauceConnect () {
         const isBrowser = this.isBrowser;
 
-        // on platforms other than browser, only run sauce connect if user explicitly asks for it
+        //on platforms other than browser, only run sauce connect if user explicitly asks for it
         if (!isBrowser && !this.config.getSauceTunnelId()) return Q();
         // on browser, run sauce connect in any case
         if (isBrowser && !this.config.getSauceTunnelId()) {
@@ -495,6 +495,7 @@ class ParamedicSauceLabs {
                                 })
                                 .fail((error) => {
                                     logger.warn('cordova-paramedic, pollForResults error: ' + error);
+                                    console.log(error);
                                     polling = false;
                                 });
                         }
diff --git a/lib/paramedic.js b/lib/paramedic.js
index b1d0bea..b5d9f3d 100644
--- a/lib/paramedic.js
+++ b/lib/paramedic.js
@@ -62,7 +62,8 @@ class ParamedicRunner {
 
         this.checkConfig();
 
-        return Q().then(() => {
+        return Q()
+         .then(() => {
             // create project and prepare (install plugins, setup test startpage, install platform, check platform requirements)
             const paramedicApp = new ParamedicApp(this.config, this.storedCWD, this);
             this.tempFolder = paramedicApp.createTempProject();
@@ -417,7 +418,7 @@ class ParamedicRunner {
             .concat([this.config.getArgs()]);
 
         if (this.isBrowser) {
-            return Q(cmd.join(' '));
+            return cmd.join(' ');
         } else if (this.config.getAction() === 'build' || (this.isWindows && this.config.getArgs().indexOf('appx=8.1-phone') < 0)) {
             // The app is to be run as a store app or just build. So no need to choose a target.
             return Q(cmd.join(' '));


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