Skip to content

Commit

Permalink
Added protractor test
Browse files Browse the repository at this point in the history
  • Loading branch information
admin authored and admin committed Feb 9, 2018
0 parents commit 4793f5e
Show file tree
Hide file tree
Showing 24 changed files with 3,087 additions and 0 deletions.
81 changes: 81 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#User Guide for Booking Online Air Tickets using automated script
- it will simulate user actions in web browser and check if function works as expected.)
====
## Tech stacks

- [`Protractor`](http://www.protractortest.org/#/)
- webdriver-manager

## Test Scenario : Book Online Air Tickets
## Test Cases :
1. Open Google.com
2. Search for Singapore Airlines
3. Open Singapore airline website
4. Search for flight from Singapore to Bali
5. Select date of Start Travel Time = (Current date) & End Travel time = by default selected Value
6. Select bussiness class seat
7. Click on search


## 2.0 Setup
### Dev Setup nodejs and npm
* install node and npm
```
brew update
brew install node
```
* install protractor and webdriver-manager
```npm install protractor``` as to install all dependendies from package.json
```npm run webdriver-update``` as to update webdriver
* Running locally on user machine for testing and debugging purpose we need to comment it out seleniumAddress: 'http://localhost:8080/wd/hub' on conf.js file


### 2.1. SELENIUM GRID (http://www.seleniumhq.org/docs/07_selenium_grid.jsp)
Currently selenium test is running on Grid using Docker
- The purpose of running test in grid because it speed the time of execution using parallel execution
- To run your tests against multiple browsers, multiple versions of browser, and browsers running on different operating systems.

```
### To remove existing container
if [ "$(docker ps -a | grep 'selenium/node-chrome:latest')" != "" ]; then
docker ps -a | awk '{ print $1,$2 }' | grep selenium/node-chrome:latest | awk '{print $1 }' | xargs -I {} docker rm -f {}
fi

if [ "$(docker ps -a | grep 'selenium/hub:latest')" != "" ]; then
docker ps -a | awk '{ print $1,$2 }' | grep selenium/hub:latest | awk '{print $1 }' | xargs -I {} docker rm -f {}
fi


### using docker compose set the grid
docker-compose up -d
docker-compose scale chrome=13

```
### 2.2. REPORTS
Currently the reports are implemented using plugin
```plugin
https://github.com/azachar/protractor-screenshoter-plugin
```
- On failure of test this plugin will generate a screenshot
- console error
Screenshot and console error will help on debugging/analyzing why test are failing .
* `Relative part` of test report is : SingaporeAir/REPORTS/index.html

### 2.3. RUN TEST
Use the below command to run the test
```
./node_modules/protractor/bin/protractor conf.js
```

### 2.4 Folder Structure

- `Lib` Folder is having all library function
- `Page` Folder When writing end-to-end tests, a common pattern is to use Page Objects. Page Objects help you write cleaner tests by encapsulating information about the elements on your application page. A Page Object can be reused across multiple tests, and if the template of your application changes, you only need to update the Page Object.
- `Test Suite`, testSuite will have test cases. All test cases will have proper log statement which will be easier for debugging in case of failure. Avoid writing web element directly inside testSuite.js folder as later don’t need to change anything on testSuite
- `data`, contain any test data / hard coded data to be used in test
Reuse the test data , ( avoid having duplicates)

## Video of Running Test
```https://ufile.io/vqrlb```
2 changes: 2 additions & 0 deletions REPORTS/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added REPORTS/favicon.ico
Binary file not shown.
Binary file added REPORTS/fonts/fontawesome-webfont.eot
Binary file not shown.
2,671 changes: 2,671 additions & 0 deletions REPORTS/fonts/fontawesome-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added REPORTS/fonts/fontawesome-webfont.ttf
Binary file not shown.
Binary file added REPORTS/fonts/fontawesome-webfont.woff
Binary file not shown.
Binary file added REPORTS/fonts/fontawesome-webfont.woff2
Binary file not shown.
3 changes: 3 additions & 0 deletions REPORTS/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!doctype html><html ng-app=reporter ng-strict-di><head><meta charset=utf-8><title>Screenshot reporter</title><meta name=description content=""><meta name=viewport content="width=device-width"><!-- Place favicon.ico and apple-touch-icon.png in the root directory --><!-- <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"> --><link rel=stylesheet href=styles/vendor-22ff06bca3.css><link rel=stylesheet href=styles/app-5fc73ce08b.css></head><body><!--[if lt IE 10]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]--><div ui-view></div><script src=scripts/vendor-2626f58019.js></script><script src=scripts/app-2de02be62b.js></script><script src=report.js></script></body></html>
1 change: 1 addition & 0 deletions REPORTS/maps/scripts/app-2de02be62b.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions REPORTS/maps/scripts/vendor-2626f58019.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 4793f5e

Please sign in to comment.