Automated iOS Testing with Appium and wd

Apparently someone checked out this blog during working hours and decided to tell me that I need to do an update.

Last month I was working on this mobile version of GitHub built with React-Native. The framework itself uses the same principle as React, which is component-oriented (is that a real word). However, I had most fun working on the automated testing on simulator and real device with Appium, the JSONWireProtocol implemented by wd, and Mocha.

Appium is a local server which accepts requests for UI testing. It supports languages including Java, Python and JavaScript with the same essential protocol. wd is one of the JavaScript libraries that implements the protocol AND has the most stars on GitHub, which is why I chose to use this one. Appium uses WebDriverAgent developed by Facebook to ‘control’ real devices and simulators. It also uses xcode dev tools to install apps and to inspect elements etc.

Appium has this concept called ‘desired capabilities’, which configures the testing environment. The capabilities I used for this UI test include:

  • udid, the unique identifier of the real device or simulator
  • platformName:’iOS’
  • platformVersion:’11.2′
  • app, the installation package of the app to be tested, .ipa for simulator, .app for device
  • xcodeOrgId, XCode devloper identifier
  • xcodeSigningId:’iPhone Developer’
  • deviceName, duh

here is the documentation for the desired capabilities. One important thing to note is that .ipa is the package extension for simulators and .app is the extension for devices. Methods to obtain them are documented in the README of my repository (link below).

With these in mind, I could start writing the tests. First and foremost, I needed to connect to Appium server with wd API like this:

const server = {
  host: 'localhost',
  port: 4723,
};
const driver = wd.promiseChainRemote(server);
const desired = {
  // desired capabilities above
};
driver.init(desired);

With the mapping provided on wd GitHub repo, I was then able to gradually implement my UI tests.

it('should display every tab', () => {
    return driver.waitForElementByName('Xuanyu Zhou', 6000)
      .then(el => {
        return driver.elementByName('Xuanyu Zhou').text();
      })
      .then(result => {
        result.should.be.equal('Xuanyu Zhou');
        return driver
          .elementByXPath('//XCUIElementTypeButton[contains(@name, "Public Repos")]')
          .click()
          .sleep(200)
      });
});

The above snippet is a mocha test that first waits for an element with name ‘Xuanyu Zhou’ to mount, then inspects the text ion that element. Afterwards, it uses XPath to select a button with name ‘Public Repos’, before it clicks on the button and sleeps for 200 milliseconds.

Apparently XPath’s documentation is hard to be found so it took me several StackOverflows to figure it out.

One neat thing about Appium-Desktop is that it has this inspector feature that lets you inspect the elements on the phone screen by clicking on them, just like Chrome’s developer tools. This is tremendously useful especially for the annoying XPaths.

Another interesting thing to note is that during testing I had this weird bug that although I had username and password inputs as different components, I could not click on them by themselves in the inspector. I also couldn’t select based on their names. It turned out I needed to make the input fields ‘accessible’ with React Native, documentation here. I guess Apple uses accessibility fields to give the elements names in testing. An Apple employee would be helpful here.

Repository

Testing Demo Episode 1:

Testing Demo Episode 2:

