Ifd_Automation 2.6 → 2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/bin/generate.rb +21 -3
  3. data/bin/helper.rb +5 -4
  4. data/lib/Ifd_Automation/require_libs.rb +9 -6
  5. data/lib/Ifd_Automation/version.rb +1 -1
  6. data/lib/helper/{assertion_helpers.rb → assertion_helper.rb} +5 -5
  7. data/lib/helper/auto_util.rb +164 -0
  8. data/lib/helper/database_helper.rb +81 -0
  9. data/lib/helper/file_helper.rb +36 -0
  10. data/lib/helper/mail_helper.rb +58 -0
  11. data/lib/helper/rest_helper.rb +91 -0
  12. data/lib/helper/soap_helper.rb +59 -0
  13. data/lib/helper/ssh_helper.rb +39 -0
  14. data/lib/helper/web_steps_helper.rb +447 -0
  15. data/project/Dockerfile +20 -0
  16. data/project/Gemfile.lock +176 -0
  17. data/project/README.md +60 -0
  18. data/project/cucumber.yml +6 -0
  19. data/project/docker-compose.yml +7 -0
  20. data/project/features/TestData/globalData.yml +3 -1
  21. data/project/features/TestSuite/WebGUI.feature +16 -2
  22. data/project/features/step_definitions/IFD_Libraries/REST_steps.rb +34 -0
  23. data/project/features/step_definitions/IFD_Libraries/SOAP_steps.rb +38 -0
  24. data/project/features/step_definitions/IFD_Libraries/database_steps.rb +44 -0
  25. data/{lib/Ifd_Automation/dynamic_store_vavue_steps.rb → project/features/step_definitions/IFD_Libraries/dynamic_store_value_steps.rb} +8 -10
  26. data/project/features/step_definitions/IFD_Libraries/email_steps.rb +36 -0
  27. data/project/features/step_definitions/IFD_Libraries/file_steps.rb +11 -0
  28. data/project/features/step_definitions/IFD_Libraries/ssh_steps.rb +20 -0
  29. data/{lib/Ifd_Automation → project/features/step_definitions/IFD_Libraries}/web_steps.rb +18 -8
  30. data/project/features/step_definitions/lib_steps/actionwords.rb +14 -10
  31. data/project/features/step_definitions/lib_steps/steps.rb +6 -0
  32. data/project/features/step_definitions/repositories/project_object.yml +2 -6
  33. data/project/features/support/env.rb +18 -18
  34. data/project/features/support/hooks.rb +22 -59
  35. metadata +45 -17
  36. data/lib/Ifd_Automation/REST_steps.rb +0 -90
  37. data/lib/Ifd_Automation/SOAP_steps.rb +0 -68
  38. data/lib/Ifd_Automation/database_steps.rb +0 -80
  39. data/lib/Ifd_Automation/email_steps.rb +0 -72
  40. data/lib/Ifd_Automation/file_steps.rb +0 -24
  41. data/lib/Ifd_Automation/ssh_steps.rb +0 -38
  42. data/lib/helper/auto_utils.rb +0 -67
  43. data/lib/helper/connection_helpers.rb +0 -15
  44. data/lib/helper/core.rb +0 -646
  45. data/lib/helper/mail_helpers.rb +0 -17
  46. data/lib/helper/web_steps_helpers.rb +0 -176
  47. data/project/features/step_definitions/lib_steps/test.rb +0 -6
