Ifd_Automation 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 995b5ae7420fd3abce3f9bc630803e8e7648836c
4
- data.tar.gz: d7b5fb6447e98be473b8495fcf65de1d4e6c1e8e
3
+ metadata.gz: 02b3396972906d65e77320ff4f338b76e0434f15
4
+ data.tar.gz: 6450a44374d9d072716f2b4da8145454db222f59
5
5
  SHA512:
6
- metadata.gz: bd71305aac93b9001fe249c0ad7b6758fcde4a2ec34ef8f5745a5a7bcdf21a22abb35ab1df84ebce724cec2e9e31572d59564a5f44731c99a5842c9979ce546f
7
- data.tar.gz: 456812c04845fc6bb03366299160554e161bb71c2d31afebce1527f88d0934a29ff8d988c6e1787cc8a011385cbca3359ddcc85738b96ef268401011cc368cd5
6
+ metadata.gz: 3820ff73502029e0b6c44faadcbfcc5d73cbe960ca2b1dc19ba618541a2c435ab815fb43bf52bdacfe7b5c4df2eb4e791b81bf6a6b31279c597f07fb2e0d708b
7
+ data.tar.gz: 486ca4e8a28858777bf515de9956bd358601b535cae8b6b235bcefa2fd39911f5b2877dde9955ee22f92267cd8344514cb4188655f53e17704402a4301ce5cfc
data/bin/Ifd_Automation CHANGED
@@ -1,25 +1,25 @@
1
- #!/usr/bin/env ruby
2
-
3
- require_relative 'helper.rb'
4
- require_relative 'generate.rb'
5
- require 'Ifd_Automation/version'
6
-
7
- @features_dir = File.join(FileUtils.pwd, "project")
8
- @source_dir = File.join(File.dirname(__FILE__), '..', 'project')
9
-
10
- if (ARGV.length == 0)
11
- print_usage
12
- else
13
- cmd = ARGV.shift
14
-
15
- if cmd == "help"
16
- print_help
17
- elsif cmd == "gen"
18
- ifd_automation_scaffold
19
- elsif cmd == "version"
20
- puts Ifd::Automation::VERSION
21
- else
22
- print_usage
23
- end
24
- end
25
-
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative 'helper.rb'
4
+ require_relative 'generate.rb'
5
+ require 'Ifd_Automation/version'
6
+
7
+ @features_dir = File.join(FileUtils.pwd, "project")
8
+ @source_dir = File.join(File.dirname(__FILE__), '..', 'project')
9
+
10
+ if (ARGV.length == 0)
11
+ print_usage
12
+ else
13
+ cmd = ARGV.shift
14
+
15
+ if cmd == "help"
16
+ print_help
17
+ elsif cmd == "gen"
18
+ ifd_automation_scaffold
19
+ elsif cmd == "version"
20
+ puts Ifd::Automation::VERSION
21
+ else
22
+ print_usage
23
+ end
24
+ end
25
+
data/bin/helper.rb CHANGED
@@ -1,51 +1,51 @@
1
- require 'tempfile'
2
- require 'json'
3
- require "rubygems"
4
-
5
- def msg(title, &block)
6
- puts "\n" + "-"*10 + title + "-"*10
7
- block.call
8
- puts "-"*10 + "-------" + "-"*10 + "\n"
9
- end
10
-
11
- def print_usage
12
- puts <<EOF
13
-
14
- Usage: Ifd_Automation <command-name> [parameters] [options]
15
-
16
- <command-name> can be one of
17
- help
18
- prints more detailed help information.
19
- gen
20
- generate a features folder structure.
21
- version
22
- prints the gem version
23
-
24
- <options> can be
25
- -v, --verbose Turns on verbose logging
26
- EOF
27
- end
28
-
29
- def print_help
30
- puts <<EOF
31
-
32
- Usage: Ifd_Automation <command-name> [parameters] [options]
33
-
34
- <command-name> can be one of
35
- help
36
- gen
37
- version
38
-
39
- Commands:
40
- help : prints more detailed help information.
41
-
42
- gen : creates a features dir. This is usually used once when
43
- setting up ifd-automation to ensure that the features folder contains
44
- the right step definitions and environment to run with cucumber.
45
-
46
- version : prints the gem version
47
-
48
- <Options>
49
- -v, --verbose Turns on verbose logging
50
- EOF
1
+ require 'tempfile'
2
+ require 'json'
3
+ require "rubygems"
4
+
5
+ def msg(title, &block)
6
+ puts "\n" + "-"*10 + title + "-"*10
7
+ block.call
8
+ puts "-"*10 + "-------" + "-"*10 + "\n"
9
+ end
10
+
11
+ def print_usage
12
+ puts <<EOF
13
+
14
+ Usage: Ifd_Automation <command-name> [parameters] [options]
15
+
16
+ <command-name> can be one of
17
+ help
18
+ prints more detailed help information.
19
+ gen
20
+ generate a features folder structure.
21
+ version
22
+ prints the gem version
23
+
24
+ <options> can be
25
+ -v, --verbose Turns on verbose logging
26
+ EOF
27
+ end
28
+
29
+ def print_help
30
+ puts <<EOF
31
+
32
+ Usage: Ifd_Automation <command-name> [parameters] [options]
33
+
34
+ <command-name> can be one of
35
+ help
36
+ gen
37
+ version
38
+
39
+ Commands:
40
+ help : prints more detailed help information.
41
+
42
+ gen : creates a features dir. This is usually used once when
43
+ setting up ifd-automation to ensure that the features folder contains
44
+ the right step definitions and environment to run with cucumber.
45
+
46
+ version : prints the gem version
47
+
48
+ <Options>
49
+ -v, --verbose Turns on verbose logging
50
+ EOF
51
51
  end
