Unit testing for FirefoxOS packaged app - unit-testing

I want to write a unit testing code for a Firefox OS packaged app.
src/manifest.webapp
src/app.html
src/app.js
test/manifest.webapp
test/unittest.html
test/unittest.js
Is there a way to load app.js from unittest.html?
<script src="../src/app.js"></script>
This doesn't work when I launch unittest.html as a packaged app.

Made an example and it works for me. Take a look at https://dl.dropboxusercontent.com/u/134884/packagedtest.zip . I tried it in a Firefox 1.2 Simulator using the App Manager from Firefox Nightly, if it makes any difference.
Something else must be the issue. Use the developer tools to connect to the simulator to see if there are any relevant errors in the console. If you are using the App Manager, just click the "Debug" button bellow the app to do that. If you are using the Simulator 1.1 add-on, click the "Connect" button next to the app.

Related

expo dev client application doesn't open

I'm trying to use expo-dev-client to add react-native-sms-retriever library to my project because expo doesn't have a library that supports reading sms messages. In expo documentation, it's suggested that I should use expo-dev-client to add custom native code. You can see the documentation here: https://docs.expo.dev/workflow/customizing/#developing-apps-with-custom-native-code
I followed all of the steps in starting guide for expo-dev-client. https://docs.expo.dev/clients/getting-started/
But when I start my app using "expo start --dev-client" and run on android, a white screen is shown for a second and then I'm redirected to expo go application page.
in console, the following 2 lines are written:
› Opening on Android...
› Opening com.droppgroup.masterclean://expo-development-client/?url=http%3A%2F%2F127.0.0.1%3A8081 on LDN_L21
I tried this on real device and 2 other emulators but I got the same result. I reinstalled expo go application and it still doesn't work.
Any suggestions on what I can do to make this work?
The issue may be a problem with Expo config plugins, which configure native code for an Expo project, by configuring Info.plist for example. I am currently experiencing a similar issue, though after scanning the QR code, I am directed to a black screen in my Expo Dev Client which crashes and takes me back to the home page. The Dev Client worked perfected until I ran expo add react-native-bluetooth-classic, since I am trying to access iOS bluetooth APIs. I am currently working on this issue, but I just wanted to point you in the direction of config plugins since the examples Expo gives for customizing your runtime have config plugins registred in the "plugins" property of app.json.
It may be necessary to create your own plugin, though I am unsure.
Please let me know if you come up with any fixes, and so will I.

developer tools does not loads resources

When I run my ionic project to my mobile it was working good, and when I open developer tools it's fine.
I could able to view all console statement in my developer tool window, now when I run it again app runs well in the browser and in my mobile , I am not able to see any console statement.
What I get is
device ready has not fired after 5 seconds.
cordova.js:1223
Failed to load resource
file:///android_asset/www/build/index.js.map
could someone help me to view my console statements
This should be fixed in cordova-android 6.1.0. It has not been added to the npm-registry yet, so you can use it by placing this to your config.xml:
<engine name="android" spec="https://github.com/apache/cordova-android.git#6.1.0"/>

Ionic app startup time

Just getting into this ionic framework. build an simple app with just a tab and menu, deploy to android phone. it seems like it takes a good 3 seconds to load. the black screen last for 3 seconds then the app shows. I also try the ionicview app from ionic. similar experience. my question is, is it just something I missed or it's just one of the draw back of this kind of hybrid app? it make sense that the webview need to load and parse the js and html then render the UI.
Crosswalk provides a bundled Chrome Webview with the app, resulting in better performance and predictability. It helps a lot on older Androids and also speeds up the newer phones.

How to Debug Ionic WebApp?

