Code et cetera

Coding, QA and whatnot.

While testing your app, its common that you want to test it under different locales as part of your automation strategy.

Be it on real devices or emulators this used to be quite simple to do before Android API 29

Simply running this adb command would let you change the locale easily:

adb shell am broadcast -a com.android.intent.action.SET_LOCALE --es com.android.intent.extra.LOCALE en_US com.android.customlocale2

The reason this worked, is because emulators were shipped with the CustomLocale app, which could be sent the previous command and it would set the desired locale for you. But this app is no longer provided and is incompatible with Android versions past 8.

After spending hours looking everywhere, I couldn't find a similar solution, but it seems that Appium manages to change the device locale.

How does Appium do it?

We don't use Appium as part of our automation strategy, we use Calabash, which certainly has fallen behind in features, but we don't want to change the whole infrastructure right now. So the question was, how does Appium achieve this? And can we benefit from it?

They use Appium Settings for this end. This app, like Custom Locale used to do, lets you directly interact with certain system settings, like enabling / disabling wifi, reading received notifications, or changing the device locale.

So then all you need to do is install Appium Settings in the device under test and run these adb commands:

First we enable changing system settings though Appium Settings

adb shell pm grant io.appium.settings android.permission.CHANGE_CONFIGURATION

Then we can change the desired country and language

adb shell am broadcast -a io.appium.settings.locale -n io.appium.settings/.receivers.LocaleSettingReceiver --es lang en --es country US

You can install the app in every test or a more optimal way could be, if you use docker, to perform this when you create your emulator docker images so they already come installed with Appium Settings.

Hope this helps!

#appium #automation #android

So what can I say that hasn't been said about 2020? That it has been a great year so far! Wait, what? Yes, in retrospective and very selfishly it has been a great year to me, for several reasons:

  1. At the beginning of the year my son was born: This changed my life drastically, it still continues to change it; as he grows I have to adapt. But basically it means I sleep less, have less free time and as a reward he gives me his best smiles. It's a fair deal.

  2. A new job, this is the second turning point this year. Corona and my baby pushed me in different ways to look for a change of job. I think it was bold to jump jobs given the situation, but it was definitely worth it. Im very happy about my current position, and specially about having such a great team. I see growth potential here.

  3. I'm re-discovering chess, something I played as a kid and never really got into. Every now and then I tried again but something was missing, it didn't click. Now, actually, after learning a few general principles to guide my play and successfully winning a couple of games, I'm hooked! I'll write what few resources made me get the basics down and enjoy the game much more in another post. But I'm really happy about it.

  4. No one close to me has been sick, and the few I know haven't had serious symptoms, this doesn't mean I don't see the severity of the situation, far from it. But I wouldn't feel the same way if someone close was suffering from it.

So yeah, the year's about to end, and as grim as it seems to be for everyone else, I'm happy, and I would be lying if I said 2020 sucked. And I'm sure, like me, a lot of people has had good things happen to them this year. Let's focus on those things, and forget the rest.

The search button won't work!

I've encountered this problem where you won't be able to proceed with a search while automating some Android apps with Appium, and I've found some solutions that have worked in some cases and others in others. So I'm gonna lay them down here, they may be helpful for anyone finding himself with this problem.

First case, this is the standard solution. Here you simply input the text and send the Enter key:

driver.click(searchField);
driver.sendKeys(textValue);
driver.pressKey(new KeyEvent(AndroidKey.ENTER));

Second case. Here we append a line break at the end of the text we want to search. In most cases this will trigger the search. I find this to be simple and working most of the times:

driver.click(searchField);
driver.sendKeys(textValue + "\n");

Third case. The most rare one, is when the app specifically waits for a special kind of event, the EditorAction

driver.click(searchField);
driver.sendKeys(textValue);
driver.executeScript("mobile:performEditorAction", ImmutableMap.of("action", "search"));

I hope this can be helpful to anyone facing this issue. If I find another way in the future I will add it to the list.

#appium #automation #android

Here's a little useful snippet I found to wait for a node to be present in the selenium grid's console. You can change according to whatever you want it to show uo, of course...

# Wait for a chrome node
while ! (curl -sSL "http://localhost:4444/grid/console" | grep -i chrome) >/dev/null 2>&1; do echo -n "."; sleep 0.2; done

# Wait for a firefox node
while ! (curl -sSL "http://localhost:4444/grid/console" | grep -i firefox) >/dev/null 2>&1; do echo -n "."; sleep 0.2; done

#selenium #automation

If appium can't retrieve the element hierarchy on an iOS app for whatever reason, try one of these methods:

driver.executeScript("mobile: source", ImmutableMap.of("format", "description"));

driver.executeScript("mobile: source", ImmutableMap.of("format", "json"));

On your test code, this will return the source, although it mmight not be as neatly formated as the usual getSource(), sometimes that method doesn't retrieve every element. This can be an useful workaround.

#appium #automation #iOS

For a month and two weeks now, I've been having less and less time to do much beside changing diapers. If I can squeeze a bit of time into my hobbies, I have to split it between learning / coding projects and playing games. So that leaves little time, which I usually put into Monster Hunter Generations Ultimate.

