Tap action has na effect on emulator but giving timeout issue- Detox - detox

In my test, when I click on a button to navigate to the next page, But the test timeouts saying it did not receive any response to the tap action.
Environment:
"babel-eslint": "^10.0.3",
"babel-jest": " 24.9.0,"
"detox": "^17.14.9",
React Native:"0.62.2",
Node: v12.21.0.
Device: Pixel_2_API_28 emulator
OS: Android
I have tested this issue on the latest Detox release and it still reproduces.

Related

The android device show "App isn't installed" after upgrade React Native 0.70.5

I upgraded my react-native project from 0.69.6 to 0.70.5
I run "npx react-native run-android" on my android device. It show "App isn't installed" when I click the app. If I go to device settings -> my app -> click "OPEN" button, then the app can run successfully. I can see the loading in bundle.
I have added applicationIdSuffix on android/app/build.grade. This setup always used.
buildTypes {
debug: {
applicationIdSuffix ".dev"
}
}
My AndroidManifest package is "com.companyname.xxxx.android"
May I know how to solve this issue? Thank you everyone.

React Native E2E w/ Detox error: "Failed to run application on the device"

I have a starter app created with React Native CLI on a Mac, added Detox and am trying to run the sample tests. I get this error (newlines added for easier reading):
$ ./node_modules/.bin/detox -c android test
detox[37289] INFO: [test.js] configuration="android" reportSpecs=true readOnlyEmu=false
useCustomLogger=true forceAdbInstall=false DETOX_START_TIMESTAMP=1591313397594
node_modules/.bin/jest --config e2e/config.json '--testNamePattern=^((?!:ios:).)*$' --
maxWorkers 1 android test
detox[37290] INFO: [DetoxServer.js] server listening on localhost:62332...
detox[37290] ERROR: [DetoxExportWrapper.js/DETOX_INIT_ERROR]
DetoxRuntimeError: Failed to run application on the device
HINT: Most likely, your tests have timed out and called detox.cleanup() while it was
waiting for "ready" message (over WebSocket) from the instrumentation process.
When it runs, the emulator starts but the app does not.
The app runs fine separate from E2E tests, through React Native CLI.
.detoxrc.json
{
"testRunner": "jest",
"runnerConfig": "e2e/config.json",
"configurations": {
"android": {
"type": "android.emulator",
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
"build": "cd android; ./gradlew assembleDebug assembleAndroidTest -DtestBiuldType=debug; cd -",
"device": {
"avdName": "Pixel_3"
}
}
}
}
Environment:
Detox: 16.7.0
React Native: 0.62.2
Node: v12.17.0
Device: Pixel 3, x86, API 29, Android 10
OS: MacOS 10.15.4
Test-runner: Jest
Android Studio: 3.6.3
My bad. I missed a few steps on the second page of getting started instructions specific to Android.
https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md

Error saying "Unable to load script. Make sure you're either running a Metro server..."

