Calabash - My device won't rotate - android

I'm discovering Calabash, using it with cucumber and I'm having an issue.
I started some code to test my basic app :
Scenario: I can see a button Test Button
When I enter "Something" into input field number 1
Then I wait
Then I press the "Test Button" button
Then I wait
Then I should see text containing "Something"
Then I go back
Then I rotate landscape
Then I wait for 5 seconds
Everything works fine and everything is passed until I arrive on the device rotation step. It just doesn't work (doesn't rotate) and is treated as an "undefined" instead of passed and the very last line gets "skipped"
The test ends like this.
I checked everywhere and just can't figure out why it doesn't work.
Could anyone help me please ?

As mentioned in comment - disable rotation lock.

Related

Understanding results of Android Espresso instrumentation test

I've created a simple test using Espresso in Android Studio.
The test runs to completion and gives a success message.
However, I'm testing to see if two Button views are visible or not.
I expect to see that one button is visible and the other is not
The test result does not mention this at all. The goal of this test is to run it via Firebase Test Lab on various virtual and real devices and read the results of the test!
Here is the simple test on Android Studio:
#RunWith(AndroidJUnit4.class)
#LargeTest
public class MyGraphingTest {
#Rule
public ActivityScenarioRule<MainActivity> activityRule
= new ActivityScenarioRule<>(MainActivity.class);
#Test
public void MyTestMethod(){
//some test instructions that will lead me to where the two Button views are...
//more test instructions that will hide one Button view from screen, while the other Button view remains visible.
onView(withId(R.id.recenter)).check(matches(isDisplayed()));
onView(withId(R.id.buttonGraph2)).check(matches(isDisplayed()));
}
}
see the attached picture to see the test results!
All checks "returned" true, so your test is passed. Otherwise, test will fall and you will see the reason of the failure. If you want to see additional information about your checks, you should add some logs mannualy.
However, I'm testing to see if two Button views are visible or not. I expect to see that one button is visible and the other is not
Your test, as you posted it, is looking for both views to be displayed. Keep in mind that visible means View.VISIBILITY == VISIBLE. Displayed means you could actually see it in the current screen. Thus a visible view may not actually be displayed if it's off screen or has a zero width or height.
If you actually want to test visibility, you should use withEffectiveVisibility instead of isDisplayed.
The test result does not mention this at all.
You're testing that both views are displayed and the test passes. What do you expect the test to "mention"? Since your test passed, all the assumptions that are in the test held true and the test result has nothing more to tell you.

Missions timeline not working after loading while takeoff

I am having an issue where i execute the startTakeOff() method, and the callback of this method is returned before (0.5 meters) the drone got to the height he suppose to (1.2 meters) - this part is documented (startTakeoff()) - which is a bit weird. After the callback is returned i am loading the actions to the timeline (getting a success callback), and then firing the startTimeline() method, i've also registered a listener that prints all timeline's event status, and what i see is that the timeline started, then the GoToAction (first in the timeline) is started but the drone doing nothing, doesn't move or do anything.
If i clean the timeline, reload the actions, and fire startTimeline() again (w/o calling to stopTimeline()) it works as it suppose to.
My question is - is there a 'clean' way to delay takeOff's callback? Or make the timeline run w/o reloading it? By 'clean' i mean that i can set a custom timeout that will load and start the timeline, but it is not the best practice...
No the OSDK fires the callback as it leaves the ground, your only option is to observe and wait for it to reach 1.2m.
OSDK only provide you with some sample. It is not 100% sure of working. You should think and get a solution to your problem.
In your case, the delay they put is without any guarantee. you need accurate feedback to make it sable
You can use a system such as SVO to achieve this. https://github.com/uzh-rpg/rpg_svo
SVO gives you feedback of ur current drone status. So instead of using delay
start take off
while uav not at 1.2 meter -> (take off running) do nothing
while uav airbone -> do the thing you want
Additionally you can put timeout in, in case overloads and drone cant take off successfully.
I saw people getting SVO / PTAM / Vinsmono working on android phone before. So i think you could do the same.

Not able to click on an element in Appium

My UI Automator Viewer Screenshot
I want to click on Play Now button and tried the following code:
driver.findElement(By.xpath("//android.view.View[contains(#content-desc,'Play Now')]"));
and this code:
driver.findElement(By.name("Play Now!"));
These codes are not showing any error but not clicking on Play Now button even.
Please help.
try this one
driver.findElementByAccessibilityId("content written on the button").click();
If you feel your Xpath is right but you are not click on that means that is because of synchronization problem. Just give time to find the element and click. Try like below example
Thread.sleep(5000);
driver.findElement(By.xpath("//android.view.View[contains(#content-desc,'Play Now')]")).click();
Thread.sleep(5000) gives 5 second time to search for the element. This should work in your case.
if click works fine not need to use any waits.
You can further use implicit or explicit wait once you are perfect with your automation.

Problems with Listpicker App Inventor

I'm a beginner at App Inventor and I don't know what I'm doing wrong with the listpicker.
I am trying to create and app to reproduce the music I have stored in my server but when i display the listpicker I can't click any of the options and also I can't go back to the first screen. Here I put my code:
Image 1
Image 2
I tried to remove the line that says call listpicker.open but it only made appear a totally black screen.
The result of the code I just posted is exactly what I spect a list with the name and the link of the 2 songs I already upload to my server but when I click them it didn't do anything.
Thanks for your help.
The Web component works asynchronously, which means, it takes a little bit, until the result is available. The result you will get in the Web.GotText event.
Therefore it does not make sense to call the updateListpicker procedure in the Listpicker.BeforePicking event, because the result still is not available and you get displayed an empty listpicker. The listpicker will be opened, before you have received the result!
Set the listpicker to visible=false and use a button.click event to call the updateListpicker procedure. Then as you already do it in the Web.GotText event, assign the received list to the listpicker and open it.

What is called a jump tap in Android documentation?

I was looking through ViewConfiguration class documentation and I found getJumpTapTimeout() method. Description says it is used to determine whether user wants to perform a "jump" tap or a regular one. The user has to complete jump tap within this time or it will be a regular one. The question is what is this jump tap anyway?
I've looked through the source, but it doesn't give any clues. Jump tap timeout is 500 ms, so is the long press timeout. So if I keep my finger for more than 500 ms on the same spot without moving, this is a long press, and it's not a tap. Tap timeout is 115 ms, so I have to at least not move my finger for this time or this won't be a tap. But then I have to do something until my 500 ms expire. Only what exactly?
It is same as tap applied to active page elements, but used in earlier versions of webview, now this parameter is simply redefined inside webview as tap_timeout, now it sess to be used only for dpads
// This should be ViewConfiguration.getTapTimeout()
// But system time out is 100ms, which is too short for the browser.
// In the browser, if it switches out of tap too soon, jump tap won't work.
// In addition, a double tap on a trackpad will always have a duration of
// 300ms, so this value must be at least that (otherwise we will timeout the
// first tap and convert it to a long press).
I have seen its usage in one of Google's open source project Eyes-Free Android Applications more specifically inside ProcessorFocusAndSingleTap.java Inside performClick(AccessibilityNodeInfoCompat node)
For clarity I am mentioning here what It was used for
If a user quickly touch explores a content i.e, (event stream < ViewConfiguration.getTapTimeout()), then to avoid sending an unintentional ACTION_CLICK they have Switched off clicking on content.
Basically , It's The timeout after which an event is no longer considered a tap
you jump from one app to the other. Jump will tell your phone that you jumped and will no longer keep the previous app on.

Categories

Resources