Thankfully I've been following some Youtube channels that let me enjoy some games without playing them myself, useful for when I'm doing chores or what not. If you're bored at home during the current coronavirus quarantine, this might come in handy.

I regard every channel I'm going list list with high esteem, and recommend you check them out if you like video games that aren't just shooters / fortnite. Here goes:

The list

Chris Davis Good in depth critiques of games, the videos are on the longer side if you dig that. I don't have much to say since its quite straight forward, but I find the reviews of good quality and objective.

Accursed Farms Mythical Ross's Game Dungeon series, which review and fully plays though old gems mostly. Some of these gems might be shittier than other but still gems anyway. Fun commentary and you get the see the end of games you will likely never fully play. He doesn't upload that many videos lately due to poisonous mold invading his home for some time.

Grim Beard Diaries

This channel has a very particular theme, most games are grim or darkish tone. And the narrator has a persona of a schizophrenic kind of guy who gets mysterious calls mid review, definitely recommend it.

Mandalore Gaming Mandalore is another one that is pretty straight forward game reviews, although you can find some interesting tidbits about some games and some in depth commentary about others, I like the narrator enough and the variety of genres he covers. Hes not particularly comical, but the Limbo of Lost review I have chosen to embed is priceless.

Matthewmatosis This is one of my favorites, always waiting for the next video to be up. He has some really in depth commentary on the games he reviews, which you can tell he put a lot of effort in mastering. I particularly enjoy the long videos where he plays a game fully while commenting on it. I think anyone interested in game dev should watch his videos for some interesting insights.

Kreal Tube This is a really fun channel, half game reviews half cartoon show. The videos are short and sweet, all using the same art style. Follow Kreal and friends on their miss adventures reviewing video games! BTW I give this channel a 7/10.

SsethTzeentach These are some of the most hilarious comedic reviews I have yet to see. The style might be love it or hate it, but I personally can't stop laughing with his videos.

Teh Snakerer This channel features lengthy game play with commentary / reviews that I find perfect to have something on the background while doing other things, plus some full playtroughs of a few games if you're into that.

And some game-specific channels:

Gaijin Hunter This channel I recommend more specifically if you enjoy Monster Hunter. He has tons of videos for guides on many of the game mechanics. On both classic MonHun and World.

Zerkovich Guides and multiplayer matches of Total War games, Mostly War Hammer 2.

Spirit Of The Law A lot of videos about AoE 2 mechanics and what not, I recommend it if you're a fan of the game.

github.com/Julioevm | @coopykins

Hi, I'm Julio.

I'm a QA Engineer in Valencia, Spain. Although I'm interested in the whole process of software development, not just QA. I believe, for software to be excellent; we can't just focus on technologies and frameworks, we also need to take care of the people working on it. This is a field rich on things to learn, and I love learning and trying new things.

I am FOSS enthusiast and linux is my main developing platform.

And as of 2020 I'm a dad :)

I develop primarily in Java, and I also like Kotlin, Python and Nim. I have experience with Jenkins, Docker and GCE. Selenium and Appium I use on a daily basis, and we have a in-house test framework that I'm a maintainer of.

I'm mainly developing automated checks for an e-commerce site. On desktop and mobile browsers and native apps.

And occasionally I create proof of concept test automation demos for potential clients, train new colleagues in clean code and the testing tools that we use. And I'm also doing some technical interviews to new candidates.

elementary os logo

So I've been using #Linux here and there for many many years, but never used it as a daily driver. On my current work, we use Linux machines a lot, both physical and cloud servers, etc so I thought it would be a great idea to make the move on my work machine.

And how did it go? It's been great. One of the best decisions I've made. I feel much more productive, every tool I need its available and ready to install quickly though repositories, and the usability of the desktop is just much agile than windows. No to speak of the forced “down your throat” windows updates. The one thing I'm missing, well I'm not missing it myself, my life would be better without it but we use it at work; Skype for business. Which I have to use the android app instead of the desktop one.

And the performance is amazing, I'm using Liquorix Kernel, and everything just flies!

The distro I choose is Elementary Os and I'm really happy about it. Its based on Ubuntu stable, which is a good compromise between stability, up to date software and, well, its Ubuntu so it mostly “just works.” I wont go into distro comparisons here, but after having tried pretty much everything there is out there, Ubuntu (or a Ubuntu based distro) is what I feel most comfortable using, and know lets me focus on work rather than fixing random issues. So, why Elementary? Well, as I was saying its based on Ubuntu stable, but it has IMO a better presentation. I'm just not a big fan of the Ubuntu Gnome looks.

So, if you're on the fence, I recommend you take the plunge and give it a whirl, I think unless you need a very specif software for your work, you can benefit from running a Linux desktop on every other aspect.

So after having looked for blogging solutions during the last week, having made a kind of a resolution to start writing a blog, I came upon write.as and to my surprise it seems to be just what I'm looking for: A simple, elegant and no-nonsense platform to write my thoughts. I'm really happy to have found it finally, almost resigned to go back to wordpress, it is a shame this platform doesn't have more renown, for it think it would be well deserved.