@@ -0,0 +1,20 @@
1
+ FROM ruby:2.3.1
2
+
3
+ MAINTAINER anhpham@infodation.vn
4
+ RUN apt-get -qq update
5
+ RUN mkdir /home/temp
6
+ WORKDIR /home/temp
7
+ RUN set -ex \
8
+ && wget -O freetds-1.00.21.tar.gz "http://www.freetds.org/files/stable/freetds-1.00.21.tar.gz" \
9
+ && tar -xzf freetds-1.00.21.tar.gz \
10
+ && cd freetds-1.00.21 \
11
+ && ./configure \
12
+ && make \
13
+ && make install
14
+ ENV APP_HOME /home/automation
15
+ RUN mkdir -p $APP_HOME
16
+ RUN chmod -R 777 $APP_HOME
17
+ COPY Ifd_Automation-2.7.gem $APP_HOME
18
+ WORKDIR $APP_HOME
19
+ RUN gem install Ifd_Automation-2.7.gem
20
+
@@ -0,0 +1,176 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ Ifd_Automation (2.7)
5
+ actionmailer (~> 5.1, >= 5.1.4)
6
+ activerecord (= 5.1.5)
7
+ activerecord-sqlserver-adapter (~> 5.1, >= 5.1.6)
8
+ capybara (~> 2.7, >= 2.7.1)
9
+ cucumber (~> 3.1)
10
+ httparty (~> 0.15.6)
11
+ jsonpath (~> 0.5.8)
12
+ net-ssh (~> 3.2)
13
+ parallel_tests (~> 2.7, >= 2.7.1)
14
+ rspec (~> 3.7.0, >= 3.7.0)
15
+ savon (~> 2.11, >= 2.11.1)
16
+ selenium-webdriver (~> 3.6, >= 3.6.0)
17
+ tiny_tds (~> 2.1, >= 2.1.1)
18
+ actionmailer (5.1.5)
19
+ actionpack (= 5.1.5)
20
+ actionview (= 5.1.5)
21
+ activejob (= 5.1.5)
22
+ mail (~> 2.5, >= 2.5.4)
23
+ rails-dom-testing (~> 2.0)
24
+ actionpack (5.1.5)
25
+ actionview (= 5.1.5)
26
+ activesupport (= 5.1.5)
27
+ rack (~> 2.0)
28
+ rack-test (>= 0.6.3)
29
+ rails-dom-testing (~> 2.0)
30
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
31
+ actionview (5.1.5)
32
+ activesupport (= 5.1.5)
33
+ builder (~> 3.1)
34
+ erubi (~> 1.4)
35
+ rails-dom-testing (~> 2.0)
36
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
37
+ activejob (5.1.5)
38
+ activesupport (= 5.1.5)
39
+ globalid (>= 0.3.6)
40
+ activemodel (5.1.5)
41
+ activesupport (= 5.1.5)
42
+ activerecord (5.1.5)
43
+ activemodel (= 5.1.5)
44
+ activesupport (= 5.1.5)
45
+ arel (~> 8.0)
46
+ activerecord-sqlserver-adapter (5.1.6)
47
+ activerecord (~> 5.1.0)
48
+ tiny_tds
49
+ activesupport (5.1.5)
50
+ concurrent-ruby (~> 1.0, >= 1.0.2)
51
+ i18n (~> 0.7)
52
+ minitest (~> 5.1)
53
+ tzinfo (~> 1.1)
54
+ addressable (2.5.2)
55
+ public_suffix (>= 2.0.2, < 4.0)
56
+ akami (1.3.1)
57
+ gyoku (>= 0.4.0)
58
+ nokogiri
59
+ arel (8.0.0)
60
+ backports (3.11.3)
61
+ builder (3.2.3)
62
+ capybara (2.18.0)
63
+ addressable
64
+ mini_mime (>= 0.1.3)
65
+ nokogiri (>= 1.3.3)
66
+ rack (>= 1.0.0)
67
+ rack-test (>= 0.5.4)
68
+ xpath (>= 2.0, < 4.0)
69
+ childprocess (0.9.0)
70
+ ffi (~> 1.0, >= 1.0.11)
71
+ concurrent-ruby (1.0.5)
72
+ crass (1.0.4)
73
+ cucumber (3.1.0)
74
+ builder (>= 2.1.2)
75
+ cucumber-core (~> 3.1.0)
76
+ cucumber-expressions (~> 5.0.4)
77
+ cucumber-wire (~> 0.0.1)
78
+ diff-lcs (~> 1.3)
79
+ gherkin (~> 5.0)
80
+ multi_json (>= 1.7.5, < 2.0)
81
+ multi_test (>= 0.1.2)
82
+ cucumber-core (3.1.0)
83
+ backports (>= 3.8.0)
84
+ cucumber-tag_expressions (~> 1.1.0)
85
+ gherkin (>= 5.0.0)
86
+ cucumber-expressions (5.0.17)
87
+ cucumber-tag_expressions (1.1.1)
88
+ cucumber-wire (0.0.1)
89
+ diff-lcs (1.3)
90
+ erubi (1.7.1)
91
+ ffi (1.9.23)
92
+ gherkin (5.0.0)
93
+ globalid (0.4.1)
94
+ activesupport (>= 4.2.0)
95
+ gyoku (1.3.1)
96
+ builder (>= 2.1.2)
97
+ httparty (0.15.7)
98
+ multi_xml (>= 0.5.2)
99
+ httpi (2.4.3)
100
+ rack
101
+ socksify
102
+ i18n (0.9.5)
103
+ concurrent-ruby (~> 1.0)
104
+ jsonpath (0.5.8)
105
+ multi_json
106
+ loofah (2.2.2)
107
+ crass (~> 1.0.2)
108
+ nokogiri (>= 1.5.9)
109
+ mail (2.7.0)
110
+ mini_mime (>= 0.1.1)
111
+ mini_mime (1.0.0)
112
+ mini_portile2 (2.3.0)
113
+ minitest (5.8.3)
114
+ multi_json (1.13.1)
115
+ multi_test (0.1.2)
116
+ multi_xml (0.6.0)
117
+ net-ssh (3.2.0)
118
+ nokogiri (1.8.2)
119
+ mini_portile2 (~> 2.3.0)
120
+ nori (2.6.0)
121
+ parallel (1.12.1)
122
+ parallel_tests (2.21.3)
123
+ parallel
124
+ public_suffix (3.0.2)
125
+ rack (2.0.4)
126
+ rack-test (1.0.0)
127
+ rack (>= 1.0, < 3)
128
+ rails-dom-testing (2.0.3)
129
+ activesupport (>= 4.2.0)
130
+ nokogiri (>= 1.6)
131
+ rails-html-sanitizer (1.0.4)
132
+ loofah (~> 2.2, >= 2.2.2)
133
+ rspec (3.7.0)
134
+ rspec-core (~> 3.7.0)
135
+ rspec-expectations (~> 3.7.0)
136
+ rspec-mocks (~> 3.7.0)
137
+ rspec-core (3.7.1)
138
+ rspec-support (~> 3.7.0)
139
+ rspec-expectations (3.7.0)
140
+ diff-lcs (>= 1.2.0, < 2.0)
141
+ rspec-support (~> 3.7.0)
142
+ rspec-mocks (3.7.0)
143
+ diff-lcs (>= 1.2.0, < 2.0)
144
+ rspec-support (~> 3.7.0)
145
+ rspec-support (3.7.1)
146
+ rubyzip (1.2.1)
147
+ savon (2.12.0)
148
+ akami (~> 1.2)
149
+ builder (>= 2.1.2)
150
+ gyoku (~> 1.2)
151
+ httpi (~> 2.3)
152
+ nokogiri (>= 1.8.1)
153
+ nori (~> 2.4)
154
+ wasabi (~> 3.4)
155
+ selenium-webdriver (3.11.0)
156
+ childprocess (~> 0.5)
157
+ rubyzip (~> 1.2)
158
+ socksify (1.7.1)
159
+ thread_safe (0.3.6)
160
+ tiny_tds (2.1.1)
161
+ tzinfo (1.2.5)
162
+ thread_safe (~> 0.1)
163
+ wasabi (3.5.0)
164
+ httpi (~> 2.0)
165
+ nokogiri (>= 1.4.2)
166
+ xpath (3.0.0)
167
+ nokogiri (~> 1.8)
168
+
169
+ PLATFORMS
170
+ ruby
171
+
172
+ DEPENDENCIES
173
+ Ifd_Automation
174
+
175
+ BUNDLED WITH
176
+ 1.13.6
@@ -0,0 +1,60 @@
1
+ ###Ifd_Automation gem
2
+ Ifd_Automation is an open-source tool for automating GUI, RESTful, SOAP, Database and eMail.
3
+ Importantly, Ifd_Automation is "cross-platform": it allows you to write tests against multiple platforms (Linux, Windows, MacOS) on multiple browsers (chrome, firefox ...) using the same API.
4
+
5
+ ###Getting Started
6
+ These instructions will get you a copy of the project up and running on your local machine for testing purposes. See deployment for notes on how to install Ifd_Automation gem
7
+ ###Prerequisites
8
+ - Ruby: 2.3+
9
+ ###Installing
10
+ `$ gem install Ifd_Automation`
11
+ System automatically fetch all relate automation libraries after install Ifd_Automation gem
12
+ ###Setup
13
+ `$ Ifd_Automation gen`
14
+ This command help to create a set folder structure which followed the format of BDD Cucumber and Ifd_Automation.
15
+ The folder structure will be like this:
16
+ ![](https://github.com/anhpham2710/automation/blob/master/Ifd_Automation_structure.jpg?raw=true)
17
+
18
+ ###Structure folder format
19
+ - Screenshot folder
20
+ Once your scenario failed, the screen will be captured and saved to this folder
21
+
22
+ - TestData folder
23
+ By default, the steps which relate to test data will be read/created from this folder.
24
+ - globalData.yml file ( This file will store all your global data as parameter, in order to use param value, just use the format **params='params_name' ** in your steps.
25
+
26
+ - TestSuite folder
27
+ Place to store user's feature files.
28
+
29
+ - Step_definitions folder
30
+ - IFD_Libraries (contains custom Ifd_Automation steps)
31
+ - lib_steps
32
+ - actionword.rb
33
+ - steps.rb
34
+ two file help to create user custom steps
35
+ - repositories
36
+ - project_object.yml (all web objects will store in this file)
37
+ - support
38
+ - env.rb
39
+ - hook.rb
40
+ ###Usage
41
+ ####Available steps
42
+ All available steps are located at IFD_Libaries folder, below are instructions show how to use these libraries
43
+
44
+ ----
45
+ #####web steps
46
+ 1. Open browser and navigate to the page test page. The page address can be insert directly into step or using dynamic
47
+ `Given I am on the "page_url" page`
48
+ #####example
49
+ - `Given I am on the "http://google.com" page`
50
+ - `Given I am on the "params='test_page'" page`
51
+
52
+ 2. Wait for number of seconds before doing the next step
53
+ `And I wait for <number> seconds`
54
+ #####example
55
+ `And I wait for 5 seconds`
56
+ 3. Click on an element
57
+ `And I click on "string"`
58
+ #####example
59
+ `And I click on "button_login"`
60
+
@@ -0,0 +1,6 @@
1
+ default: --no-source
2
+ <% remote = "SELENIUM=remote" %>
3
+ remote_chrome: BROWSER=chrome <%= remote %>
4
+ remote_firefox: BROWSER=firefox <%= remote %>
5
+ junit_report: -f progress -f junit -o Report
6
+ html_report: -f progress -f html -o Report
@@ -0,0 +1,7 @@
1
+ version: '2'
2
+ services:
3
+ automation:
4
+ build: .
5
+ command: tail -F anything
6
+ volumes:
7
+ - ./:/home/automation
@@ -1,4 +1,6 @@
1
- testpage: https://mymupgrade.infodation.com/?lang=en
1
+ login_page: http://10.5.1.200:6368/login
2
+ login_user: user
3
+ login_pass: 123456
2
4
  send_email_username:
3
5
  send_email_password:
4
6
  receive_email_username:
@@ -1,4 +1,18 @@
1
- Feature: Example feature for GUI testing
1
+ Feature: Example feature for GUI testingz
2
2
 
3
3
  Scenario: testing case for web interaction
4
- Given I login to the system with user and pass "https://mymupgrade.infodation.com/?lang=en" "test" "test"
4
+ # Given I am on the "params='login_page'" page
5
+ * I store string "test_code" as "$test"
6
+ * I create xml file and store as string "$xml_soap":
7
+ """
8
+ <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
9
+ <soap:Body>
10
+ <UpdateSecret xmlns="urn:thesecretserver.com">
11
+ <token><%= $test %></token>
12
+ <secret></secret>
13
+ </UpdateSecret>
14
+ </soap:Body>
15
+ </soap:Envelope>
16
+ """
17
+ * I print the value of "$xml_soap"
18
+ * I send SOAP request with operation name "test_operation" and xml data "$xml_soap"
@@ -0,0 +1,34 @@
1
+ require 'httparty'
2
+ require 'jsonpath'
3
+
4
+ Given /^I set headers:$/ do |data|
5
+ IFD_Rest.set_headers(data)
6
+ end
7
+
8
+ When /^I send a REST (GET|PUT|POST|DELETE) request (?:for|to) "([^"]*)"(?: with the following:)?$/ do |*args|
9
+ IFD_Rest.send_request(*args)
10
+ end
11
+
12
+ Then /^I store the REST result at node "(.*)" as "(.*)"$/ do |json_path, var_name|
13
+ IFD_Rest.store_json_node_result(json_path, var_name)
14
+ end
15
+
16
+ When /^I print the result of REST request$/ do
17
+ IFD_Rest.print_rest_code
18
+ IFD_Rest.get_rest_body
19
+ end
20
+
21
+ Then /^I should see REST response code "([^"]*)"$/ do |code|
22
+ IFD_Rest.verify_rest_response_code(code)
23
+ end
24
+
25
+ Then /^the JSON response should be:$/ do |json|
26
+ IFD_Rest.verify_response_body_with_json(json)
27
+ end
28
+
29
+ # Example
30
+ # Then the JSON response at node "$..id" should have "1"
31
+ Then /^the JSON response at node "(.*)" should have "(.*)"$/ do |json_path, expected|
32
+ IFD_Rest.verify_response_at_json_node(json_path, expected)
33
+ end
34
+
@@ -0,0 +1,38 @@
1
+ require 'savon'
2
+ require 'jsonpath'
3
+
4
+ # Example
5
+ # When I get SOAP operations list from 'http://ws.cdyne.com/emailverify/Emailvernotestemail.asmx?wsdl'
6
+ When /^I get SOAP operations list from '(.*?)'$/ do |url|
7
+ IFD_Soap.get_soap_operation_list(url)
8
+ end
9
+
10
+ # Example
11
+ # When I send SOAP request with operation name "verify_email" and XML file "soap.xml"
12
+ When /^I send SOAP request with operation name "(.*)" and XML file "(.*)"$/ do |operation_name, file_name|
13
+ IFD_Soap.send_soap_with_operation_and_xml(operation_name, file_name)
14
+ end
15
+
16
+ # Example
17
+ # I send SOAP request with operation name "xr" and following data:
18
+ # """
19
+ # Sample XML
20
+ # """
21
+ When /^I send SOAP request with operation name "(.*)" and xml data "(.*)"$/ do |operation_name, xml|
22
+ IFD_Soap.send_soap_with_operation_and_data(operation_name, xml)
23
+ end
24
+
25
+ Then /^the status code should be "(.*)"$/ do |status_code|
26
+ IFD_Soap.verify_response_code(status_code)
27
+ end
28
+
29
+ # Example
30
+ # Then the SOAP response node should have "$..response_text" with text "Email Domain Not Found"
31
+ Then /^the SOAP response node should have "(.*?)" with text "(.*?)"$/ do |json_path, text|
32
+ IFD_Soap.verify_response_with_json_node(json_path, text)
33
+ end
34
+
35
+ Then /^I print the SOAP response$/ do
36
+ IFD_Soap.print_response
37
+ end
38
+
@@ -0,0 +1,44 @@
1
+ Given /^I create connection to database with:$/ do |data|
2
+ IFD_DBConnection.create_database_connection(data)
3
+ end
4
+
5
+ When /^I close SQL connection$/ do
6
+ IFD_DBConnection.close_database_connection
7
+ end
8
+
9
+ And /^I run sql script:$/ do |raw_data|
10
+ IFD_DBConnection.execute_script(raw_data)
11
+ end
12
+
13
+ And /^I run sql select query script:$/ do |raw_data|
14
+ IFD_DBConnection.execute_select(raw_data)
15
+ end
16
+
17
+ # Example
18
+ # When I run sql script "select * from users where email=#{id}"
19
+ And /^I run sql script "(.*)"$/ do |sql|
20
+ IFD_DBConnection.execute_script(sql)
21
+ end
22
+
23
+ Then /^show me the result of SQL statement$/ do
24
+ IFD_DBConnection.print_sql_result
25
+ end
26
+
27
+ # Example
28
+ # Then the result of SQL statement should be:
29
+ # """
30
+ # {"name": "quoc anh", "email": "anhpq.info@gmail.com"}
31
+ # """
32
+ Then /^the result of SQL statement should be:$/ do |json|
33
+ IFD_DBConnection.verify_sql_result_with_json(json)
34
+ end
35
+
36
+ # Example
37
+ # Then the result of SQL statement should have "email" with value "anhpq.info@gmail.com"
38
+ Then /^the result of SQL statement should have "(.*)" with value "(.*)"$/ do |json_path, value|
39
+ IFD_DBConnection.verify_sql_result_with_json_node(json_path,value)
40
+ end
41
+
42
+ When /^I store the result of SQL script as "(.*?)"$/ do |var_name|
43
+ IFD_DBConnection.store_sql_result_into_string(var_name)
44
+ end
@@ -2,24 +2,22 @@ $result = nil
2
2
  $context_value = nil
