Ionic Framework SQLite testing with browser

2019-05-09 23:25发布

I followed this tutorial.

How can I test SQLite plugin and dbCopy with ionic serve on web browser?

I found this:

if(window.cordova) {
      // App syntax
      db = $cordovaSQLite.openDB("myapp.db");
    } else {
      // Ionic serve syntax
      db = window.openDatabase("myapp.db", "1.0", "My app", -1);
    }

But it is just for OpenDB but not for copyDB.

My developing environment is just Netbook.

So It has no KVM and it is difficult to install android studio. So I wish to test on web browser.

2条回答
forever°为你锁心
2楼-- · 2019-05-10 00:02

We recently wrote a blog article about how to do integration tests of ionic. You might want to use node express to run the ionic app you're testing as it works better on ci's such as circleci. Try have a look at http://www.dovetaildigital.io/blog/2015/10/28/rails-and-ionic-make-love-part-three and let me know if you have any problems with it.

查看更多
做个烂人
3楼-- · 2019-05-10 00:10

You can compile your code using

>ionic build android

and then send the .apk file to your mobile phone.

Another option is to use genymotion .

PS: Does db = window.openDatabase("myapp.db", "1.0", "My app", -1); works in the browser?

查看更多
登录 后发表回答