eridem/patata

Better documentation on writing definitions?

Closed this issue · 12 comments

I have tests running, but I am not exactly sure how to access the iOS driver from my definitions files... I expected a global driver variable but it does not exist, this.emu seems to be what the documentation points to using but this.emu.getScreenshot does not exist...
Built in hooks seem to indicate patata.emulator.driver.takeScreenshot() works and I need to require in patata in each test, is this the case?

Agree. One of my thoughts to improve the framework is create some kind of easy "helpers" that are appended to the promise chain and write them in the documentation.
E.g.

  • takeScreenshot
  • swipeHorizontal
  • swipeVertical
  • ...

Let's decide to create an easy one, revise the structure and append new ones for the most common actions. As well, I may decide to check where we move the documentation to be easier accesible.

All these above helpers are already built into the appium iOS driver, the driver just needs to be exposed to the definitions...
That's where I get lost here... also there is no concept of the "world", a core concept in the cucumber.js docs...

Patata only connects Appium and Cucumber, you should be able to use the features of both.

My idea of helpers, is just wrap some of the Appium commands to make some of their functionality easier.

Ok... so in after.js we have patata.emulator.driver.takeScreenshot(). How can I do this from definitions?

Can you try using this.emu.takeScreenshot().then(...) inside a step?

this.emu exports the Appium driver. If you would like to check more info about which are the available operations, you can check these pages:

https://github.com/admc/wd
http://appium.io/slate/en/master/

In my opinion, that documentation is not so good neither. I was only to find the takeScreenshot function checking examples on the internet :(

In another hand, I do not recommend to have an excessive use of the screenshot, it slows the tests.

Ahhhh I assumed you were using https://github.com/appium/appium-ios-driver and called getScreenshot...

What do you think about moving to the native drivers vs the web drivers for appium? It would get us a lot of commands "for free"

Sorry, maybe I do not have enough experience on the different between "native drivers" and "web drivers". I am up for improvements on this aspect, be my guess. Can you give me some examples?

My only note is to use something that works both in iOS and Android due one of my goals and mindset is the reusability between platforms. Or incase it is not possible, create a wrap that have the same contract but it calls to different parts depending on the platform (as I did with "Components")

so the native drivers are just appiums wrapper around the web driver that does what you were saying before and provides a ton of helpers to make interaction easier. They have the same goal of making it work between platforms too

What you implemented here is super low level... and that is cool, but just a lot to maintain when appium has already done most of this work for you already

Be my guess :-) You seem more updated on this part if you wanna improve anything 👍

I will close this issue. If u find another alternative, please recreate it.