3
3
 
4
4
  Given /^I get text on "(.*)" then store it as "(.*)"$/ do |object, temp|
5
- text = execute_gettext(object)
6
- txt = "'" + text + "'"
7
- set_var(temp, txt)
5
+ get_object_and_store_as_string(object,temp)
8
6
  end
9
7
 
10
8
  When /^I store string "(.*?)" as "(.*?)"$/ do |str, var_name|
11
- $context_value = bind_with_dyn_vars(str)
12
- set_var(var_name, '$context_value')
9
+ Utils.store_string_as_variable(str,var_name)
13
10
  end
14
11
 
15
12
  Given /^I print the value of "(.*)"$/ do |temp|
16
- puts "VALUE OF #{temp}: #{eval_with_dyn_vars(temp)}"
13
+ Utils.print_variable(temp)
17
14
  end
18
15
 
19
16
  # get text for object
20
17
  And /^I get text on "(.*?)" then store it into file "(.*)"$/ do |object, file_name|
21
- $text = execute_gettext(object)
22
- open($test_data_dir+file_name, 'a+') do |f|
23
- f << $text + "\n"
24
- end
18
+ get_object_and_store_to_file(object,file_name)
19
+ end
20
+
21
+ When /^I create xml file and store as string "(.*)":$/ do |var_name, xml|
22
+ Utils.store_string_as_variable(xml,var_name)
25
23
  end