259 thoughts on “Automated iOS Testing with Appium and wd”

  1. I would not also know how I finished up in this article, but I imagined the following submit was previously superior. I really don’t realize that you’re nonetheless definitely you’re going to a new well-known blogger for those who will not be witout a doubt.. koleksi youtube terfavorit Kind regards!

  2. The weekend is fast approaching. Why not spend it with a sexy cam girl? There’s plenty of them over at http://www.camgirl.pw All of these girls are wanting to have a good time. That’s exactly what you’re looking for too. The most fun you’ll ever have online is right here. Have yourself a good time and meet someone new. That’s what this site is all about.

  3. Appreciating the time and energy you put into your
    website and detailed information you provide. It’s awesome to come across a blog every once in a while that
    isn’t the same outdated rehashed information. Wonderful read!
    I’ve saved your site and I’m including your RSS feeds to my Google account.

  4. You’ve got to check out this cam girl’s big natural tits. Those jugs of hers are awesome. The face on this cutie is as sweet as sugar. Don’t worry if she’s not online. There’s plenty more babes at http://www.camgirl.pw It’s only a matter of clicking or tapping until you find the girl of your dreams there.

  5. Just imagine for a second if you could get into the mind of a millionaire. Think of all the things that you could learn. Well, you actually can do just that. A millionaire is giving away all of his secret right on the internet. You don’t even need to leave the house to learn what made him rich. All it takes is visiting http://e31a67zd-ccr7u13el2cflqp0d.hop.clickbank.net He will literally teach you all of the secrets to making money. Don’t you think it’s time that you earned the living that you deserve? Change your life today by simply following the link above. Do it for yourself and everyone that you care about.

  6. Did you know that people make their entire income promoting ClickBank? You too could be one of the many who have quit their job. Affiliate marketing is as old as the internet. It’s not going to go away any time soon. You too can get your piece of the pie. Why shouldn’t you? Do you really like working the job you have? Are you going to be able to do it until you retire? If you’re job requires physical labor, then you know the answer to that question. There’s no way you’re going to be able to do that when you get older. That’s just the truth and no one needs to tell it to you. Right now you could be making money online. Does it require work? You better believe it does. No honest person is ever going to tell you that it’s possible to become a millionaire online without doing any work whatsoever. It’s not possible. That doesn’t mean there isn’t money to be made. There’s plenty of money out there to be made by people just like yourself. Now you know there’s going to be a pitch for a product. You’re right about that. Click on the link http://64efd6-lz41s3rcelbr7s2xl7x.hop.clickbank.net/ and check it out. There’s a video you can watch that will explain everything. It will tell you how to make money using ClickBank. Watch the video and see what you think. You too can be one of the many who earn a living promoting ClickBank. Some people earn a good living and there’s no reason why you can’t.

  7. Are you the type who likes to hangout on social media? Have you ever thought about making it a career? You can help promote their business using social media. This means you can do what you already love doing and make money at it. Does this sound like something you’d like to do? If so, then check out http://d526fc0l5b3nfyfg3bx3sfpbkq.hop.clickbank.net/ You can help people and make some money in the process. You already hang out at social media sites. Why not make a few bucks doing it?

  8. I’m not sure exactly why but this weblog is loading incredibly
    slow for me. Is anyone else having this issue or is it a issue on my end?
    I’ll check back later and see if the problem still exists.

  9. Howdy! I know this is kind of off topic but I was wondering if you knew
    where I could find a captcha plugin for my comment form?
    I’m using the same blog platform as yours and I’m having difficulty finding one?
    Thanks a lot!

  10. When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get four e-mails with
    the same comment. Is there any way you can remove people from that service?

    Many thanks!

  11. Excellent post. I was checking continuously this blog and I’m impressed!
    Extremely heslpful ihfo specially the last pawrt 🙂 I care for such info much.

    I was looking for this particular inmfo for a very long time.
    Thankk you and best off luck.

  12. “I am not sure where you are getting your info, but great topic. I needs to spend some time learning much more or understanding more. Thanks for excellent information I was looking for this info for my mission.”

  13. I am really loving the theme/design oof your site. Do you ever run into any browser compatibilit problems?
    A small number of my blog readers have complained about my blog nnot operating correctly in Explorer but looks great in Firefox.

    Do you have anny ideas to helpp fix this issue?

  14. PHP SEO: Search Engine Optimization
    php seo uzmanı olarak şirketimiz php seo hizmeti vermektedir günümüz ortamında site sahiplerinin php bilgisi nekadar iyi olsada php seo metotları arama motorlarında optimize edilmesi gereken hususlardan bir tanesi web siteniz nekadar iyi olsada arama motorlarına duyarlı olmasına özen gösterin. php seo uzmanlarımızdan destek alabilirsiniz.

  15. Thanks for your marvelous posting! I quite enjoyedd reading it, you are a great author.I wiill be sure to bookmark yoyr blog
    and definitely will come back sometime soon. I want to encourage you to continue your great work, have a
    nice holiday weekend!

  16. You’re looking to get laid. All you want to do is fuck right this very second. You can do just that at this dating site. You won’t be looking through hundreds of profiles of prudes. These are the kind of girls that you can get your dick wet into. Don’t jerk off to porn. Instead, visit https://t.hrtye.com/lw2c5cw328?aff_id=29696&offer_id=5604&nopop=1 and get laid. Fuck that pretty princess you’ve always been dreaming about. You’ll bust your nut in no time flat after joining this site.

  17. ankara deha nakliyat firmansı. ankara evden eve nakliyat ev ofis taşımacılığı, şehiriçi şehirler arası nakliyat, eşya depolana hizmetlerini kusursuz olarak uzman kadromuzla 7/24 hizmetimizdeyiz ankara deha nakliyat firması…

  18. Appreciating the commitment you put into your website and in depth information you offer. It’s good to come across a blog every once in a while that isn’t the same unwanted rehashed material. Excellent read! I’ve saved your site and I’m including your RSS feeds to my Google account.

  19. I’m really impressed with your writing skills and also with the layout on your weblog. Is this a paid theme or did you customize it yourself? Anyway keep up the excellent quality writing, it’s rare to see a great blog like this one these days.

  20. Are you searching for a little live cam fun? If so, then you definitely need to check out https://t.irtyc.com/3l5f0asadc?aff_id=29696&offer_id=3664&nopop=1 This is by far the hottest cam site ever. You’ll find plenty of horny girls who love to get down right dirty. This is the kind of dirty that will leave you smiling from ear to ear. Meet girls online who are even more horny than you are. That’s what this is all about. Check it out now and prepare to have an amazing time.

  21. You’ve worked hard this week. Now it’s time to let your hair down and have a little fun. You can do just that at http://www.camgirl.pw There’s a whole lot of sexy cam girls there. You’ll be amazed by how many there are. Not only that, but these girls are super dirty. This is by far the hottest cam site on the internet. You’ll fully understand that the very second your eyeballs are laid upon these beauties.

  22. Excellent giods from you, man. I have understand your
    sstuff previous to and you’re just too wonderful. I really like what you’ve acquired
    here, certainly like whaat you are saying and the way in which
    you say it. You make it enjoyable and you still take
    care of to keep it smart. I can’t wait to read much more from you.
    This is really a grat web site.

  23. Hi just wanted to give you a quick heads up and let you
    know a few off the pictures aren’t loading properly. I’m nott sure why but I think its a linking issue.
    I’ve tried itt in two different browsers and both show the same results.

  24. After reading your post, you have a great website with interesting content. But I think you can improve your current google ranks by using SEO website traffic net. My friend uses it and it works great. Just google it, it’s very nice tool to bring you a lot of new readers on a daily basis. Keep up the quality work!

  25. Hello! I know this is kind of off topic but I was wondering if you knew where I could find a captcha plugin for my comment form? I’m using the same blog platform as yours and I’m having difficulty finding one? Thanks a lot!

  26. kurumsal SEO uzmanı ajansı olarak siz değerli müşterilerimize en iyi hizmeti vere bilmek adına her zaman ileriye dönük güncel çalışmalar sunmaktayız günümüz ortamında her şeyin e-ticaret platforumlarda ilerlediğini biliyoruz onun içinde iyi bir potansiye sahip olmak ve kazanç için doğru bir uzmanla çalışarak kazanç elde etmek artık mümkün arama motorlarında web siteniz yükselmesi için Sosyal pazarlama ve optimizasyon çalışmaları yapmaktayız.

  27. Antalya havaalanı transfer, alanında hizmet veren Antalya Transfer CLK Firması transfer servis araçlarıyla konforlu ve güvenli yolculuğu hesaplı fiyat politikasıyla beraber müşterilerine en iyi şekilde sunmaktadır.

    Araç filomuza kattığımız hem VIP hemde STANDART servis araçlarımızla misafirlerimizi Antalya havalimanından alarak istedikleriyle lokasyona transferlerinde hizmetinizdeyiz. Antalya havalimanı transferinde saat ve zaman önemli olduğu için misafirlerimiz asla beklemezler ve randevularına geç kalmazlar.
    Antalya Transfer CLK Firması olarak mutlu tatiller dileriz

  28. After reading your post, you have a great website with interesting content. But I think you can improve your current google ranks by using this service. My friend uses it and it works great. Just check to https://bit.ly/2v7j3id, it’s very nice tool to bring you a lot of new readers on a daily basis. Keep up the quality work!

  29. aplikasi berita saham 2018 It truly is a very very helpful little bit of information. I’m just grateful you discussed this useful info with us. Remember to keep us educated this way. Appreciate your expressing.

  30. Howdy, I think your blog could be having internet browser compatibility issues.

    Wheneve I lkok at your blog in Safari, it looks fine however, when opening in IE, it has
    some overlapping issues. I just wanted to provide you with a quick heads up!
    Other than that, great website!

  31. With havin so much written content do you ever run into any issues of plagorism or copyright violation? My site has a lot of completely unique content I’ve either authored myself or outsourced but it seems a lot of it is popping it up all over the internet without my agreement. Do you know any techniques to help protect against content from being ripped off? I’d definitely appreciate it.

  32. Having read this I thought itt was extremely informative.

    I appreciate you taking the time and effort to put this short article together.
    I once again find myself spending a lot of time both reading
    and commenting. But so what, it was stoll
    worth it!

  33. I’ve been having issues with my Windows hosting. It has set me back quite a bit while making the next list. This is the current list that I have. I should add another list in less than a week. I’ll let you all know when the next list is ready. Thank you for your patience.

  34. Sweet blog! I found it while searching on Yahoo News.
    Do you have aany suggestiopns on how to gett listed in Yahoo
    News? I’ve been trying for a while buut I never seem to get there!
    Appreciate it

  35. I’m extremely impressed along with your wrriting talents andd also with
    thhe layout onn your weblog. Is this a paid subject matter or
    did you customize it yourself? Either way stay up the excellent high quaoity writing, it is rare to look a nice weblog llike this one nowadays..

  36. Does your site have a contact page? I’m having a tough time locating it but, I’d like to shoot you an email. I’ve got some creative ideas for your blog you might be interested in hearing. Either way, great site and I look forward to seeing it grow over time.

  37. It’s a pity you don’t have a donate button! I’d certainly donate to this fantastic blog!
    I suppose for now i’ll settle for bookmarkkng aand adding your
    RSS feed to my Google account. I lok forward to new updates and will talk about this blog with my Facebook group.
    Talk soon!

  38. I do agree with all of the ideas you’ve presented in your post.
    They’re very convincing and caan certainly work. Still, the posts are very shorft
    for newbies. May you please prolong them a bit from
    next time? Thanks for the post.

  39. Hi there! I know this is kinda off topic however ,
    I’d figured I’d ask. Would you be interested in trading links or mmaybe
    guest writing a blog post or vice-versa? My blog covers
    a lot of the same subjects as yours and I think we could greatly benefit from each
    other. If you might bbe interested feel free to send me an email.
    I look forward to hearing from you! Wonderful blog
    by the way!

  40. This design is steller! You obviously know hhow to keep a reader entertained.
    Between your wit and your videos, I was almost moved to strt my own bllog (well,
    almost…HaHa!) Great job. I really enjoyed what you had tto say, aand more than that,
    how you presented it. Too cool!

  41. Howdy! I know tbis is kinda off topic but I was wondering if you knew where I could
    get a captcha plugin for my comment form? I’m using the same blog plaatform aas
    yours and I’m having trouble finding one? Thanks a lot!

  42. Can I simply just say what a relief too find an individual who
    truly knows what they’re talking abput oon the web.
    You actually understand hoow to bring an issue to light and make it
    important. More and more people must read this and understand
    this side of the story. I was surprised that you’re not more popular given that you most certainly possess the gift.

  43. I’d like to thank youu for the efforys you have put in writing this blog.
    I am hoping tto check out the same high-grade blog posts from you in the future as well.
    In fact, your creative writing abilities has encouraged me to get my own, personal
    site now 😉

  44. Paykasa, 16 haneli pin kodundan oluşan, daha önce çok yaygın olarak kullanılan bir ön ödemeli kart türüne benzeyen, içerisinde euro bakiyesi olan bir ön ödemeli sanal karttır. İçerisindeki bakiyeler özel olarak üretilemediği için standart kart bakiyeleri 10, 20, 50, 100, 150, 250 tek kart bakiyesi olarak satılmaktadırlar. Tek kullanımlık bir kart olan paykasa kart, kullanılan sitede kartın bakiyesini girmenize gerek kalmadan sadece 16 haneli tek kullanımlık koduyla işlem yapmanıza olanak sağlamaktadır.

  45. Cool! Interesting tips over here. It is pretty worth enough for me. In my view, if all web owners and bloggers made good content as you did, the internet will be a lot more useful than ever before.| I couldn’t resist commenting. I have spent 2 hours searching for such tips. I will also share it with some friends interested in it. I’ve just bookmarked this website. Finished with the work done, I will find some live gay webcams. Thanks!!Greetings from San Francisco!

  46. Simple and easy!! Interesting tips over this website. It is pretty worth enough for me. In my opinion, if all website owners and bloggers made good content as you did, the internet will be much more useful than ever before.| I could not resist commenting. I ‘ve spent 2 hours looking for such informations. I will also share it with some friends interested in it. I’ve just bookmarked this website. Right now with the task done, I will find some model gay cams. Merci!!Greetings from New York!

  47. Almost three years ago, my old computer had many bad viruses and bad pop-ups. I have some files left on that computer and I did not see them for almost three years ago. I wonder I will like to see my old files again that I can connect to my new computer to old computer. That is problem that I am afraid which bad viruses will come to my new one from old one. Please let me know how I can get my old files move from my old computer to my new computer without bring bad viruses to my new one?.

  48. There’s nothing hotter in this entire world than seeing two girls make sweet love. Seeing a girl face deep in pussy is a dream come true. Dreams have a way of turning into reality at https://t.frtyt.com/ekuezzm5kw?aff_id=29696&offer_id=5407&nopop=1 This site is dedicated to stepsisters who love to lick and finger each other. You always knew stepsisters did this sort of thing with each other. You just never seen it with your own eyes until now!

  49. Big Big Baller is a recent iOS and Android that will allow you to roll over materials in order to increase them to your ball and rise the size of it. You are able to obtain coins, unlock brand new skins, acquire levels, and struggle for the peak place against numerous others. To get more free coins just simply visit listed here to direct access Big Big Baller hack tool page

    https://sites.google.com/view/big-big-baller-coins-hacki-ios/

  50. It is the best time to make some plans for the longer term and
    it’s time to bbe happy. I have learn this publish and if I mmay just I wish to suggest you some interesting things orr advice.
    Maybe you can write subsequent articles regarding this article.
    I desire to read more things approximately it!

  51. Hello! I just wanted to ask if you ever have any problems with hackers?
    My last blog (wordpress) was hackled and I ended up losing
    many months of hard work duue to no back up. Do you have any solutions to prevent hackers?

  52. Undeniably imagine that which you stated. Your favourite justification seemed to bee on the net the simpolest factor to be aware of.
    I say to you, I certainly get annoyed whioe other folkms thyink about concerns that they lainly do not recognise about.

    You managed to hit the nail upon the top ass neatly as defined out the whole
    thing without having side-effects , other people cann take a signal.

    Will likely be back to get more. Thank you

  53. Are you looking to get laid today? As in right this fucking minute? If so, then you need to check out https://t.hrtye.com/ze97vsfi2o?aff_id=29696&offer_id=5614&nopop=1 This is the one site where you can get some action the same day you join. Don’t even fool around with Facebook and those other so called dating sites. You’re never going to get laid at any of those places. There’s all kinds of pussy just waiting for you to pound it silly here. Don’t forget to buy a box of condoms while you’re out today. You’re going to need them!

  54. Aw, this was an exceptionally nicee post. Spending some time and actual effort to generate
    a very good article… but what can I say… I procrastinate a whole
    lot and don’t seem to get anything done.

  55. Hmm iit appears like your site ate my first comment (it wwas extremerly long) so
    I guess I’ll just sum itt up what I submitted and say, I’m thoroughly enjoying your blog.
    I as well am an aspiring blog blogger but I’m still new to everything.
    Do you hav any tips and hints for newbie blog writers?

    I’d definitely appreciate it.

  56. Are you sick and tired of being lonely? Why should you not have someone special in your life? Everyone deserves to find love. You can find that and a whole lot more at https://t.irtyc.com/avekqggwlc?aff_id=29696&offer_id=3785&bo=2753,2754,2755,2756 This is one of those sites where it’s super easy to hook up. You’ll meet all kinds of girls. Don’t sit on the couch and hang out online all night. Hook up with a chick and have yourself a little fun. Every guy deserves to have a gal in his life. What are you waiting on?! Connect with a cutie today and put a smile all over your face.

  57. Paykasa yüzbinlerce platformda alışverişlerde kullanabileceğiniz ön ödemeli bir karttır.
    Paykasa kart kullanıcıları basit işlem yapmak ve güvenli alışveriş için online alışverişlerde paykasa kartı tercih etmektedirler. paykasa al firması olarak bizlerden güvenli bir şekilde satın alanilirsiniz.

  58. Hi, I do believe this is a great web site. I stumbledupon it 😉 I will revisit
    yet again since i have saved as a favorite it. Money and freedom is the
    best way to change, may you be rich and continue to guide other people.

  59. Good info! Interesting informations over this web. It’s pretty worth enough for me. In my opinion, if all web owners and bloggers made good content as you did, the net will be a lot more useful than ever before. I could not refrain from commenting. I have spent 1 hour looking for such infos. I’ll also share it with a couple of friends interested in it. I’ve just bookmarked this website. Done with the job done, I going to find some model homo cams. Thank you!! Greetings from Los Angeles!

  60. Are you the type of guy who likes to look at fat girls naked? If so, then https://t.frtyh.com/755v8haio0?aff_id=29696&offer_id=5331&bo=2753,2754,2755,2756 is the site you’ve been searching for. It’s full of nothing but sexy fat women. These big beautiful women are exactly what your eyeballs have been begging to see. Don’t be surprised if you pop a boner while looking at these hefty honeys. They’re full of curves and are exactly what your penis likes.

  61. I’m seriously enjoying the design of your weblog. Do you come across any kind of browser interface issues? A lot of the website visitors have lamented about my omega xl pills website not operating appropriately in Explorer yet looks excellent in Chrome. Do you have any ideas to assist fix the issue?

  62. seo uzmanı olarak şirketimiz php seo hizmeti vermektedir günümüz ortamında site sahiplerinin php bilgisi nekadar iyi olsada php seo metotları arama motorlarında optimize edilmesi gereken hususlardan bir tanesi web siteniz nekadar iyi olsada arama motorlarına duyarlı olmasına özen gösterin. php seo uzmanlarımızdan destek alabilirsiniz sitenizi aramotorlarına duyarlı hale geçirelim.

Leave a Reply

Your email address will not be published. Required fields are marked *