Okay, okay. Okay, mm-hm, mm-hm. Oh, yeah. So it already actually installed my application. I will rerun it so you can see it again and then we'll go into details about what's happening in here. But the good thing is that we have the first passing test so good for me, it went well. Just do it right now on your machine, please. Run the first test, make sure it is green, give me your reaction. So just a little tip in case you are running and your simulator name is incorrect. So in this case, detox will fail but it will give you kind of a tip like this is like not the actual names that you have and these are the simulators that you have so you can copy from there and just put it into your Detox RC file to configure it to run on the specific one.
Great, so actually our first part is almost done and the last thing that we'll need to do is to build our Android project and actually start the test but I propose to do start the build right now and go to break so we'll be back once the build is done and we can run our test once again. So again, I'm doing the detox build minus C. In case you will run without minus C specifying your configuration, you will just fail because it will say that there are multiple configurations like this and if somebody is facing any issue during the break we're here so I will be leaving only for a second so I will help with the issues. So you run detox build minus C and then again just copy from your detox RC because not to create a mistake like this and just run it and that's it for the first part. So I think we can start the second part so we've actually done the whole configuration that we need. We've installed detox. We did the detox configuration for both iOS and Android. My build is actually green so which is great from the first try and now I will just run the same thing but just to see that my detox test for Android is also okay. So please just do it together with me. Just run your Android test. It should actually start your simulator and install the app the same way it did for iOS and the test should look exactly like the iOS one because it's the same test.
Okay. Mm-hmm, cool. Okay and apps reloaded, cool, and test is green, great. Android is also green so we have two green tests on different platforms which is amazing. So from this point actually I will switch to using only iOS because all tests will be right and will be cross-platform. So in case you want, you can also switch to using only one platform, either iOS or Android, whatever you like. I will use iOS, but again if you want you can keep using both, and I will just be using only the iOS one. So I'll put it somewhere in here so you can see it all the time. Okay, great. And we will actually, in this part, practice how to write tests with Detox. So we will learn how the Detox test actually looks like, what it consists of, the basic syntax. We will learn how to find the element because in case, like, we have some best practices that I will talk about, and some other tips and tricks that you can use in case you cannot use the best practice. We will talk about three main concepts in Detox which are measures, actions and expectations. And we will also try how to do platform specific actions in case you need it or in case you're, like, working with only one platform and such. So you will be able to write, like, one test and it will literally work even with platform-specific steps for both platforms.
Cool. So guys, give me please some reaction that your tests are also green and you are ready to continue from this point so I can start showing you the test writing part. Okay. Green, green, cool. Okay. I see more people actually giving reactions, which, like, makes my mood even better. So, and now I'll just switch to test writing. So we have another cheat sheet for this part also. So just open the third one in preview because in here you will see some best practices, links to the documentation also. You will have some, like, examples of the code and I really encourage you to use it after the workshop in case you will want to write some tests. And what we will actually start with is, you can, like, open it somewhere else. I will just start with showing you a cool place to go in case you're starting to write your tests with DDoS. So we have documentation, like, API reference for three types of things in DDoS. We have measures, we have actions, and expectation. Measures are the way you kind of find your element, like selectors in web. I will be also comparing with web a little bit in case you're familiar with other types of automation. It's like, other frameworks are more web like, so I will be comparing with it. And this is like selectors in web. A way to kind of find your element on the screen. Then there are actions, which are, like, what you want to do, tap, scroll, swipe, whatever. And you can also have expectations. You must have expectation in your test, which is actually kind of the purpose of your test, is to check something. And you can expect some element to be visible, to be focused, or to have some text, et cetera, to have like any type of expectation that you want. Make sure a good test always has the expectation, and it ends with the expectation, so make sure you have it, and you check only one thing within your test, which is always a best practice. Cool. So we will start actually with talking about measures. So I will close this one, so you will see better. Basically, let's look first what this test does. So, I have a typical JustSyntax that most likely you're familiar with. We have describe, which is kind of a test suite, like all your tests that you have in this file. Then you have a beforeall and beforeeach statements, which is the code that will be executed before all tests, like only once, or before every test that you have. So, in here, you can see that before all tests, I'm launching the app. And before every test that I have, I am reloading the React Native. So, in case I will run my test, let me show you.
Comments