I want to debug my ionic application in WebStorm.
I am able to run the app in browser. But how can I debug?
I tried: ionic serve --debug which doesn't seem to trigger any debugging?
How can I debug the app when it runs in browser?
With Chrome you can type chrome://inspect into your address bar
As soon as you are running your Android app, you can inspect the app when you are running it with the "ionic run android" or "ionic emulate android" command
The version of Android, however, must be higher than 4.3 I think...
According to the documentation there's a few different way's to do this. Also could you try one of these listed below since you have tried ionic serve already?
ionic run
ionic emulate
The run or emulate command will deploy the app to the specified platform devices/emulators. You can also run live reload on the specified platform device by adding the --livereload option. The live reload functionality is similar to ionic serve, but instead of developing and debugging an app using a standard browser, the compiled hybrid app itself is watching for any changes to its files and reloading the app when needed. This reduces the requirement to constantly rebuild the app for small changes.
Hope this get's you going! Let me know how it work's out for you.
I found this tool very useful, you can attach your device and get a real time inspector on your Cordova app(for iOS and Android platforms).
The browser is where I do most of my debugging for ionic. What browser are you using to do the debugging? I use Chrome and turn on DevTools. There is a source tab where you can browse your app code to find spots for breakpoints. For example, you can set a breakpoint in the code for a controller on a click event and step through the code. Then, you can use the console to execute commands to test values and inspect objects, etc. Are you unable to make this work? Or, unfamiliar w/ the DevTools? If unfamiliar, there is a resource available here. If not working, are the breakpoints not being hit?
There are a few ways to debug your ionic app.
In the browser you can catch the errors in the console.
If you are emulating your app on a simulator or a mobile device you can install the cardova plugin that displays js errors in the xcode console. So you can emulate your device and catch errors on xcode.
Here is how you add the plugin:
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git
An alternative is using ionicLab. It worked for me doing the steps: Install the program and prepare all the project dependencies prior to testing. Then, click on Serve option from Testing which is under Platform menu. When the project has been executed, click on the arrow icon of the Preview bar.
As a result, Ionic will throw a Chrome window with the loaded project, so, you can use Developer Tools as it's used commonly. You ought to watch the javascript files, which you use in your project, so that you can debug them.
Simply run: ionic serve -l and inspect from browser developer options.

Chartboost sample app not showing Ads

I am trying to integrate a tool Chartboost into our game.
We are using following tools for development.
Xcode 5.0.2.
Latest ChartBoost Library.
Deployment target being iOS 6.1.
Base SDK being iOS 7.0.
Game Engine Cocos2d-x ( C++ ).
In order to use ChartBoost I followed these steps.
Created an account at Chartboost.
Added an app
Platform: iOS
Nick Name: Added
-Test Mode: Enabled
and Its showing the App Id and App signature.
Added a Campaign.
-Its On.
-CampaignStart and End are blank, so it will be effective as soon as possible.
-Filter By Bundle verion is Min 1.0 and Max blank .(already tried by keeping both blank.)
-Selected the App I added ,as the app where this campaign will run.
-Campaign Logic: Added test device with UUID.
-Rest of the options are untouched.
For test purpose I downloaded and used the sample iOS project provided at ChartBoost site. I replaced the App Id and App signature with my App's ID and Signature.On running the app, it does not display any ads. It logs messages like :
-failure to load interstitial at location Default
-failure to load interstitial at location Pause screen
-failure to load more apps
-failure to load interstitial at location After level 1
I am not able to conclude what wrong I have done! Please help on this issue.
PS:
1. I have already received a mail from ChartBoost mentioning I have successfully integrated the SDK, and in front of added app , the SDK and Frame icons are lit(green), which essentially shows , I have integrated the SDK correctly.
2.Our game is still under development and as we are using the Cocos2d-x which is c++ Game engine ,so we will be using some wrapper to call the ChartBoost library. Once we get the idea how it works on native platform.
In Chartboost sometimes it happens that you have set in the Chartboost dashboard that your game is in "Landscape" mode for example.
While your game is actually running in portrait mode.
In such cases you will get these errors.
Make both these same. Either change in the Chartboost dashboard for your app or change in the game's project file :)