Is there a way to specify a directory to drop a .app file after building? - selenium

I am currently testing ios application, however I have to run yarn ios -b appName and let it build and install to my simulator. I have realised that it builds to the below directory /Library/Developer/Xcode/DerivedData/myApp-aohnjxogkpanghbjzgjqryytqzqh/Build/Products/Release-iphonesimulator/myApp.app.
I would like to be able to specify the build output directory. So that I can be able to run it on every new release dynamically.
Please assist in two things
How to specify build directory when running yarn ios -b appName
How to clean the directory dynamically before dropping the new file.

Related

How can I change the project and app name of ReactNative project with react-native 0.60

It's simple issue but I don't know how to do it. I'm looking for some references, but there are problems.
I'm using react-native : 0.60.5. Hence there is no eject method or command.
The project was not created with expo.
After I referenced How to Rename A React Native App and error Unrecognized command "eject", then I follow the process below.
change the app.json's name and diplayName field to name which I want to change
remove android/ and ios/ directory
use react-native upgrade --legacy true
But there is no change on the project name and app name.
Is there any way to change the project and app name? Thanks.
Please check the below steps :
if you want to change both the app name and the package name (i.e. rename the entire app), the following steps are necessary:
Make sure you don't have anything precious (non-generated, manually
copied resources) in the android/ and ios/ subfolders.
Delete both the android/ and ios/ folder.
Change the "name" entry in your package.json to the new name.
Change the app name in both your index.android.js and index.ios.js:
AppRegistry.registerComponent('NewAppName', () => App);
Run react-native upgrade to re-generate the platform subfolders.
If you have linked resources (like custom fonts etc.) run
react-native link.
If you have other generated resources (like app icons) run the
scripts to generate them (e.g. yo).
Finally, uninstall the old app on each device and run the new one.
Hope it helps. feel free for doubts
for android edit strings.xml file which located in res/values/
string name="app_name">APP_NAME</string
I had a very hard time with this and this is what I did - hopefully it helps someone. Literally took me 15 minutes
https://www.npmjs.com/package/react-native-rename install react-native-rename and rename your app to whatever you need using the instructions provided for the package
Important part would be to use this:
npx react-native-rename "YourProjectName" -b com.yourporjectnamehere - because this is needed for android to work correctly
find in your project every file and folder name that will contain your previous name - for me it was mostly in ios folder. I had to rename all the folders and some of the files inside. just replace the part with your previous name with your current name
find all occurrences of your previous name left inside the project with the whole project search in your editor and replace them with the new name.
To make it work for ios
Delete Pods inside the ios folder
Delete node_modules
go to ios folder with your terminal and do pod install
do npm install in your original directory again
make sure all the caches are deleted for your ios simulator with yarn start --reset-cache
To make it work for android
Make sure that under android/app/src/com/yourprojectnamehere/ the folder contains MainApplication.java and MainActivity.java files and that the project name inside are updated
./gradlew clean inside android folder in terminal
Delete node_modules
npm install
react-native run-android and everything should be working
I know its a lot of steps, but from what I have found renaming react native app is not actually as easy as you might have thought

Can I Copy Over React Native Files Initialized Under One Project Over To Another Separately Initialized Project?