"Unable to load script. Make sure you're either running a Metro server (run 'react-native-start') or that your bundle 'index.android.bundle' is packaged correctly for release."
I am moving my code from Expo CLI to React Native CLI. I am just moving over my assets, components, and js files over and I am adding all the packages to RN CLI as well.
I have been stuck on this for about 10 hrs now and searched up every single error that popped up. I am now finally going through stack overflow now.
error http://prntscr.com/p0vp49
I have tried running react-native-start and npm start. I dont know how to go to my bundle 'index.android.bundle' so that might be the problem.
import { createAppContainer, createSwitchNavigator } from "react-navigation";
import LogInNavigator from './screens/LogInScreen.js';
import AppNavigator from './screens/MainScreen.js';
//Exporting Navigator
export default createAppContainer(
createSwitchNavigator(
{
loginNav: LogInNavigator,
mainNav: AppNavigator,
},
{
initialRouteName: "loginNav",
}
)
);`
I expect a login screen at least.
Have you installed all the dependencies correctly?
My Dev dependencies are:
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"babel-jest": "^24.8.0",
"babel-plugin-module-resolver": "^3.2.0",
"jest": "^24.8.0",
"metro-react-native-babel-preset": "0.53.0",
"react-test-renderer": "16.6.3"
Make sure you add metro-react-native-babel-preset and do npm start

New react-native project won't load on iOS or android

On Mac OS X 10.14
Creating a new project with:
react-native init project
It builds the new project with the following list: https://pastebin.com/ED8qd0Ee
I run npm install to update anything.
Then I run react-native run-android The project builds and sends to device but I get an error there and the MetroBundler opens but all I get is Process terminated. Press to close the window.
Im not sure what the issue is? I had no problem running a test app a week ago. I get back to it today and this.
On iOS, the app never builds on the device. The metro bundler again terminates immediately and the process reads off an infinite list of errors
react-native init project this command create the project with latest versions so try to create project with previous versions like this react-native init newproject --version react-native#0.54.4
you can choose any version here is mine
"react": "16.6.3",
"react-native": "^0.57.8",
"devDependencies": {
"#babel/runtime": "^7.0.0",
"redux-devtools-extension": "^2.13.5",
"schedule": "^0.4.0",
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.51.0",
"react-test-renderer": "16.6.3"
},
"jest": {
"preset": "react-native"
}
also check this code in .babelrc file
{
"presets": [
"module:metro-react-native-babel-preset"
]
}
Run this command in your project rm -r node_modules it will delete node_modules folder in your project and change your package.json file and Run Command npm install.

Unable to establish a connection with the SafariDriver extension

I have been running e2e tests in an AngularJS web-app using protractor, testing on Chrome and Firefox. When adding safari to my array, the following is displayed:
"Unable to establish a connection with the SafariDriver extension"
I have found a way to solve this locally but as we are using Codeship to automate our builds, I need a way to solve it rather than having to manually add the driver to selenium and enable in Safari.
I am using selenium 2.43.1
config:
exports.config = {
baseUrl: 'http://localhost:9001',
multiCapabilities: [{
'browserName': 'chrome'
}, {
'browserName': 'firefox'
}, {
'browserName': 'safari'
}],
specs: ['e2e/app.js']
};
package.json:
{
"name": "livingthevalues",
"version": "0.0.0",
"dependencies": {
"express": "^4.9.7",
"gzippo": "^0.2.0",
"bower": "^1.3.8",
"grunt": "^0.4.5",
"grunt-cli": "^0.1.13",
"grunt-autoprefixer": "^0.7.3",
"grunt-concurrent": "^0.5.0",
"grunt-contrib-clean": "^0.5.0",
"grunt-contrib-compass": "^0.7.2",
"grunt-contrib-concat": "^0.4.0",
"grunt-contrib-connect": "^0.7.1",
"grunt-contrib-copy": "^0.5.0",
"grunt-contrib-cssmin": "^0.9.0",
"grunt-contrib-htmlmin": "^0.3.0",
"grunt-contrib-imagemin": "^0.8.1",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-uglify": "^0.4.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-filerev": "^0.2.1",
"grunt-google-cdn": "^0.4.0",
"grunt-newer": "^0.7.0",
"grunt-ng-annotate": "^0.3.0",
"grunt-svgmin": "^0.4.0",
"grunt-usemin": "^2.1.1",
"grunt-wiredep": "^1.7.0",
"jshint-stylish": "^0.2.0",
"load-grunt-tasks": "^0.4.0",
"time-grunt": "^0.3.1"
},
"devDependencies": {
"chai": "^1.9.2",
"chai-as-promised": "^4.1.1",
"cucumber": "^0.4.4",
"grunt-karma": "^0.9.0",
"grunt-protractor-runner": "^1.1.4",
"karma": "^0.12.17",
"karma-chrome-launcher": "^0.1.4",
"karma-jasmine": "^0.1.5",
"karma-junit-reporter": "^0.2.2",
"karma-mocha": "^0.1.6",
"karma-phantomjs-launcher": "^0.1.4",
"protractor": "^1.3.1",
"protractor-cucumber": "^0.1.2",
"sinon": "^1.11.0"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "grunt test",
"pree2e": "./node_modules/protractor/bin/webdriver-manager update",
"e2e": "grunt test:e2e"
}
}
commands run by ci:
Exporting Environment
0 min 2 sec
git clone --branch 'commentBox' --depth 50 git#github.com:MyTeam/myrepo.git ~/src/github.com/MyTeam/myrepo
0 min 1 sec
cd clone
0 min 1 sec
git checkout -qf 2ec65e3b32971d0f7f9de948c40f019f0629adea
0 min 1 sec
Preparing Dependency Cache
0 min 10 sec
Preparing Virtual Machine
0 min 5 sec
rvm use 2.0.0-p195
0 min 5 sec
bundle install
0 min 2 sec
nvm install 0.10.25
0 min 2 sec
nvm use 0.10.25
0 min 1 sec
npm install
0 min 7 sec
bower instal
0 min 7 sec
npm test
0 min 10 sec
npm run e2e
Thanks - seems like such a simple thing to do but can't understand why it isn't working.
On Mac, The Selenium SafariDriver extension you used to have to install is now depreciated. On El Capitan & Sierra Apple provides it's own Safaridriver. Uninstall previous safaridriver extension (if you had installed it) and enable the new safaridriver, excerpt from link 2:
Ensure that the Develop menu is available. It can be turned on by opening Safari preferences (Safari > Preferences in the menu bar), going to the Advanced tab, and ensuring that the Show Develop menu in menu bar checkbox is checked.
Enable Remote Automation in the Develop menu. This is toggled via
Develop > Allow Remote Automation in the menu bar.
Authorize safaridriver to launch the webdriverd service which hosts
the local web server. To permit this, run /usr/bin/safaridriver once
manually and complete the authentication prompt. e.g. in terminal: /usr/bin/safaridriver -p 8000
Also, You need to be running Selenium 3.0 + (support started at 3.0.0-beta1) to use the new safari driver.
Note:
If you still have trouble maybe check the Addendum at bottom of the 2nd link. Another caveats I ran into, the new safaridriver only supports one session so maxSessions=# is no longer supported. Also, if you use npm selenium-standalone install you can update selenium version like so.
selenium-standalone install --version=3.0.1 --baseURL=https://selenium-release.storage.googleapis.com
And then boot hubs and nodes with the --version=3.0.1 flag.
I'm wrestling with this exact issue trying to automate our tests against Safari 7.1. My research so far leads me to believe that with Safari 7.1, a new security model was put into place to make extensions more secure. Here is a related thread fwiw. I have tried using the mvn command line to install the SafariDriver extension but it fails to do so. I've tried running a simple command line to open Safari with the extension as a parameter but then you are prompted to enable/install it. (no good for unattended flows). Another hack that was suggested was to go directly to the plist file that Safari uses for preferences/extensions but I could not find it on Mac 10.10. I'm quite anxious to know the answer here.
I'm using Windows 7.
Prerequisite: Install Safari on Windows
Go to http://docs.seleniumhq.org/download/
Scroll down -> Go to the section "SafariDriver" and download "SafariDriver.safariextz"
Double click on "SafariDriver.safariextz" (previously downloaded)
Safari would open with a pop up containing "Install" button -> Click Install button
Now go to Preferences of Safari and you would see WebDriver (in my case WebDriver 2.48.0) is installed (Enable WebDriver checkbox is checked))
It's now time to instantiate SafariDriver and get the desired URL as below:
WebDriver driver = new SafariDriver();
driver.get("https://www.packtpub.com/web-development/mastering-selenium-testing-tools-video");