@@ -1 +1 @@
1
- Dir[File.dirname(__FILE__) + '/Ifd_Automation/*.rb'].each { |file| require file }
1
+ Dir[File.dirname(__FILE__) + '/Ifd_Automation/*.rb'].each { |file| require file }
@@ -1,96 +1,96 @@
1
- # require_relative 'methods/web_methods'
2
- require_relative 'methods/required_files'
3
- # page title checking
4
- Then(/^I should\s*((?:not)?)\s+see page title as "(.*?)"$/) do |present, title|
5
- check_title(title, present.empty?)
6
- end
7
-
8
- Then(/^I should\s*((?:not)?)\s+see page title having partial text as "(.*?)"$/) do |present, partial_text_title|
9
- check_partial_title(partial_text_title, present.empty?)
10
- end
11
-
12
- # check property for object
13
- Then /^I check property "(.*?)" with "(.*?)" has( | not)? value "(.*?)"$/ do |object, property, negate, value|
14
- value = var_collect(value)
15
- execute_checkproperty(object, property, negate, value)
16
- end
17
-
18
- Then /^the following multiline step should (fail|succeed):$/ do |expectation, multiline_step|
19
- multiline_step = multiline_step.gsub(%{'''}, %{"""})
20
- if expectation == 'fail'
21
- expect { steps(multiline_step) }.to raise_error(RSPEC_EXPECTATION_NOT_MET_ERROR)
22
- else # succeed
23
- steps(multiline_step)
24
- end
25
- end
26
-
27
- Then /^the following steps? should (fail|succeed):$/ do |expectation, steps_table|
28
- steps = steps_table.raw.flatten
29
-
30
- steps.each do |step|
31
- if expectation == 'fail'
32
- expect { step(step) }.to raise_error(RSPEC_EXPECTATION_NOT_MET_ERROR)
33
- else # succeed
34
- step(step)
35
- end
36
- end
37
- end
38
-
39
- Then /^I should see a form with the following values:$/ do |table|
40
- expectations = table.raw
41
- expectations.each do |label, expected_value|
42
- step %(I check property "#{label}" with "text" has value "#{expected_value}")
43
- end
44
- end
45
-
46
- Then /^Status of "([^\"]*)" should be "(disabled|enabled)"$/ do |element, status|
47
- puts "status: #{status} => status =='disabled': #{status =='disabled'}"
48
- foundElement = if(status =='disabled')
49
- find_object(element + "{'disabled':'true'}")
50
- elsif (status =='enabled')
51
- find_object(element + "{'disabled':''}")
52
- else
53
- puts "Error >> '#{status }' status is not support."
54
- exit
55
- end
56
-
57
- if foundElement == nil
58
- puts "Error >> Not found object..."
59
- exit
60
- end
61
- end
62
-
63
- And /^I check( not)? exists element is "(.*?)"$/ do |negate, object|
64
- #negate = negate.strip if negate != nil
65
- execute_checkexists(negate, object,2)
66
- end
67
-
68
- # step to assert checkbox is checked or unchecked
69
- Then(/^checkbox "(.*?)" should be (checked|unchecked)$/) do |element, state|
70
- flag = state == 'checked'
71
- is_checkbox_checked(element, flag)
72
- end
73
-
74
- # steps to assert radio button checked or unchecked
75
- Then(/^radio button "(.*?)" should be (selected|unselected)$/) do |element, state|
76
- flag = state == 'selected'
77
- is_radio_button_selected(element, flag)
78
- end
79
-
80
- # step to assert javascript pop-up alert text
81
- Then(/^I should see alert text as "(.*?)"$/) do |actual_value|
82
- check_alert_text(actual_value)
83
- end
84
-
85
- # step to assert difference in images
86
- Then(/^actual image having (.+) "(.*?)" and expected image having (.+) "(.*?)" should be similar$/) do |actual_img_access_type, actual_img_access_name, excp_img_access_type, excp_img_access_name|
87
- IFD_Assertion.does_images_similar?(actual_img_access_type, actual_img_access_name, excp_img_access_type, excp_img_access_name)
88
- end
89
-
90
- # step to check element enabled or not
91
- Then(/^element "([^\"]*)" should\s*((?:not)?)\s+be (enabled|disabled)$/) do |element, present, state|
92
- flag = state == 'enabled'
93
- flag = !flag unless present.empty?
94
- check_element_enable(element, flag)
95
- end
96
-
1
+ # require_relative 'methods/web_methods'
2
+ require_relative 'methods/required_files'
3
+ # page title checking
4
+ Then(/^I should\s*((?:not)?)\s+see page title as "(.*?)"$/) do |present, title|
5
+ check_title(title, present.empty?)
6
+ end
7
+
8
+ Then(/^I should\s*((?:not)?)\s+see page title having partial text as "(.*?)"$/) do |present, partial_text_title|
9
+ check_partial_title(partial_text_title, present.empty?)
10
+ end
11
+
12
+ # check property for object
13
+ Then /^I check property "(.*?)" with "(.*?)" has( | not)? value "(.*?)"$/ do |object, property, negate, value|
14
+ value = var_collect(value)
15
+ execute_checkproperty(object, property, negate, value)
16
+ end
17
+
18
+ Then /^the following multiline step should (fail|succeed):$/ do |expectation, multiline_step|
19
+ multiline_step = multiline_step.gsub(%{'''}, %{"""})
20
+ if expectation == 'fail'
21
+ expect { steps(multiline_step) }.to raise_error(RSPEC_EXPECTATION_NOT_MET_ERROR)
22
+ else # succeed
23
+ steps(multiline_step)
24
+ end
25
+ end
26
+
27
+ Then /^the following steps? should (fail|succeed):$/ do |expectation, steps_table|
28
+ steps = steps_table.raw.flatten
29
+
30
+ steps.each do |step|
31
+ if expectation == 'fail'
32
+ expect { step(step) }.to raise_error(RSPEC_EXPECTATION_NOT_MET_ERROR)
33
+ else # succeed
34
+ step(step)
35
+ end
36
+ end
37
+ end
38
+
39
+ Then /^I should see a form with the following values:$/ do |table|
40
+ expectations = table.raw
41
+ expectations.each do |label, expected_value|
42
+ step %(I check property "#{label}" with "text" has value "#{expected_value}")
43
+ end
44
+ end
45
+
46
+ Then /^Status of "([^\"]*)" should be "(disabled|enabled)"$/ do |element, status|
47
+ puts "status: #{status} => status =='disabled': #{status =='disabled'}"
48
+ foundElement = if(status =='disabled')
49
+ find_object(element + "{'disabled':'true'}")
50
+ elsif (status =='enabled')
51
+ find_object(element + "{'disabled':''}")
52
+ else
53
+ puts "Error >> '#{status }' status is not support."
54
+ exit
55
+ end
56
+
57
+ if foundElement == nil
58
+ puts "Error >> Not found object..."
59
+ exit
60
+ end
61
+ end
62
+
63
+ And /^I check( not)? exists element is "(.*?)"$/ do |negate, object|
64
+ #negate = negate.strip if negate != nil
65
+ execute_checkexists(negate, object,2)
66
+ end
67
+
68
+ # step to assert checkbox is checked or unchecked
69
+ Then(/^checkbox "(.*?)" should be (checked|unchecked)$/) do |element, state|
70
+ flag = state == 'checked'
71
+ is_checkbox_checked(element, flag)
72
+ end
73
+
74
+ # steps to assert radio button checked or unchecked
75
+ Then(/^radio button "(.*?)" should be (selected|unselected)$/) do |element, state|
76
+ flag = state == 'selected'
77
+ is_radio_button_selected(element, flag)
78
+ end
79
+
80
+ # step to assert javascript pop-up alert text
81
+ Then(/^I should see alert text as "(.*?)"$/) do |actual_value|
82
+ check_alert_text(actual_value)
83
+ end
84
+
85
+ # step to assert difference in images
86
+ Then(/^actual image having (.+) "(.*?)" and expected image having (.+) "(.*?)" should be similar$/) do |actual_img_access_type, actual_img_access_name, excp_img_access_type, excp_img_access_name|
87
+ IFD_Assertion.does_images_similar?(actual_img_access_type, actual_img_access_name, excp_img_access_type, excp_img_access_name)
88
+ end
89
+
90
+ # step to check element enabled or not
91
+ Then(/^element "([^\"]*)" should\s*((?:not)?)\s+be (enabled|disabled)$/) do |element, present, state|
92
+ flag = state == 'enabled'
93
+ flag = !flag unless present.empty?
94
+ check_element_enable(element, flag)
95
+ end
96
+
@@ -1,91 +1,91 @@
1
- require 'mail'
2
- require_relative 'methods/required_files'
3
- # Before do
4
- # ActionMailer::Base.deliveries.clear
5
- # end
6
-
7
- Then /^I send the email to "(.*)" with subject is "(.*)" and email body in "(.*)" file$/ do |to_address, subject, file|
8
- data_file = File.read($test_data_dir + file)
9
- filepath = ($test_data_dir + file)
10
- body_email = data_file.force_encoding('UTF-8').encode('UTF-16', :invalid => :replace, :replace => "'").encode('UTF-8')
11
- if File.exist?(filepath)
12
- IFD_Email.send_email(to_address, subject, body_email)
13
- end
14
- end
15
- Then /^I send the email to "(.*)" with subject is "(.*)" and email body "(.*)"$/ do |to_address, subject, email_body|
16
- email_body = email_body.force_encoding('UTF-8').encode('UTF-16', :invalid => :replace, :replace => "'").encode('UTF-8')
17
- IFD_Email.send_email(to_address, subject, email_body)
18
- end
19
-
20
- Then /^I should receive the email from "(.*)" with subject "(.*)"$/ do |email_from, email_subject|
21
- sleep 5
22
- emails = Mail.find(:what => :last, :count => 1)
23
- if emails.instance_of? Mail::Message
24
- # puts emails.from[0].to_s
25
- IFD_Assertion.assert_string_equal(email_from, emails.from[0].to_s)
26
- IFD_Assertion.assert_string_equal(email_subject, emails.subject)
27
- else
28
- raise "WARNING: *** No new Email is found"
29
- end
30
- end
31
-
32
- Then /^I should receive the mail from "(.*)" with Email content has following value:$/ do |email_from, email_content|
33
- sleep 5
34
- emails = Mail.find(:what => :last, :count => 1)
35
- if emails.instance_of? Mail::Message
36
- IFD_Assertion.assert_string_equal(email_from, emails.from[0].to_s)
37
- email_content.raw[0].each do |line|
38
- assert(true) if emails.body.should include(line.strip)
39
- end
40
- else
41
- raise "WARNING: *** No new Email is found"
42
- end
43
- end
44
-
45
- Then /^I should receive the mail from "(.*)" with subject "(.*)" and Email content has following value:$/ do |email_from,email_subject, email_content|
46
- sleep 5
47
- emails = Mail.find(:what => :last, :count => 1)
48
- if emails.instance_of? Mail::Message
49
- IFD_Assertion.assert_string_equal(email_from, emails.from[0].to_s)
50
- IFD_Assertion.assert_string_equal(email_subject, emails.subject)
51
- email_content.raw[0].each do |line|
52
- assert(true) if emails.body.should include(line.strip)
53
- end
54
- else
55
- raise "WARNING: *** No new Email is found"
56
- end
57
- end
58
- #
59
- # Then /^I send the email to "(.*)" with subject is "(.*)" and email body template in "(.*)" file and following conditions:$/ do |to_address, subject, file, data_table|
60
- # data_file = File.read($test_data_dir + file)
61
- # filepath = ($test_data_dir + file)
62
- # body_email = data_file.force_encoding('UTF-8').encode('UTF-16', :invalid => :replace, :replace => "'").encode('UTF-8')
63
- # if File.exist?(filepath)
64
- # raw_data = JSON.parse(JSON.generate(data_table))
65
- # header = raw_data[0]
66
- # value = raw_data[1]
67
- # $test = String.new
68
- # $i = 0
69
- # body_email.each_line do |lines|
70
- # header.zip(value).each do |headers, values|
71
- # group1, group2, group3= lines.match(/(^.*)(:)(.*)/i).try(:captures)
72
- # if headers == group1 && group1.size > 0
73
- # $new_value = lines.gsub(group3, " #{values}")
74
- # $test += "#{$new_value}"
75
- # $i = 1
76
- # break
77
- # elsif headers == "taaknummer"
78
- # $new_value = lines.gsub("[TASKID]", " #{values}")
79
- # $test += "#{$new_value}"
80
- # $i = 1
81
- # else
82
- # $i = 0
83
- # end
84
- # end
85
- # if $i == 0
86
- # $test += "#{lines}"
87
- # end
88
- # end
89
- # IFD_Email.send_email(to_address, subject, $test)
90
- # end
91
- # end
1
+ require 'mail'
2
+ require_relative 'methods/required_files'
3
+ # Before do
4
+ # ActionMailer::Base.deliveries.clear
5
+ # end
6
+
7
+ Then /^I send the email to "(.*)" with subject is "(.*)" and email body in "(.*)" file$/ do |to_address, subject, file|
8
+ data_file = File.read($test_data_dir + file)
9
+ filepath = ($test_data_dir + file)
10
+ body_email = data_file.force_encoding('UTF-8').encode('UTF-16', :invalid => :replace, :replace => "'").encode('UTF-8')
11
+ if File.exist?(filepath)
12
+ IFD_Email.send_email(to_address, subject, body_email)
13
+ end
14
+ end
15
+ Then /^I send the email to "(.*)" with subject is "(.*)" and email body "(.*)"$/ do |to_address, subject, email_body|
16
+ email_body = email_body.force_encoding('UTF-8').encode('UTF-16', :invalid => :replace, :replace => "'").encode('UTF-8')
17
+ IFD_Email.send_email(to_address, subject, email_body)
18
+ end
19
+
20
+ Then /^I should receive the email from "(.*)" with subject "(.*)"$/ do |email_from, email_subject|
21
+ sleep 5
22
+ emails = Mail.find(:what => :last, :count => 1)
23
+ if emails.instance_of? Mail::Message
24
+ # puts emails.from[0].to_s
25
+ IFD_Assertion.assert_string_equal(email_from, emails.from[0].to_s)
26
+ IFD_Assertion.assert_string_equal(email_subject, emails.subject)
27
+ else
28
+ raise "WARNING: *** No new Email is found"
29
+ end
30
+ end
31
+
32
+ Then /^I should receive the mail from "(.*)" with Email content has following value:$/ do |email_from, email_content|
33
+ sleep 5
34
+ emails = Mail.find(:what => :last, :count => 1)
35
+ if emails.instance_of? Mail::Message
36
+ IFD_Assertion.assert_string_equal(email_from, emails.from[0].to_s)
37
+ email_content.raw[0].each do |line|
38
+ assert(true) if emails.body.should include(line.strip)
39
+ end
40
+ else
41
+ raise "WARNING: *** No new Email is found"
42
+ end
43
+ end
44
+
45
+ Then /^I should receive the mail from "(.*)" with subject "(.*)" and Email content has following value:$/ do |email_from,email_subject, email_content|
46
+ sleep 5
47
+ emails = Mail.find(:what => :last, :count => 1)
48
+ if emails.instance_of? Mail::Message
49
+ IFD_Assertion.assert_string_equal(email_from, emails.from[0].to_s)
50
+ IFD_Assertion.assert_string_equal(email_subject, emails.subject)
51
+ email_content.raw[0].each do |line|
52
+ assert(true) if emails.body.should include(line.strip)
53
+ end
54
+ else
55
+ raise "WARNING: *** No new Email is found"
56
+ end
57
+ end
58
+ #
59
+ # Then /^I send the email to "(.*)" with subject is "(.*)" and email body template in "(.*)" file and following conditions:$/ do |to_address, subject, file, data_table|
60
+ # data_file = File.read($test_data_dir + file)
61
+ # filepath = ($test_data_dir + file)
62
+ # body_email = data_file.force_encoding('UTF-8').encode('UTF-16', :invalid => :replace, :replace => "'").encode('UTF-8')
63
+ # if File.exist?(filepath)
64
+ # raw_data = JSON.parse(JSON.generate(data_table))
65
+ # header = raw_data[0]
66
+ # value = raw_data[1]
67
+ # $test = String.new
68
+ # $i = 0
69
+ # body_email.each_line do |lines|
70
+ # header.zip(value).each do |headers, values|
71
+ # group1, group2, group3= lines.match(/(^.*)(:)(.*)/i).try(:captures)
72
+ # if headers == group1 && group1.size > 0
73
+ # $new_value = lines.gsub(group3, " #{values}")
74
+ # $test += "#{$new_value}"
75
+ # $i = 1
76
+ # break
77
+ # elsif headers == "taaknummer"
78
+ # $new_value = lines.gsub("[TASKID]", " #{values}")
79
+ # $test += "#{$new_value}"
80
+ # $i = 1
81
+ # else
82
+ # $i = 0
83
+ # end
84
+ # end
85
+ # if $i == 0
86
+ # $test += "#{lines}"
87
+ # end
88
+ # end
89
+ # IFD_Email.send_email(to_address, subject, $test)
90
+ # end
91
+ # end