Let's say I initialize a project under react-native init <filename>, installed a bunch of node packages, and added code.
Then separately I initialize a different project under react-viro init <filename>, installed a bunch of node packages, and added code.
If I wanted to combine what I created under react-native init into what I created under react-viro init, is it as simple as copying files over and reinstalling missing node packages into the react-viro project?
Assuming you are working in the ./src folder, every file is independent of iOS or Android as part of the JavaScript bundle.
You can simply copy the .js files over and install the node packages in that project.
You probably should not copy any files that are outside the ./src folder, but I also suspect you wouldn't need to. Files in the Android and iOS folders are rarely touched as they contain operating system config settings and custom modules that you would have wrote in the native languages.
If the file renders JSX, you will be safe to just copy it over and hook it back up.
To state it another way, go into the folder that has node_modules in it. You shouldn't copy anything that is in that folder except additional files that you created. This is where people normally create an src folder and place all their JavaScript. You probably have an index file in there that points to ./src/app.js or you may have an index.ios.js and index.android.js that both point to a ./src/app.js. Anything inside src is safe.
That's my best answer without seeing your folders and files.
If you intend to copy code from one react native project to another, make sure the code you intend to copy is JS and not any native files. Make sure you do register the correct component using AppRegistry. Rest assured you can copy the code from one project to another.
Assuming you have a project at folder
/my-project/android
/my-project/ios
/my-project/src
Copy my-project and paste it at your desired folder like
/new-my-project
Change git origin
git remote set-url origin https://gitlab.com/..../**.git
Open /new-my-project/android in Android Studio, and then rename app/java/com.myproject to com.newmyproject
Go to app/build.grade and change com.myproject to com.newmyproject and sync
Create firebase project and download google-services.json file and add to new-my-project/android/app
Build application, then test application under metro bundler
npx react-native start
Create keystore, test notifications, change base_url_api, test apk etc Android finish now, iOS
Update pods on new-my-project/ios
pod install && pod update
open myproject.xcworkspace
Change bundle identifier to org.reactjs.native.newmyproject, version to 1.0, build to 1 and desired Display name. Let it index completely
Setup in firbase and replace GoogleService-Info.Plist file and Clean build folder in xcode
Go to developer.apple.com and create identifiers, APNS certificates, profiles
Download certificates from keychain and upload to firebase
Build the project in simulator/device and test it.
Done

Calabash Android run error: The first parameter must be the path to the apk file

I am trying to run sample calabash-android test. But I am facing the below error.
C:\Ruby23\TMSampleAndroid-master>calabash-android run TestmunkTest_debug.apk --verbose
The first parameter must be the path to the apk file.
Consider the following:
Separate the project directory from your Ruby23 installation by moving the calabash project inside a Workspace folder for example.
Create a folder to hold your .apk inside the calabash project, for example "APKFile"
In the run command specify the full path to the .apk file and see if it runs, like this:
calabash-android run
C:\Ruby23\TMSampleAndroid-master\TestmunkTest_debug.apk
or for my example:
calabash-android run
C:\Workspace\TMSampleAndroid-master\TestmunkTest_debug.apk
To add logging write "--verbose" after the command. The error that you get might be because of the typo "--v erbose"

load local files outside NWJS app

When I work locally I want to share code among two or more (nwjs and other kinds of) projects. Folder structure:
-project 1
-project 2
-shared code
When releasing the apps I build the external files into a file inside each project app.
But I cannot access files outside the node-webkit/nwjs app folder.
I tried things like:
Setting "chromium-args": "--allow-file-access-from-files" in the manifest file but I think this is default now.
Using file:/// and chromium-extension:/// prepending the relative paths but I think this is only for absolute paths?
Load files dynamically and using path.relative( process.cwd(), "../shared_code/scripts/controllers/searchController.js" );
The user of the app will be able to put it anywhere on his computer.
Is it possible to load js and css files and images from outside the nwjs project folder locally?
nwjs sdk version 0.19.5
I had a similar problem trying to load images outside of the NW.js application. I found that this fixed my issues. Try adding this to your JSON manifest file. This worked for me...
"chromium-args": "--allow-file-access-from-files --allow-file-access --user-data-dir"
Just so you know, I had originally tried this...
"chromium-args": "--allow-file-access-from-files --allow-file-access --user-data-dir --mixed-context"
But it stopped jquery loading.
You can then access files with file:/// and use absolute paths anywhere on the machine.
I hope that helps.
For sharing code, when the code is (or can be) a node module, it's very helpful to be able to npm link it into your project. (It works the same with NW.js apps as for Node.js:)
cd shared-code
npm link
cd ../project-1
npm link shared-code
cd ../project-2
npm link shared-code

