Giter Club home page Giter Club logo

cordova-mobile-spec's Introduction

Cordova Mobile Spec Suite

This cordova-mobile-spec repository can be used to create a Cordova app that provides a set of manual tests to verify Cordova core functionality. It is currently used in the release processes of platforms, plugins and tools.

It also provides access to manual and automated tests of the installed plugins (via cordova-plugin-test-framework).

(History: A very long time ago this repository also included all the manual and automated plugin tests before those were extracted and moved into the plugins themselves.)

Overview

This repository has 3 parts:

  1. This main folder is a Cordova app "template" (config.xml and www) that includes implementations of various functionalities that Cordova supports (battery, events, keyboard, lazyloadjs, splashscreens, sql, storage, misc) that can manually be tested, some benchmarks, and a link to the automated and manual tests installed plugins offer (cdvtests/index.html).

  2. There are 4 plugins as well: cordova-plugin-echo ("plugin implementation of the Echo function to test the bridge"), cordova-plugin-mobilespec-tests ("Cordova Non Plugin Auto Tests"), cordova-plugin-thirdparty-tests ("Tests for popular third-party plugins") and cordova-plugin-whitelist (TODO).

  3. The createmobilespec folder contains a script/CLI to create a Cordova app

    1. using the locally installed Cordova CLI, the currently up to date (published on npm) platforms and plugins (including their tests!), and the 4 local plugins from 2) (mode --global) or
    2. using local checkouts (via cordova-coho) of all these (CLI, tools, platforms, plugins...) or
    3. with several other modes (to e.g. use plugman and /bin/create instead of the CLI)

The end result is a folder ../mobilespec with a Cordova app that can be installed on devices. It can be used for some manual testing with the functionality offered by 1) or run the tests additionally provided by the plugins via cordova-plugin-test-framework.

Usage

See the README.md in /createmobilespec for usage instruction on how to create the "mobilespec" app.

Cordova Plugin File-Transfer Tests

Tests of Cordova Plugin File-Transfer require a test server. Follow these instructions to install and run the server and configure the plugin.

cordova-mobile-spec's People

Contributors

agrieve avatar alsorokin avatar becka11y avatar brycecurtis avatar clelland avatar cmarcelk avatar csantanapr avatar dblotsky avatar don avatar filmaj avatar gtanner avatar infil00p avatar jamesjong avatar janpio avatar jsoref avatar ldeluca avatar lmnbeyond avatar macdonst avatar martincgg avatar mmocny avatar mwbrooks avatar mwoghiren avatar purplecabbage avatar sgrebnov avatar shazron avatar silentrob avatar stacic avatar stevengill avatar tripodsan avatar zalun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-mobile-spec's Issues

mobile-spec project creation fails with error "Cannot find module 'cordova-common'"

mobile-spec project creation fails with the error "Error: Cannot find module 'cordova-common'" when trying to execute the command - "node ./cordova-mobile-spec/createmobilespec/createmobilespec.js --android --forceplugins"

If I try adding cordova-common module in mobile-spec project manually and try executing the platform add command using - "root_folder\cordova-cli\bin\cordova.cmd platform add "root_folder\cordova-android" --verbose" , platform addition is successfully.

Not sure how to bring in cordova-common module installed as dependency while creating mobile-spec project

Use eslint

I think it would be good to use eslint to help keep the JavaScript as consistent as possible with the rest of Cordova. A major example is the use of double-quotes while most of our other modules use single-quotes.

Reintroduce 3rd party plugin testing

#179 removed 3rd party plugin testing. This is a useful thing in general, should be investigated if and how this can be included again.

Note: Does not have to be in this project or any existing project, maybe it makes sense to start something new for that.

createmobilespec.js fails with a git error

Bug Report

Problem

What is expected to happen?

A command like this from the documentation should just work after following the prerequisites:

node ./cordova-mobile-spec/createmobilespec/createmobilespec.js --android

What does actually happen?

failed with a git error, like this:

