 Welcome everyone to this session and new commands at Apium 2.0 with Kazawaki Matsuo. It's lovely to have you with us today all the way from San Francisco. Kazawaki, take it away. Hi, my talk is our new conference in Apium 2.0 thing. First, let me explain myself briefly. Hi, my name is Kazawaki Matsuo. My GitHub account is Kaz Kokura. Probably some guys know my account in Apium repository. My work role is head spin as a senior software engineer. And previously I worked as a test and QA and automation role in cook button access is so I'm well known test QA world as well. For probably three or four years, I've been maintained Apium project itself, Apium server as well and some clients as well. So today my talk is focusing on Apium 2.0 and today's main topic is these four items. First, I'll explain about Apium basic. How to Apium command works. I will explain briefly. And after that, as a next step, I will explain a bit fake driver to explain the new command. So before a few days ago, I find a bug in the fake plug-ins. So I switched to talk about the driver itself, but the main topic adding command and calling command is the same. And after that, I will show how to call this command as a step three and using Apium binding as a step four. Okay, go ahead. So the first step is about Apium commands. I will show you the basic. Okay. In Apium world, there is three main items to explain Apium. So there is an Apium client and there is an Apium server and there is a device on the test or the application on the test. In Apium world, Apium client and Apium server communicate with web drive protocol. This protocol is based on HTTP protocol. So between Apium client and Apium server, they send an HTTP request from client to server and the client get the response from the server. And this communication, HTTP communication is a basic Apium command. Many times we say just Apium command, then almost cases. It means this web drive protocol, HTTP request set. And behind the Apium server, Apium server manage the device on the test or the application on the test via HTTP request or sometimes ADB command to manage Android, which is provided by Google to manage devices over USB cable. So for example, when Apium client called a method, this example is just a Ruby command. So driver, Ruby, a Ruby binding of a common driver find element and access pretty ID and some word like a happy testing. And once Apium client called this method, and then behind the method, Apium client send an HTTP request to Apium server. In this final element case, post request and the route is session, session ID, element, and the request body is like this, using access pretty ID value happy testing. Once Apium server get this request, and then Apium server do something behind the server and return the response to their Apium client. Today's main topic is this just HTTP call. So this is everything. Today's main technical thing. Let's go ahead. Okay, so let's take a look at a fake driver. I will explain our fake driver, which is used as some testing purpose in Apium project or show this driver as an example to some persons. This fake driver can launch, can establish a session using fake automation name and platform automation name. This fake driver allow to set up capability. This is just a dummy is fine. You can find this fake driver in this Apium 2.0 branch and package it directly. I picked up part of, picked up some definition place from fake driver here. This is what fake driver define Apium commands as a fake driver. For example, in the top place, this fake driver define this route. So slash session, session ID, fake driver, and this method define get and post its method. In get method case, once this URL calls, and then fake driver call get fake thing method internally and return the result to the client. Post require some body, which requires a thing parameter. This fake driver also called this just a slash fake driver path route. Unlike this session ID, this are just simply slash fake driver and any method like get, post, put, or delete or something. This method, this route accept everything. So like this, you can define your own route in the driver, and then the driver will listen each route as an Apium command. Okay, so let's try to call the define method, define Apium command using call and the next is Ruby client once again. This fake driver have this route and this route and this route, total three route, but today I will pick up three route. So get request and the session session ID, fake driver and the post request case and simply just fake driver case. So just call the bottom one via call. I will change the view to the command line tools. So let's launch Apium with fake driver first. And then, once I launched fake driver, and then the server listen, this port, local host, the code number is 4723. So I prepared the command, call command on my local. So let's try to call this command. Fake driver define this route and this route accept everything. So once you call this driver, this route, and then the driver get the route. And it returns a response as a, this message to the call call. Let me launch Apium server using your only XC UI test driver. XC test driver doesn't have like this route. When you call this path, and then XC UI test driver doesn't accept this, cannot handle this route properly. So it returns no command result. So actually fake driver has this route. So adding a new command and call the command is basically this, everything. So as our next step, I will show you some client side implementation. Today's, I will use Ruby client to explain some new adding new command in client side and call each command as a client method. First. I will launch the fake driver and establish a session. And I will explain how to add sessions in client side and try to do some demos. So let's start Apium fake driver already started. And let's start our fake driver session. In the client case, it require Apium live core library. And it needed some capabilities and turn established session using this capabilities. Let's try to call this bit very quickly. So once we client called core start driver. And then one more time. The server side fake driver get our request from just a session and prepare fake driver and return the response. So you have already finished that service session. And next, let's try to call basic method driver page source. So fake driver already have this method call. It returns a file body. It is defined specified by this app. So fake driver already have this page source command. So let's define extend Ruby client side code to call additional code for fake drivers. In Ruby client case, Ruby already have a command method. And it can define method and URL and how to call the method name. Let's try that. Let's call this method first. In here, after creating a driver, I defined a method like this, get and just a root fake driver. And the name is just a get fake driver. So driver can call this method like this get fake driver. And then the fake driver get the request and return the response. Like this, you can also define session ID, fake driver root. Okay, this also is easy to see done just a read. So in Ruby case, establish the session and add a command as a get and this URL and this command name is get fake driver to. And then fake driver get the request. The important thing is in Ruby case, the session ID, colon session ID will replace with proper session ID string. So as a fake driver, the request session ID was replaced with this are some random string. So, yep. So this is just a HP call from client to the fake driver and the response return to the response from fake driver to the client. And the Ruby client already have this method to extend the Ruby common other method and behind that, what URL Ruby client should call. I have more example but five five five five five minutes to go. Yeah, so today's demo is just just it. So I will publish this documentation this slide to the public place so you can read them later. So, and the Ruby client can define a post as well. And if you define you, if you call some one parameters which is required by driver, and then you can also get some error messages. So in fake driver or plugins, you can define the method and you can also set some limitations to which which parameter is required or go ahead. Okay, so I explained the up in command what is happening behind the client side call. And I also explained briefly in the fake driver how to add ACP route and some other parameters and client Ruby, I picked a Ruby client case but some client already have to extend AC command. But if your client does have their add command. Even, even this case, you can define your own route using a banner ACP client. So the important thing is, you need to replace some session ID or elemental ID properly, but basically you can define your own ACP, your own ACP client using your ACP client. That's it. Thank you. We've got one question for you here. What is practical usage of fake driver? Yeah, this fake driver is just a in up in project, we use this fake driver as our end to end test case. So this is just a dummy thing. So some method already wrapped. So like a source page also already wrapped so but other drivers like XERA test or UI automated to require some Android or iOS dependencies so that they are not good for thin test drivers as an up in project. So fake driver is the main purpose is use end to end test in the other up in module. So basically, probably you, you won't use fake driver for your project. Just some practice or reading some simple implementation. Excellent. I don't think there are any other questions. Someone said this worked similarly in APM one, correct. Could you also write custom commands there? Yeah, exactly. In basically up the difference APM 2.0 and APM 1.x is which is which driver you want to install. So APM 1 is basically already have some drivers as a one package. So up in 2.0, you can download, you can get your necessary package only that. So other front end between client and server is the same. Right. I hope that answered the question. We've got one more question here. Same question from my end. Will weight commands work with fake driver? Yes. Can you just make yourself, oh, you're going to show us a thing. Okay. Yeah. I was going to say in the screen here, but you're going to show. So keep the screen here. All yours. Go for it. Will weight commands work with fake driver? Yeah. It probably just a rough command. So it has actually method, but it returns nothing. It does nothing, do nothing. So it's just a rough command. Just a return to zero, zero. Cool. I think there's evidence. Look, if anyone were actually out of time, if anyone has any more questions. It'll be great. She says just posted in the chat that fake driver is a dummy project to test internal app in projects, which is what you said before too. I was lucky. Enjoy the rest of your day. That's it from from the session. Take care.