CommonNet – how to set up tests

Setting up tests' environment wasn't easy Have you ever tried to set up your tests' environment using Protractor on Vagrant? I must admit that it was a very difficult task for me. I have recently spent almost three days trying to prepare my tests' environment for CommonsNet project, and read many different resources. Fortunately, I have finally done it, so now I want to share with you my experience and give you some tips how to do it. Protractor Firstly, I will explain you why I have decided to use Protractor. It is mainly because Proractor is especially designed for end-to-end testing  AngularJS application. Protractor runs tests against your application running in a real browser, interacting with it as a user would. Writing tests using Protractor is quite easy because you can find working examples in AngularJS docs. Each sample of AngularJS code is enriched by Protractor's test. It's amazing. Selenium Selenium is a browser automation library. It is most often used for testing web-applications, and may be used for any task that requires automating interaction with the browser. You can download it from here. You have to choose Selenium for a language you use. I have used Selenium for NodeJS. Vagrant You don't have to necessary use Vagrant to run your tests, but I have implemented it, because I run my local environment on Vagrant and it's more comfortable for me to use it. Setting up testing environment Now I will share with you how to run tests. So first all of, I have created a file called install.sh and put all necessary commends there. I have put there several commands. Please take a look at this file.  It helps you to install all of these necessary dependencies using only one command instead of several ones.  Next, I have prepared provision folder, where I put files to install selenium standalone and chromium driver. You can copy these file from here Then I have created a simple test case. It's quite easy at the beginning. You just need two files first - conf. js and next- todo_spec.js  Below, I will provide you with my conf.js As you can see it's not complicated and really short. It's a basic configuration file and of course you can adjust it to your needs. You can find many examples of conf.js file in Internet. And finally a simple test, which I have placed in todo_spec.js file. It's a ProtracotrJS example available on their website Now, let me to write a step by step todo list now. Install Vagrant in your folder vagrant up Connect to Vagrant vagrant ssh Open your Vagrant folder cd /vagrant Then run selenium file sh selenium_install.sh Next open provision folder cd provision Install java-jar DISPLAY=:1 xvfb-run java -jar selenium-server-standalone-2.41.0.jar Your selenium server should be up and running Then open a new terminal - remember not to close the first one! Open your CommonsNet repository again cd CommonsNet Connect to Vagrant again vagrant ssh Open Vagrant folder again cd /vagrant Then open tests folder…

Continue ReadingCommonNet – how to set up tests

One step at a time – The beginnings of CommonsNet

The beginnings If you have been accepted to a serious project like Google Summer of Code is, you can feel lost and scared. I think it's nothing special and probably everyone experiences it. You can feel that pressure because you want to fulfill all expectations, follow your obligations and to do your best, but working in such project is something different from working on your own, private and small one.  Your organisation and mentors require something from you, and they can even provide you with a detailed guideline how to behave but doubts may occur anyway. My advice is not to give up and go through that tought period in order to experience the joy of results and sense of satisfaction, and to learn something to be better in the future. I am going to tell about my beginnings and to provide you with some tips  from my own experience CommonsNet CommonsNet (feel free to see it) is a new project of FOSSASIA. It focuses on providing users with transparent information about WiFi they may use in public places like hotels, restaurants, stations. The thing is that for now, if you go to a new place, and want to connect to Internet, you look for a free WIFI sign and as soon as you find it you try to connect. But think about it, how much do you know about this connection? Is is safe for your private data? How fast is it? Does the Internet connection have any legal restrictions?  I suppose that you answer 'no' to all these questions. But what if you know? Or if you can compare details of different WIFI available in a specific public place and connect to more suitable for your needs. I am sure you will appreciate it. I hope to run this project successfully and I am going to tell you more about it in next posts. How to start? Due to the fact that CommonsNet is a new project as I have mentioned before, and for now apart from mentor @agonarch and FOSSASIA leaders @mariobehling @hpdang, I am an only contributor, I am in a good position to tell you what are my steps. Remember not to think about all at once. It will make you crazy. So first of all - prepare your work. Try to get to know about your project as much as possible. Follow group chat, GitHub repositories, do research in Internet about the subject of area of your project or don't be afraid to ask your team member. That's what I have done at first. I have prepared a Google Doc about all WiFi details. I  have tried to get to know as much as possible and to gather this information in a clear, easy-to-understand way. I need it because I will be preparing a wizard form for users to let them provide all important details about their WiFi. I need to think seriously which data are important and have to be used to do it. It is not finished yet and will be changing…

Continue ReadingOne step at a time – The beginnings of CommonsNet