SenchaSDKTools-2.0.0-beta3-windows Command not working

I have installed SenchaSDKTools-2.0.0-beta3-windows on my windows Xp 32-bit.
following is the command I am running on command prompt.
C:\Program Files\SenchaSDKTools-2.0.0-beta3>sencha app create MyApp c:\xampp\htdocs\sencha\myapp\
Giving following error
[ERROR] the current workind directory (C:\Program
Files\SenchaSDKTools-2.0.0-beta3>) is not valid SDK directory. Please
'cd' in to a SDK directory before executing this command.
environment variable has been set following way.
Variable name : Path
Value : C:\Program Files\SenchaSDKTools-2.0.0-beta3
can anyone figure out what exactly wrong in this process ?
*****Sencha Touch setup Guide steps(in Window)******
Download Sencha Touch SDK Tool. (http://www.sencha.com/products/touch/download/ -->SDK Tools Beta for Developers). Run .exe file. It will install tool to default path. (i.e. C:\Program Files\SenchaSDKTools-2.0.0-beta3)
Download Sencha Touch SDK. (Download openSource version file licensed under GPL.).
Extract SDK you just download in step 2.
Open Command line terminal (start->Run->type cmd). Change directory path to SDK path as you just extracted in step3.
Verify that Sencha Command is working properly on your machine. So Type Sencha.
E.g. sdkPath>sencha
you will see "Sencha Command v2.0.2" message with other sencha command detail.
Create app in your web directory by typing following.
E.g. sdkpath> sencha app create firstSenchaApp "path/ to/ www"
(If you have tomcat 7 installed in your computer, give path to \apache-tomcat-7.0.30-windows-x86\apache-tomcat-7.0.30\webapps)
Note: There must not be space in directory path name. _(underscore),- (desk) are allowed.
If app is not generated in step 6. There might be an error. There are as follow:
If error message appear is "sencha' is not recognized as an internal or external command, operable program or batch file.”, follow these steps to troubleshoot:
The path to SDK Tools directory is prepended to your system's PATH environment variable.
From the terminal, run
echo $PATH or echo %PATH% .
The SDK Tools directory should be displayed in part of the output. If this is not the case, add it to your PATH manually.
The environment variable SENCHA_SDK_TOOLS_{version} is set, with the value being the absolute path to the installation directory mentioned above.
For example: If the installed version is '2.0.0-beta2', a SENCHA_SDK_TOOLS_2_0_0_BETA2 must be set.
From the terminal, run
echo $SENCHA_SDK_TOOLS_2_0_0_BETA2 or echo %SENCHA_SDK_TOOLS_2_0_0_BETA2% on Windows.
If the output is empty, set the environment variable manually.
Wrong Current Working Directory
A common mistake is not running Sencha Command within either a valid SDK directory or an application directory. If the current directory is not a SDK or application directory, "sencha" command will fallback to backwards-compatible mode. As of SDK Tools release "2.0.0-beta2", you should see a clear warning in such case:
"The current working directory (...) is not a recognized Sencha SDK or application folder. Running in backwards compatible mode." So in this case follow proper step as mentioned above.
Reference:
http://www.sencha.com/forum/showthread.php?192169-Important-SDK-Tools-Sencha-Command-Update
There is an invisible file that you need to copy, called .senchasdk. Make sure it is in the folder.
I think you're having the same problem I had; I had attempted to run 'sencha app create...' from the folder containing sencha.bat. Instead, you need to run 'sencha app create...' from the sencha-touch-2.0.1.1 folder (which contains the .senchasdk file).
See this previous SO question!
Save my days.
By the way, if you can't extract the sencha-cmd to sdk tools, try to extract on other location and copy the folder [3.0.0.250] to your sdk tools > [bin] folder.
hope this helps.