brodybits@brodybits-mini-macbook cordova-testing % ./cordova-mobile-spec/createmobilespec/createmobilespec.js --android           
### Creating project from local git repos. If you have any errors, it may be from missing repositories.
To clone repositories:
  ./cordova-coho/coho repo-clone -r mobile-spec -r plugin-test-framework -r cli -r lib -r plugman -r android -r js -r plugins
  mkdir cordova-cli/node_modules
  (cd cordova-lib && npm install)
  (cd cordova-plugman/ && npm install)
  mkdir cordova-cli/node_modules
  ln -s ../../cordova-lib cordova-cli/node_modules
  (cd cordova-cli && npm install)
To update all repositories:
  ./cordova-coho/coho repo-update
Checking if you are using master branch of tools (js, lib, plugman, cli)
$ git symbolic-ref HEAD
refs/heads/master
$ git symbolic-ref HEAD
refs/heads/master
$ git symbolic-ref HEAD
refs/heads/master
$ git symbolic-ref HEAD
refs/heads/master
You are on master branch of tools, checking npm links
npm links are OK
### Creating project mobilespec...
$ /Users/brodybits/dev/cordova-testing/cordova-cli/bin/cordova create mobilespec org.apache.cordova.mobilespec MobileSpec_Tests --template cordova-mobile-spec/www
Warning: using prerelease version 10.0.0-dev ([email protected])
Creating a new cordova project.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://[email protected]/cordova-mobile-spec/www.git
npm ERR! 
npm ERR! ERROR: Repository not found.
npm ERR! fatal: Could not read from remote repository.
npm ERR! 
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR! 
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/brodybits/.npm/_logs/2020-06-24T17_16_23_896Z-debug.log
    at ChildProcess.whenDone (/Users/brodybits/dev/cordova-testing/cordova-common/src/superspawn.js:136:25)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) {
  stderr: 'npm ERR! Error while executing:\n' +
    'npm ERR! /usr/bin/git ls-remote -h -t ssh://[email protected]/cordova-mobile-spec/www.git\n' +
    'npm ERR! \n' +
    'npm ERR! ERROR: Repository not found.\n' +
    'npm ERR! fatal: Could not read from remote repository.\n' +
    'npm ERR! \n' +
    'npm ERR! Please make sure you have the correct access rights\n' +
    'npm ERR! and the repository exists.\n' +
    'npm ERR! \n' +
    'npm ERR! exited with error code: 128\n' +
    '\n' +
    'npm ERR! A complete log of this run can be found in:\n' +
    'npm ERR!     /Users/brodybits/.npm/_logs/2020-06-24T17_16_23_896Z-debug.log\n',
  code: 1
}

possible fix

The following change seemed to resolve this issue:

diff --git a/createmobilespec/createmobilespec.js b/createmobilespec/createmobilespec.js
index 1e0bf85..21cf96b 100755
--- a/createmobilespec/createmobilespec.js
+++ b/createmobilespec/createmobilespec.js
@@ -420,7 +420,7 @@ if (argv.plugman) {
     // Create the project using "cordova create"
     myDelete(cli_project_dir);
     console.log("### Creating project mobilespec...");
-    executeShellCommand(cli + " create " + projectDirName + " org.apache.cordova.mobilespec MobileSpec_Tests --template cordova-mobile-spec" + path.sep + "www");
+    executeShellCommand(cli + " create " + projectDirName + " org.apache.cordova.mobilespec MobileSpec_Tests --template ./cordova-mobile-spec" + path.sep + "www");
     shelljs.cp("-f", path.join(mobile_spec_git_dir, 'config.xml'), path.join(projectDirName, 'config.xml'));
 
     // Config.json file ---> linked to local libraries

Information

see above

Command or Code

see above

Environment, Platform, Device

see above & below

Version information

host: macOS Catalina

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above

Consistent failures on Android

  • file.spec.147 - consistently fails on Android
  • cordova-plugin-file-transfer-tests.tests - multiple failures, consistently on Android
  • cordova-plugin-media-tests - multiple failures, consistently on my Samsung Galaxy S6 device (seemed to work in the past)

commands do not look right in ./createmobilespec/README.md

Bug Report

Problem

What is expected to happen?

It should be possible to paste the commands into the shell.

What does actually happen?

  • Commands in preparation do not work in macOS or Linux shell due to single ampersand - fix is proposed in PR #204
  • Some commands under usage do not work since they do not include platforms

Information

see above

Command or Code

see commands in https://github.com/apache/cordova-mobile-spec/blob/master/createmobilespec/README.md

Environment, Platform, Device

see below

Version information

host: macOS Catalina

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above

Cleanup or remove testing with third-party plugins

in

// List generated based on download counts on registry.
var CORDOVA_REGISTRY_PLUGINS = [
'com.ionic.keyboard',
'com.google.playservices',
'de.appplant.cordova.plugin.local-notification',
'com.phonegap.plugins.barcodescanner',
'com.cranberrygame.phonegap.plugin.ad.admob',
// 'com.google.cordova.admob', // these two conflict. Use the most popular one.
// 'com.google.admob',
// Currently need an git version of this to fix a bug in published version.
// It's a dep of plugin.google.maps
'https://github.com/wf9a5m75/phonegap-http-request.git',
'plugin.google.maps',
'com.rjfun.cordova.extension',
'net.yoik.cordova.plugins.screenorientation',
'de.appplant.cordova.plugin.email-composer',
'com.msopentech.azure-mobile-services',
// 'com.phonegap.plugins.pushplugin', // This one bundles play services, causing duplicate symbols
'com.phonegap.plugins.facebookconnect',
'com.danielcwilson.plugins.googleanalytics'
];
// Commented out plugins are popular, but duplicate those in CPR.
var TELERIK_VERIFIED_PLUGINS = [
'https://github.com/Telerik-Verified-Plugins/Flashlight',
'https://github.com/Telerik-Verified-Plugins/SocialSharing',
'https://github.com/Telerik-Verified-Plugins/ActionSheet',
'https://github.com/Telerik-Verified-Plugins/Calendar',
// 'https://github.com/Telerik-Verified-Plugins/EmailComposer',
'https://github.com/Telerik-Verified-Plugins/NativePageTransitions',
'https://github.com/Telerik-Verified-Plugins/Toast',
// 'https://github.com/Telerik-Verified-Plugins/BarcodeScanner',
'https://github.com/Telerik-Verified-Plugins/Keychain',
// 'https://github.com/Telerik-Verified-Plugins/Keyboard',
'https://github.com/Telerik-Verified-Plugins/NFC',
'https://github.com/Telerik-Verified-Plugins/AppVersion',
'https://github.com/Telerik-Verified-Plugins/PrivacyScreen'
];
var PLUGREG_PLUGINS = [
'https://github.com/brodysoft/Cordova-SQLitePlugin.git',
// 'https://github.com/wildabeast/BarcodeScanner.git',
// 'https://github.com/phonegap-build/PushPlugin.git',
];

Some things I can think of right now:

  • plugins commented out would likely be outdated
  • CORDOVA_REGISTRY_PLUGINS looks like it comes from an old registry
  • TELERIK_VERIFIED_PLUGINS may have some outdated plugins
  • PLUGREG_PLUGINS has a single plugin by myself that is definitely outdated

P.S. According to the comment in https://github.com/apache/cordova-mobile-spec/pull/153/files#r236861171, things are broken with third-party plugins in https://github.com/apache/cordova-mobile-spec/blob/master/createmobilespec/createmobilespec.js#L143-L147

I would now favor remove testing with third-party plugins, as discussed below.

npm audit warning in createmobilespec

brodybits@brodybits-mini-macbook cordova-mobile-spec % cd createmobilespec 
brodybits@brodybits-mini-macbook createmobilespec % npm audit
                                                                                
                       === npm audit security report ===                        
                                                                                
┌──────────────────────────────────────────────────────────────────────────────┐
│                                Manual Review                                 │
│            Some vulnerabilities require your attention to resolve            │
│                                                                              │
│         Visit https://go.npm.me/audit-guide for additional guidance          │
└──────────────────────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low           │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ minimist                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in>=0.2.1 <1.0.0 || >=1.2.3                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ optimist                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ optimist > minimist                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/1179                            │
└───────────────┴──────────────────────────────────────────────────────────────┘
found 1 low severity vulnerability in 154 scanned packages
  1 vulnerability requires manual review. See the full report for details.

[Windows] Tests with external URLs fail because of `http://`

Migrated from https://issues.apache.org/jira/browse/CB-13905:

Creating a mobile-spec project for Windows with:

./cordova-mobile-spec/createmobilespec/createmobilespec.js --windows --forceplugins

shows lots of errors like these during creation:


Access rules must begin with "https://", the following rule will be ignored: http://audio.ibeat.org
Access rules must begin with "https://", the following rule will be ignored: http://whatheaders.com
Access rules must begin with "https://", the following rule will be ignored: http://*.apache.org
Access rules must begin with "https://", the following rule will be ignored: http://www.google.com
Access rules must begin with "https://", the following rule will be ignored: http://google.co.uk
Access rules must begin with "https://", the following rule will be ignored: http://techslides.com
Access rules must begin with "https://", the following rule will be ignored: httpssss://example.com
The following navigation rule had an invalid URI scheme and will be ignored: "httpssss://example.com".
The following navigation rule had an invalid URI scheme and will be ignored: "cdvfile:*".
The following navigation rule had an invalid URI scheme and will be ignored: "data:*".
Access rules must begin with "https://", the following rule will be ignored: http://audio.ibeat.org
Access rules must begin with "https://", the following rule will be ignored: http://whatheaders.com
Access rules must begin with "https://", the following rule will be ignored: http://*.apache.org
Access rules must begin with "https://", the following rule will be ignored: http://www.google.com
Access rules must begin with "https://", the following rule will be ignored: http://google.co.uk
Access rules must begin with "https://", the following rule will be ignored: http://techslides.com
Access rules must begin with "https://", the following rule will be ignored: httpssss://example.com

Those also repeat when running the created project with cordova run windows --archs=x86:

Access rules must begin with "https://", the following rule will be ignored: http://audio.ibeat.org
Access rules must begin with "https://", the following rule will be ignored: http://whatheaders.com
Access rules must begin with "https://", the following rule will be ignored: http://*.apache.org
Access rules must begin with "https://", the following rule will be ignored: http://www.google.com
Access rules must begin with "https://", the following rule will be ignored: http://google.co.uk
Access rules must begin with "https://", the following rule will be ignored: http://techslides.com
Access rules must begin with "https://", the following rule will be ignored: httpssss://example.com
The following navigation rule had an invalid URI scheme and will be ignored: "httpssss://example.com".
The following navigation rule had an invalid URI scheme and will be ignored: "cdvfile:*".
The following navigation rule had an invalid URI scheme and will be ignored: "data:*".
Access rules must begin with "https://", the following rule will be ignored: http://audio.ibeat.org
Access rules must begin with "https://", the following rule will be ignored: http://whatheaders.com
Access rules must begin with "https://", the following rule will be ignored: http://*.apache.org
Access rules must begin with "https://", the following rule will be ignored: http://www.google.com
Access rules must begin with "https://", the following rule will be ignored: http://google.co.uk
Access rules must begin with "https://", the following rule will be ignored: http://techslides.com
Access rules must begin with "https://", the following rule will be ignored: httpssss://example.com
Tests will use the following file transfer server address: http://rwswbpiopr.localtunnel.me

And as a result the automates tests using those URLs also fail:

image

Troubles with iOS

I got a linker error due to multiple definitions of CDVLogger. When I tried removing cordova-plugin-logger it would build and run on iOS, then crash near the beginning of the automatic tests.

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.