I am running test in android device (Samsung S10+) with ruby 2.5.3 with cucumber 5.1.2 and 'appium_lib', '~>10.6.0'. While running test I see that appium server sent command to mobile device to unlock mobile but after sometime I get unknown server-side error not sure what it is and I couldn't find any help on google, I am able to start the app manually by using below adb command adb shell am start -W -n com.login.mobile.MainActivity -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 but when I run the test it gives error.
Logs
W3C] Encountered internal error running command: Error: Cannot start the 'com.login.mobile' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command '/Users/dk/Library/Android/sdk/platform-tools/adb -P 5037 -s R58MA7HJXZL shell am start -W -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000' exited with code 1'; Stderr: 'Error: Intent matches multiple activities; can't stop: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 }'; Code: '1' [W3C] at ADB.startApp (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/tools/apk-utils.js:177:11)
caps
ef caps
{
caps:{
deviceName: "Galaxy S10+",
platformName: "Android",
#app: "#{Dir.pwd}/features/resources/app/app-release.apk",
appPackage: "com.login.mobile",
appAcitivity: "com.login.mobile.MainActivity",
skipServerInstallation: true,
newCommandTimeout: "60000",
autoacceptalerts: true,
autoGrantPermissions: true,
clearSystemFiles: true
}
}
I see the problem, it is due to typo in appAcitivity correcting typo has fix the issue
Related
Background: I am trying to run Cypress (npx cypress run) on Circle CI. I have used the Cypress Orb, though I recently expanded it to add more troubleshooting information. My set up is quite complex, with 5 containers spun up to provide the testing environment. So, I'm running it all in a Circle CI machine, not docker.
Problem: Cypress tests to see my baseUrl is alive and finds it is not, but I can separately prove it is alive by preceeding with a curl statement. All I can think of is that Cypress is not using the configured baseUrl, but I cannot tell what it is because it is masked, along with other sensitive information. I tried adding the -dev flag to the cypress commands, but still the information is masked.
Here is the relevant section of the "command" in my config.yml:
grep baseUrl cypress.json
echo -n "curl port 3091: "
curl -s -S -i localhost:3091 | grep -q 'HTTP/1.1 200 OK'
if [ $? -ne 0 ]; then
echo "ran into an error"
curl -i localhost:3091
else
echo "OK"
fi
echo "cypress info:"
npx cypress info --dev
echo "run cypress"
set +e
npx cypress run --dev --browser chrome
if [ $? -ne 0 ]; then
npx cypress run --browser chrome &> cypress-run.log
echo "error, here is the cypress output:"
cat cypress-run.log
exit 1
fi
and here is the output from that code, executing on Circle CI:
baseUrl: "baseUrl": "http://localhost:3091",
curl port 3091: OK
cypress info:
Proxy Settings: none detected
Environment Variables:
CYPRESS_testPassword: ********************
CYPRESS_baseUrl: *********************
CYPRESS_CACHE_FOLDER: ~/.cache/Cypress
CYPRESS_testUsername: *******************************************
CYPRESS_RECORD_KEY: <redacted>
Application Data: /home/circleci/.config/cypress/cy/development
Browser Profiles: /home/circleci/.config/cypress/cy/development/browsers
Binary Caches: /home/circleci/.cache/Cypress
Cypress Version: 6.8.0
System Platform: linux (Ubuntu - 20.04)
System Memory: 33.7 GB free 11.3 GB
run cypress
error, here is the cypress output:
Cypress could not verify that this server is running:
> *********************
We are verifying this server because it has been configured as your `baseUrl`.
Cypress automatically waits until your server is accessible before running tests.
We will try connecting to it 3 more times...
We will try connecting to it 2 more times...
We will try connecting to it 1 more time...
Cypress failed to verify that your server is running.
Please start this server and then run Cypress again.
Exited with code exit status 1
Is there any way to unmask the output from Cypress? I've searched the Cypress documentation and done web searches and came up short.
Ok, lightbulb turned on so I can answer my own question.
Cypress was not masking the output, Circle CI was doing that. This is the clue for #2.
Circle CI was set up (not by me) to define the CYPRESS_baseUrl environment variable. It's value was used by Cypress to override the setting in the cypress.json file. And, the value in the environment variable was not correct!
Once I removed the environment variable, it started working.
I'm trying to test ntp settings.
I've provisioned a VM with ntp services installed.
I'm able to login onto the vm and run a command that verifies ntp is indeed installed and restricts queries:
vagrant#vagrant:~> sudo ntpq -p
localhost: timed out, nothing received
***Request timed out
However, when I try to test this exact command in a test, it returns empty...
I'm obviously missing something crucial here, but I cant figure out what.
Here is my test:
control 'ntp configuration' do
describe command('sudo nptq -p') do
its('stdout') { should match('localhost: timed out, nothing received') }
end
end
And the error:
× ntp configuration: Command: `sudo nptq -p`
× Command: `sudo nptq -p` stdout is expected to match "localhost: timed out, nothing received"
expected "" to match "localhost: timed out, nothing received"
I've tried stdout and stderr, both to no avail.
One thing that I do notice however, is that running this command from the commandline on the vm itself, takes a few seconds to return the message.
The test however, returns in noticeable less time with an empty string.
Could anyone please shed some light on this? :)
Error lies in:
control 'ntp configuration' do
describe command('sudo nptq -p') do
its('stdout') { should match('localhost: timed out, nothing received') }
end
end
Typo in the command -> nptq has to be ntpq, also sudo can be omitted.
The message that was being checked for was actually returned in stderr instead of stdout
Working code:
describe command 'ntpq -p' do
its('stderr') { should match(/localhost: timed out, nothing received/) }
end
I have a simple bash script to execute at postStart, but i get an error which is not informative at all:
Exec lifecycle hook ([/bin/bash -c sleep 30;/xcom/scripts/sidecar_postStart.sh]) for Container "perfcibuddy" in Pod "xcomapp-597fb859c5-6r4g2_ns(412852d1-5eea-11ea-b641-0a31ddb9a71e)" failed - error: command '/bin/bash -c sleep 120;/xcom/scripts/sidecar_postStart.sh' exited with 7: , message: ""
The sleep is there because I got a tip that there might be a race condition, that the script is not in place at the time Kubernetes calls it.
And if I log into the container I can execute the script from the shell without any problem.
The script is just doing a simple curl call (IP obviously sanitized):
# ----------------------------------------------------------------------------
# Script to perform postStart lifecycle hook triggered actions in container
# ----------------------------------------------------------------------------
# -------------------------------------------[ get token from Kiam server ]---
role_name=$( curl -s http://1.1.1.1/latest/meta-data/iam/security-credentials/ )
curl -s http://1.1.1.1/latest/meta-data/iam/security-credentials/${role_name}
I tried numerous form to set the command in the template (everything in quotes, with && instead of ;), this is the current one:
exec:
command: [/bin/bash, -c, "sleep 120;/xcom/scripts/sidecar_postStart.sh"]
What could be the problem here?
Curl exit code 7 is generally “unable to connect” so your IP is probably wrong or the kiam agent is not set up correctly.
I wrote a site diagnostic script and have been testing it using iTerm2 on MacOS. A good portion of people that may consume this script use Windows and Git Bash (it's probably 50|50 Windows vs Mac OS): so not supporting Windows might not be an option.
I had someone here test out the script on their Windows PC and it immediately failed. Would anyone know why this function would succeed on Mac and fail on Windows?
_ping_test(){
# Define Error Codes & Messages Below:
local _success="0"
local _success_message="${_green}SUCCESS:${_reset_color} Ping Test Passed"
local _unknown_host="68"
local _unknown_host_message="${_red}ERROR:${_reset_color} Ping Test Failed on ${_url} - Unknown Host"
local _unrecognized_code="${_red}ERROR:${_reset_color} Ping Test Failed - Unrecognized Status Code${_ping_test} "
local _url="${1}.testdomain.net"
local _ping_url=$(ping -c 1 -q $_url &> /dev/null; echo $?)
if [ "${_ping_url}" == "${_success}" ] ; then
echo $_success_message
elif [ "${_ping_url}" == "${_unknown_host}" ] ; then
echo $_unknown_host_message
exit 1
elif true ; then
echo $_unrecognized_code
exit 1
fi
}
Running it returns the Unrecognized Code response on his computer, but given the same site is successful on my Mac.
I echo'd back $_url, and that returns the correct site. I also tried removing the &> /dev/null portion to hear back what the issue was, but it returned that it didn't recognize the command ping
Then I just ran the ping command directly in his Git Bash window, and that worked outside of the shell script.
I realize the ping test portion is a bit silly (it's used to exit the script if they input a bad URL), but the more valuable ssh commands that run later were also failing similarly
I managed to grab a Windows PC and TiL that the parameters you pass to ping follow a different paradigm based on OS:
-c means count on Mac OS
but
-c means compartmentalize on Windows which required admin access
fixed the params and then it worked
I'm tyring to run some build script in MacOS 10.11 but get no information about errors occurred during it's running. Even I try
<hudson.tasks.Shell>
<command>echo "fucking Jenkins!!!"
#!/bin/bash -l
echo "fucking Jenkins!!!"
/bin/sh -e
echo "fucking Jenkins!!!"
./build.sh $BUILD_NUMBER "Jenkins test build"
echo "fucking Jenkins!!!"</command>
</hudson.tasks.Shell>
I get in the console output
git rev-list ...
and then failure or success depending I set -e choice or not. Even echo command writes nothing. But the fact of failure doesn't help at all if there's no more information. No more options I could find over the Web. What is the secret of the execute shell plugin to make it write something to the console output.