selenium-cucumber 2.1.3 → 2.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/doc/canned_steps.md +13 -8
  3. data/example/android/android_app/HinduCalendar.zip +0 -0
  4. data/example/android/android_app/HinduCalendar/HinduCalendar.apk +0 -0
  5. data/example/android/android_app/HinduCalendar/README.md +19 -0
  6. data/example/android/android_app/HinduCalendar/Results.html +472 -0
  7. data/example/android/android_app/HinduCalendar/features/01_HC_homepage_menu_validation.feature +36 -0
  8. data/example/android/android_app/HinduCalendar/features/02_HC_homepage_menu_navigation.feature +71 -0
  9. data/example/android/android_app/HinduCalendar/features/03_HC_Create_Save_View_Delete_Kundali.feature +63 -0
  10. data/example/android/android_app/HinduCalendar/features/actual_images/test.png +0 -0
  11. data/example/android/android_app/HinduCalendar/features/expected_images/test.png +0 -0
  12. data/example/android/android_app/HinduCalendar/features/image_difference/test.png +0 -0
  13. data/example/android/android_app/HinduCalendar/features/my_first.feature +1 -0
  14. data/example/android/android_app/HinduCalendar/features/screenshots/test.png +0 -0
  15. data/example/android/android_app/HinduCalendar/features/step_definitions/01_HC_homepage_menu_validation.rb +81 -0
  16. data/example/android/android_app/HinduCalendar/features/step_definitions/02_HC_homepage_menu_navigation.rb +132 -0
  17. data/example/android/android_app/HinduCalendar/features/step_definitions/03_HC_Create_Save_View_Delete_Kundali.rb +413 -0
  18. data/example/android/android_app/HinduCalendar/features/step_definitions/custom_steps.rb +5 -0
  19. data/example/android/android_app/HinduCalendar/features/support/env.rb +51 -0
  20. data/example/android/android_app/HinduCalendar/features/support/hooks.rb +38 -0
  21. data/example/android/android_app/android_app_calculator.zip +0 -0
  22. data/example/android/android_app/android_app_calculator/AndroidCalculator.apk +0 -0
  23. data/example/android/android_app/android_app_calculator/features/actual_images/test.png +0 -0
  24. data/example/android/android_app/android_app_calculator/features/calculator.feature +36 -0
  25. data/example/android/android_app/android_app_calculator/features/expected_images/test.png +0 -0
  26. data/example/android/android_app/android_app_calculator/features/image_difference/test.png +0 -0
  27. data/example/android/android_app/android_app_calculator/features/my_first.feature +13 -0
  28. data/example/android/android_app/android_app_calculator/features/screenshots/test.png +0 -0
  29. data/example/android/android_app/android_app_calculator/features/step_definitions/custom_steps.rb +5 -0
  30. data/example/android/android_app/android_app_calculator/features/support/env.rb +51 -0
  31. data/example/android/android_app/android_app_calculator/features/support/hooks.rb +38 -0
  32. data/example/android/android_web/android_web_gmail_login.zip +0 -0
  33. data/example/android/android_web/android_web_gmail_login/features/actual_images/test.png +0 -0
  34. data/example/android/android_web/android_web_gmail_login/features/expected_images/test.png +0 -0
  35. data/example/android/android_web/android_web_gmail_login/features/gmail_login.feature +12 -0
  36. data/example/android/android_web/android_web_gmail_login/features/image_difference/test.png +0 -0
  37. data/example/android/android_web/android_web_gmail_login/features/my_first.feature +1 -0
  38. data/example/android/android_web/android_web_gmail_login/features/screenshots/test.png +0 -0
  39. data/example/android/android_web/android_web_gmail_login/features/step_definitions/custom_steps.rb +5 -0
  40. data/example/android/android_web/android_web_gmail_login/features/support/env.rb +51 -0
  41. data/example/android/android_web/android_web_gmail_login/features/support/hooks.rb +38 -0
  42. data/example/desktop web/desktop_web_gmail_login.zip +0 -0
  43. data/example/desktop web/desktop_web_gmail_login/features/actual_images/test.png +0 -0
  44. data/example/desktop web/desktop_web_gmail_login/features/expected_images/test.png +0 -0
  45. data/example/desktop web/desktop_web_gmail_login/features/gmail_login.feature +10 -0
  46. data/example/desktop web/desktop_web_gmail_login/features/gmail_multi_login.feature +22 -0
  47. data/example/desktop web/desktop_web_gmail_login/features/image_difference/test.png +0 -0
  48. data/example/desktop web/desktop_web_gmail_login/features/my_first.feature +1 -0
  49. data/example/desktop web/desktop_web_gmail_login/features/result.html b/data/example/desktop → web/desktop_web_gmail_login/features/result.html +0 -0
  50. data/example/desktop web/desktop_web_gmail_login/features/screenshots/test.png +0 -0
  51. data/example/desktop web/desktop_web_gmail_login/features/step_definitions/custom_steps.rb +5 -0
  52. data/example/desktop web/desktop_web_gmail_login/features/support/env.rb +51 -0
  53. data/example/desktop web/desktop_web_gmail_login/features/support/hooks.rb +38 -0
  54. data/example/desktop web/desktop_web_gmail_login/result.html +478 -0
  55. data/lib/selenium-cucumber/methods/assertion_methods.rb +15 -15
  56. data/lib/selenium-cucumber/methods/configuration_methods.rb +1 -1
  57. data/lib/selenium-cucumber/version.rb +1 -1
  58. metadata +71 -43
@@ -0,0 +1,36 @@
1
+ Feature: Verify homepage elements
2
+
3
+ Scenario: As a tester I want to verify all 10 menus with name from home page
4
+ Given I am on home page of Hindu Calender
5
+ Then I should see Month View option
6
+ Then I should see Panchang option
7
+ Then I should see Kundli option
8
+ Then I should see Jyotish option
9
+ Then I should see Festivals option
10
+ Then I should see My Tithi option
11
+ Then I should see Settings option
12
+ Then I should see Info option
13
+ Then I should see About option
14
+ Then I should see Feedback option
15
+
16
+ Scenario: Verify Header menus
17
+ Then I should see Hambergur menu
18
+ Then I should see Swistik image
19
+ Then I should see Hindu Calender text
20
+ Then I should see Settings option image
21
+
22
+ Scenario: Tap on Hambergur menu and verify options
23
+ When I tap on Hambergur menu
24
+ Then I should see left menu overlay
25
+ Then I should see Month View option
26
+ Then I should see Panchang option
27
+ Then I should see Kundali option
28
+ Then I should see Jyotish option
29
+ Then I should see Festivals option
30
+ Then I should see My Tithi option
31
+ Then I should see Settings option
32
+ Then I should see Info option
33
+ When I tap on Hambergur menu again
34
+ Then I should not see left menu overlay
35
+
36
+
@@ -0,0 +1,71 @@
1
+ Feature: Menu Navigation From Homepage
2
+
3
+ Scenario: Tap on Month View option and verify appropriat navigation
4
+ When I tap on Month View option
5
+ Then I should get redirected to Month View page
6
+ And I should see Feativals and Events in this month text
7
+ When I press back button of device
8
+ Then I should get redirected to home page
9
+
10
+ Scenario: Tap on Panchang option and verify appropriat navigation
11
+ When I tap on Panchang option
12
+ Then I should get redirected to Panchang page
13
+ And I should see date
14
+ When I press back button of device
15
+ Then I should get redirected to home page
16
+
17
+ Scenario: Tap on Kundli option and verify appropriat navigation
18
+ When I tap on Kundli option
19
+ Then I should get redirected to Kundali page
20
+ And I should see Info text
21
+ When I press back button of device
22
+ Then I should get redirected to home page
23
+
24
+ Scenario: Tap on Jyotish option and verify appropriat navigation
25
+ When I tap on Jyotish option
26
+ Then I should get redirected to Jyotish page
27
+ And I should see Muhurt text
28
+ When I press back button of device
29
+ Then I should get redirected to home page
30
+
31
+ Scenario: Tap on Festivals option and verify appropriat navigation
32
+ When I tap on Festivals option
33
+ Then I should get redirected to Festivals page
34
+ And I should see Gudi Padwa text
35
+ When I press back button of device
36
+ Then I should get redirected to home page
37
+
38
+ Scenario: Tap on My Tithi option and verify appropriat navigation
39
+ When I tap on My Tithi option
40
+ Then I should get redirected to My Tithi page
41
+ And I should see Save My Tithi button
42
+ When I press back button of device
43
+ Then I should get redirected to home page
44
+
45
+ Scenario: Tap on Settings option and verify appropriat navigation
46
+ When I tap on Settings option
47
+ Then I should get redirected to Settings page
48
+ And I should see Save Settings button
49
+ When I press back button of device
50
+ Then I should get redirected to home page
51
+
52
+ Scenario: Tap on Info option and verify appropriat navigation
53
+ When I tap on Info option
54
+ Then I should get redirected to Info page
55
+ And I should see Hindu Calendar text on Info page
56
+ When I press back button of device
57
+ Then I should get redirected to home page
58
+
59
+ Scenario: Tap on About option and verify appropriat navigation
60
+ When I tap on About option
61
+ Then I should get redirected to About Overlay
62
+ And I should see Hindu Calendar text and OK button
63
+ When I tap on OK button of Overlay
64
+ Then I should get redirected to home page
65
+
66
+ Scenario: Tap on Feedback option and verify appropriat navigation
67
+ When I tap on Feedback option
68
+ Then I should get redirected to Feedback Overlay
69
+ And I should see Feedback text and OK button
70
+ When I tap on OK button of Overlay
71
+ Then I should get redirected to home page
@@ -0,0 +1,63 @@
1
+ Feature: Create Kundali
2
+
3
+ Scenario: Nvigation to kundali page
4
+ When I tap on Kundli option
5
+ Then I should get redirected to Kundali page
6
+
7
+ Scenario: Enter Date
8
+ When I tap on Date button
9
+ Then I should see Date picker
10
+ When I select Date as "20" "May" "2020"
11
+ Then I should see Date button text as "20 May 2020"
12
+
13
+ Scenario: Enter Time
14
+ When I tap on Time button
15
+ Then I should see Time picker
16
+ When I enter Time as "08":"20" "PM"
17
+ Then I should see Time button text as "20:20"
18
+
19
+ Scenario: Tapping on more options arrow and Saving
20
+ When I tap on more options arrow
21
+ Then I should see Save Kundali option
22
+ When I tap on Save Kundali option
23
+ Then I should see Enter name overlay
24
+ Then I enter name as "SeleniumCucumber"
25
+ Then I tap on Ok button
26
+
27
+ Scenario: Swap Kundali to see more information
28
+ When I swipe to Kundali tab
29
+ Then I should see Kundali
30
+ When I swipe to Kundali(South. Ind.)
31
+ Then I should see South. Ind. Kundali
32
+ When I swipe to dasha
33
+ Then I should see mahadasha details
34
+
35
+ Scenario: Go to homepage and open created Kundali
36
+ When I press back button of device
37
+ Then I should get redirected to home page
38
+ When I tap on Kundli option
39
+ Then I should get redirected to Kundali page
40
+ When I tap on more options arrow
41
+ Then I should see Open Kundali option
42
+ When I tap on Open Kundali option
43
+ Then I should get Kundali overlay with SeleniumCucumber Kundali
44
+ When I tap on SeleniumCucumber Kundali
45
+ Then I should see SeleniumCucumber Kundali is open
46
+
47
+ Scenario: Delete Kundali
48
+ When I tap on Open Kundali option
49
+ Then I should get Kundali overlay with SeleniumCucumber Kundali
50
+ Then I should see text as "Long Press to Delete Kundali"
51
+ When I Long tap on SeleniumCucumber Kundali
52
+
53
+ Scenario: Confirm Delete
54
+ Then I should get pop up with text "Remove Kundali?"
55
+ When I tap on Ok button
56
+ Then I should get redirected to Kundali page
57
+ When I tap on Open Kundali option
58
+ Then I should not see SeleniumCucumber Kundali under Open Kundali overlay
59
+ When I press back button of device twice
60
+ Then I should get redirected to home page
61
+
62
+ Scenario: Close app
63
+ Then I close app
@@ -0,0 +1,81 @@
1
+ require 'selenium-cucumber'
2
+
3
+ Given(/^I am on home page of Hindu Calender$/) do
4
+ step %[element having id "android:id/action_bar_title" should have text as "Hindu Calendar"]
5
+ end
6
+
7
+ Then(/^I should see Month View option$/) do
8
+ step %[element having xpath "//android.widget.TextView[@text='Month View']" should have text as "Month View"]
9
+ end
10
+
11
+ Then(/^I should see Panchang option$/) do
12
+ step %[element having xpath "//android.widget.TextView[@text='Panchang']" should have text as "Panchang"]
13
+ end
14
+
15
+ Then(/^I should see Kundli option$/) do
16
+ step %[element having xpath "//android.widget.TextView[@text='Kundli']" should have text as "Kundli"]
17
+ end
18
+
19
+ Then(/^I should see Jyotish option$/) do
20
+ step %[element having xpath "//android.widget.TextView[@text='Jyotish']" should have text as "Jyotish"]
21
+ end
22
+
23
+ Then(/^I should see Festivals option$/) do
24
+ step %[element having xpath "//android.widget.TextView[@text='Festivals']" should have text as "Festivals"]
25
+ end
26
+
27
+ Then(/^I should see My Tithi option$/) do
28
+ step %[element having xpath "//android.widget.TextView[@text='My Tithi']" should have text as "My Tithi"]
29
+ end
30
+
31
+ Then(/^I should see Settings option$/) do
32
+ step %[element having xpath "//android.widget.TextView[@text='Settings']" should have text as "Settings"]
33
+ end
34
+
35
+ Then(/^I should see Info option$/) do
36
+ step %[element having xpath "//android.widget.TextView[@text='Info']" should have text as "Info"]
37
+ end
38
+
39
+ Then(/^I should see About option$/) do
40
+ step %[element having xpath "//android.widget.TextView[@text='About']" should have text as "About"]
41
+ end
42
+
43
+ Then(/^I should see Feedback option$/) do
44
+ step %[element having xpath "//android.widget.TextView[@text='Feedback']" should have text as "Feedback"]
45
+ end
46
+
47
+ Then(/^I should see Hambergur menu$/) do
48
+ step %[element having id "android:id/up" should be present]
49
+ end
50
+
51
+ Then(/^I should see Swistik image$/) do
52
+ step %[element having id "android:id/home" should be present]
53
+ end
54
+
55
+ Then(/^I should see Hindu Calender text$/) do
56
+ step %[element having id "android:id/action_bar_title" should have text as "Hindu Calendar"]
57
+ end
58
+
59
+ Then(/^I should see Settings option image$/) do
60
+ step %[element having id "com.alokmandavgane.hinducalendar:id/menu_settings" should be present]
61
+ end
62
+
63
+ When(/^I tap on Hambergur menu$/) do
64
+ step %[I click on element having id "android:id/up"]
65
+ end
66
+
67
+ Then(/^I should see left menu overlay$/) do
68
+ step %[element having id "com.alokmandavgane.hinducalendar:id/left_drawer" should be present]
69
+ end
70
+
71
+ Then(/^I should see Kundali option$/) do
72
+ step %[element having xpath "//android.widget.TextView[@text='Kundali']" should have text as "Kundali"]
73
+ end
74
+
75
+ When(/^I tap on Hambergur menu again$/) do
76
+ step %[I click on element having id "android:id/up"]
77
+ end
78
+
79
+ Then(/^I should not see left menu overlay$/) do
80
+ step %[element having id "com.alokmandavgane.hinducalendar:id/left_drawer" should not be present]
81
+ end
@@ -0,0 +1,132 @@
1
+ require 'selenium-cucumber'
2
+
3
+ When(/^I tap on Month View option$/) do
4
+ step %[I click on element having xpath "//android.widget.TextView[@text='Month View']"]
5
+ end
6
+
7
+ Then(/^I should get redirected to Month View page$/) do
8
+ step %[element having id "android:id/action_bar_title" should have text as "Month View"]
9
+ end
10
+
11
+ Then(/^I should see Feativals and Events in this month text$/) do
12
+ step %[element having xpath "//android.widget.TextView[@index=4]" should have text as "Festivals and Events in this month"]
13
+ end
14
+
15
+ Then(/^I should get redirected to home page$/) do
16
+ step %[I wait for 3 sec]
17
+ step %[element having id "android:id/action_bar_title" should have text as "Hindu Calendar"]
18
+ end
19
+
20
+ When(/^I tap on Panchang option$/) do
21
+ step %[I click on element having xpath "//android.widget.TextView[@text='Panchang']"]
22
+ end
23
+
24
+ Then(/^I should get redirected to Panchang page$/) do
25
+ step %[element having id "android:id/action_bar_title" should have text as "Panchang"]
26
+ end
27
+
28
+ Then(/^I should see date$/) do
29
+ step %[element having id "com.alokmandavgane.hinducalendar:id/date" should be present]
30
+ end
31
+
32
+ When(/^I tap on Kundli option$/) do
33
+ step %[I click on element having xpath "//android.widget.TextView[@text='Kundli']"]
34
+ end
35
+
36
+ Then(/^I should get redirected to Kundali page$/) do
37
+ step %[element having id "android:id/action_bar_title" should have text as "Kundali"]
38
+ end
39
+
40
+ Then(/^I should see Info text$/) do
41
+ step %[element having xpath "//android.widget.TextView[@text='Info']" should have text as "Info"]
42
+ end
43
+
44
+ When(/^I tap on Jyotish option$/) do
45
+ step %[I click on element having xpath "//android.widget.TextView[@text='Jyotish']"]
46
+ end
47
+
48
+ Then(/^I should get redirected to Jyotish page$/) do
49
+ step %[element having id "android:id/action_bar_title" should have text as "Jyotish"]
50
+ end
51
+
52
+ Then(/^I should see Muhurt text$/) do
53
+ step %[element having xpath "//android.widget.TextView[@text='Muhurt']" should have text as "Muhurt"]
54
+ end
55
+
56
+ When(/^I tap on Festivals option$/) do
57
+ step %[I click on element having xpath "//android.widget.TextView[@text='Festivals']"]
58
+ end
59
+
60
+ Then(/^I should get redirected to Festivals page$/) do
61
+ step %[element having id "android:id/action_bar_title" should have text as "Festivals"]
62
+ end
63
+
64
+ Then(/^I should see Gudi Padwa text$/) do
65
+ step %[element having xpath "//android.widget.TextView[@text='Gudi Padwa']" should have text as "Gudi Padwa"]
66
+ end
67
+
68
+ When(/^I tap on My Tithi option$/) do
69
+ step %[I click on element having xpath "//android.widget.TextView[@text='My Tithi']"]
70
+ end
71
+
72
+ Then(/^I should get redirected to My Tithi page$/) do
73
+ step %[element having id "android:id/action_bar_title" should have text as "My Tithi"]
74
+ end
75
+
76
+ Then(/^I should see Save My Tithi button$/) do
77
+ step %[element having id "com.alokmandavgane.hinducalendar:id/save_mytithi" should be present]
78
+ end
79
+
80
+ When(/^I tap on Settings option$/) do
81
+ step %[I click on element having xpath "//android.widget.TextView[@text='Settings']"]
82
+ end
83
+
84
+ Then(/^I should get redirected to Settings page$/) do
85
+ step %[element having id "android:id/action_bar_title" should have text as "Settings"]
86
+ end
87
+
88
+ Then(/^I should see Save Settings button$/) do
89
+ step %[element having id "com.alokmandavgane.hinducalendar:id/save_settings1" should be present]
90
+ end
91
+
92
+ When(/^I tap on Info option$/) do
93
+ step %[I click on element having xpath "//android.widget.TextView[@text='Info']"]
94
+ end
95
+
96
+ Then(/^I should get redirected to Info page$/) do
97
+ step %[element having id "android:id/action_bar_title" should have text as "Info"]
98
+ end
99
+
100
+ Then(/^I should see Hindu Calendar text on Info page$/) do
101
+ step %[element having xpath "//android.view.View[@content-desc='Hindu Calendar Heading']" should be present]
102
+ end
103
+
104
+ When(/^I tap on About option$/) do
105
+ step %[I click on element having xpath "//android.widget.TextView[@text='About']"]
106
+ end
107
+
108
+ Then(/^I should get redirected to About Overlay$/) do
109
+ step %[element having id "android:id/content" should be present]
110
+ end
111
+
112
+ Then(/^I should see Hindu Calendar text and OK button$/) do
113
+ step %[element having id "android:id/alertTitle" should have text as "Hindu Calendar"]
114
+ step %[element having id "android:id/button1" should be present]
115
+ end
116
+
117
+ When(/^I tap on OK button of Overlay$/) do
118
+ step %[I click on element having id "android:id/button1"]
119
+ end
120
+
121
+ When(/^I tap on Feedback option$/) do
122
+ step %[I click on element having xpath "//android.widget.TextView[@text='Feedback']"]
123
+ end
124
+
125
+ Then(/^I should get redirected to Feedback Overlay$/) do
126
+ step %[element having id "android:id/content" should be present]
127
+ end
128
+
129
+ Then(/^I should see Feedback text and OK button$/) do
130
+ step %[element having id "android:id/alertTitle" should have text as "Feedback"]
131
+ step %[element having id "android:id/button1" should be present]
132
+ end
@@ -0,0 +1,413 @@
1
+ require 'selenium-cucumber'
2
+
3
+ When(/^I tap on Date button$/) do
4
+ step %[I click on element having id "com.alokmandavgane.hinducalendar:id/datePicker1"]
5
+ end
6
+
7
+ Then(/^I should see Date picker$/) do
8
+ step %[element having id "android:id/content" should be present]
9
+ end
10
+
11
+ When(/^I select Date as "(.*?)" "(.*?)" "(.*?)"$/) do |date, month, year|
12
+ set_date(date)
13
+ set_month(month)
14
+ set_year(year)
15
+ end
16
+
17
+ Then(/^I should see Date button text as "(.*?)"$/) do |date|
18
+ step %[element having id "com.alokmandavgane.hinducalendar:id/datePicker1" should have text as "#{date}"]
19
+
20
+ end
21
+
22
+ When(/^I tap on Time button$/) do
23
+ step %[I click on element having id "com.alokmandavgane.hinducalendar:id/timePicker1"]
24
+ end
25
+
26
+ Then(/^I should see Time picker$/) do
27
+ step %[element having id "android:id/content" should be present]
28
+ end
29
+
30
+ When(/^I enter Time as "(.*?)":"(.*?)" "(.*?)"$/) do |hour, min, am_pm|
31
+ set_min(min)
32
+ set_hour(hour)
33
+ set_am_pm(am_pm)
34
+ end
35
+
36
+ Then(/^I should see Time button text as "(.*?)"$/) do |time_text|
37
+ step %[element having id "com.alokmandavgane.hinducalendar:id/timePicker1" should have text as "#{time_text}"]
38
+ end
39
+
40
+ When(/^I tap on more options arrow$/) do
41
+ step %[I click on element having id "com.alokmandavgane.hinducalendar:id/more_options"]
42
+ end
43
+
44
+ Then(/^I should see Save Kundali option$/) do
45
+ step %[element having id "com.alokmandavgane.hinducalendar:id/save_kundali" should be present]
46
+ end
47
+
48
+ When(/^I tap on Save Kundali option$/) do
49
+ step %[I click on element having id "com.alokmandavgane.hinducalendar:id/save_kundali"]
50
+ end
51
+
52
+ Then(/^I should see Enter name overlay$/) do
53
+ step %[element having id "android:id/content" should be present]
54
+ end
55
+
56
+ Then(/^I enter name as "(.*?)"$/) do |name|
57
+ step %[I enter "#{name}" into input field having xpath "//android.widget.EditText[@index=0]"]
58
+ end
59
+
60
+ When(/^I tap on Ok button$/) do
61
+ step %[I click on element having id "android:id/button1"]
62
+ end
63
+
64
+ Then(/^I should see Name on info page as "(.*?)"$/) do |arg1|
65
+ step %[I wait for 3 sec]
66
+ end
67
+
68
+ When(/^I swipe to Kundali tab$/) do
69
+ #step %[I swipe from element having xpath "//android.widget.TextView[@text='Info']" to element having xpath "//android.widget.TextView[@text='Kundali']"]
70
+ #step %[I swipe from co-ordinates "1053","1325" to co-ordinates "24","1238"]
71
+ step %[I swipe from element having xpath "//android.view.View[@index=1]" to element having xpath "//android.view.View[@index=0]"]
72
+ #step %[I swipe from co-ordinates "800","630" to co-ordinates "24","695"]
73
+ step %[I wait for 3 sec]
74
+ end
75
+
76
+ Then(/^I should see Kundali$/) do
77
+ step %[element having xpath "//android.view.View[@index=2]" should be present]
78
+ step %[I wait for 3 sec]
79
+ end
80
+
81
+ When(/^I swipe to Kundali\(South\. Ind\.\)$/) do
82
+
83
+ step %[I swipe from co-ordinates "800","630" to co-ordinates "24","695"]
84
+ end
85
+
86
+ Then(/^I should see South\. Ind\. Kundali$/) do
87
+ step %[element having xpath "//android.view.View[@index=2]" should be present]
88
+ step %[I wait for 3 sec]
89
+ end
90
+
91
+ When(/^I swipe to dasha$/) do
92
+ step %[I swipe from co-ordinates "800","630" to co-ordinates "24","695"]
93
+ step %[I wait for 3 sec]
94
+ end
95
+
96
+ Then(/^I should see mahadasha details$/) do
97
+ step %[element having xpath "//android.view.View[@index=0]" should be present]
98
+ end
99
+
100
+ Then(/^I should see Open Kundali option$/) do
101
+ step %[element having id "com.alokmandavgane.hinducalendar:id/history_kundali" should be present]
102
+ end
103
+
104
+ When(/^I tap on Open Kundali option$/) do
105
+ step %[I click on element having id "com.alokmandavgane.hinducalendar:id/history_kundali"]
106
+ end
107
+
108
+ Then(/^I should get Kundali overlay with SeleniumCucumber Kundali$/) do
109
+ #step %[element having xpath "android.widget.FrameLayout[@index=0]" should be present]
110
+ step %[element having id "com.alokmandavgane.hinducalendar:id/name" should have text as "SeleniumCucumber"]
111
+ end
112
+
113
+ When(/^I tap on SeleniumCucumber Kundali$/) do
114
+ step %[I click on element having id "com.alokmandavgane.hinducalendar:id/name"]
115
+ end
116
+
117
+ Then(/^I should see text as "(.*?)"$/) do |longpress_delete|
118
+ step %[element having id "com.alokmandavgane.hinducalendar:id/textView" should have text as "#{longpress_delete}"]
119
+ end
120
+
121
+ Then(/^I should see SeleniumCucumber Kundali is open$/) do
122
+ step %[I should see Date button text as "20 May 2020"]
123
+ end
124
+
125
+ When(/^I Long tap on SeleniumCucumber Kundali$/) do
126
+ step %[I long tap on element having id "com.alokmandavgane.hinducalendar:id/name" for "3" sec]
127
+ end
128
+
129
+ Then(/^I should get pop up with text "(.*?)"$/) do |message|
130
+ step %[element having id "android:id/message" should have text as "#{message}"]
131
+ end
132
+
133
+ Then(/^I should not see SeleniumCucumber Kundali under Open Kundali overlay$/) do
134
+ step %[element having id "com.alokmandavgane.hinducalendar:id/name" should not be present]
135
+ end
136
+
137
+ When(/^I press back button of device twice$/) do
138
+ step %[I navigate back]
139
+ step %[I navigate back]
140
+ step %[I wait for 2 sec]
141
+ end
142
+
143
+
144
+ def set_date(date)
145
+ date = date.to_i
146
+ if $device_name != 'GOOGLE NEXUS 5'
147
+ sleep 2
148
+ ele_day = $driver.find_elements(:xpath, "//android.widget.EditText[@index=1]")
149
+ #puts ele_day
150
+ ele_day = ele_day[0]
151
+ #puts ele_day
152
+ if ele_day.text.to_i == date
153
+ #puts "equal"
154
+ else
155
+ if ele_day.text.to_i < date
156
+ begin
157
+ increase_date_by_one
158
+ end while ele_day.text.to_i != date
159
+ else
160
+ begin
161
+ decrease_date_by_one
162
+ end while ele_day.text.to_i != date
163
+ end
164
+ end
165
+ else
166
+ #puts "In NEXUS 5"
167
+ ele_day = $driver.find_elements(:xpath, "//android.widget.EditText[@index=1]")
168
+ #puts ele_day
169
+ ele_day = ele_day[1]
170
+ #puts ele_day
171
+ #puts ele_day.text.to_i
172
+ #puts date
173
+ if ele_day.text.to_i == date
174
+ #step %[I click on element having id "android:id/button1"]
175
+ else
176
+ if ele_day.text.to_i < date
177
+ begin
178
+ increase_date_by_one
179
+ end while ele_day.text.to_i != date
180
+ #step %[I click on element having id "android:id/button1"]
181
+ else
182
+ begin
183
+ decrease_date_by_one
184
+ end while ele_day.text.to_i != date
185
+ #step %[I click on element having id "android:id/button1"]
186
+ end
187
+ end
188
+ end
189
+ end
190
+
191
+ def set_month(month)
192
+ if $device_name != 'GOOGLE NEXUS 5'
193
+ ele_cur_month = $driver.find_elements(:xpath, "//android.widget.EditText[@index=1]")
194
+ ele_cur_month = ele_cur_month[1]
195
+ #puts ele_cur_month.text
196
+ if ele_cur_month.text != "#{month}"
197
+ begin
198
+ increase_month_by_one
199
+ end while ele_cur_month.text != "#{month}"
200
+ end
201
+ else
202
+ ele_cur_month = $driver.find_elements(:xpath, "//android.widget.EditText[@index=1]")
203
+ ele_cur_month = ele_cur_month[0]
204
+ if ele_cur_month.text != "#{month}"
205
+ begin
206
+ increase_month_by_one
207
+ end while ele_cur_month.text != "#{month}"
208
+ end
209
+ end
210
+ end
211
+
212
+ def set_hour(hour)
213
+ #puts "in set_hour"
214
+ hour = hour.to_i
215
+ #puts hour
216
+ cur_hour = $driver.find_elements(:xpath, "//android.widget.EditText[@index=1]")
217
+ cur_hour = cur_hour[0]
218
+ if cur_hour.text.to_i == hour
219
+ puts ""
220
+ else
221
+ if cur_hour.text.to_i < hour
222
+ begin
223
+ increase_hour_by_one
224
+ end while cur_hour.text.to_i != hour
225
+ else
226
+ begin
227
+ decrease_hour_by_one
228
+ end while cur_hour.text.to_i != hour
229
+ end
230
+ end
231
+ end
232
+
233
+ def set_min(min)
234
+ #puts "in set_min"
235
+ min = min.to_i
236
+ #puts min
237
+ cur_min = $driver.find_elements(:xpath, "//android.widget.EditText[@index=1]")
238
+ cur_min = cur_min[1]
239
+ if cur_min.text.to_i == min
240
+ puts ""
241
+ else
242
+ if cur_min.text.to_i < min
243
+ begin
244
+ increase_min_by_one
245
+ end while cur_min.text.to_i != min
246
+ else
247
+ begin
248
+ decrease_min_by_one
249
+ end while cur_min.text.to_i != min
250
+ end
251
+ end
252
+ end
253
+
254
+ def increase_date_by_one
255
+ if $device_name != 'GOOGLE NEXUS 5'
256
+ sleep 2
257
+ ele_day = $driver.find_elements(:xpath, "//android.widget.Button[@index=2]")
258
+ ele_day = ele_day[0]
259
+
260
+ if ele_day.text == "01"
261
+ ele_day.click
262
+ ele_month = $driver.find_elements(:xpath, "//android.widget.Button[@index=2]")
263
+ ele_month = ele_month[1]
264
+ ele_month.click
265
+ else
266
+ ele_day.click
267
+ end
268
+ else
269
+ ele_day = $driver.find_elements(:xpath, "//android.widget.Button[@index=2]")
270
+ ele_day = ele_day[1]
271
+ if ele_day.text == "01"
272
+ ele_day.click
273
+ ele_month = $driver.find_elements(:xpath, "//android.widget.Button[@index=2]")
274
+ ele_month = ele_month[0]
275
+ ele_month.click
276
+ else
277
+ ele_day.click
278
+ end
279
+ end
280
+ end
281
+
282
+ def decrease_date_by_one
283
+ if $device_name != 'GOOGLE NEXUS 5'
284
+ cur_date = $driver.find_elements(:xpath, "//android.widget.EditText[@index=1]")
285
+ cur_date = cur_date[0]
286
+ cur_date = cur_date.text
287
+ if cur_date == "01"
288
+ cur_month = $driver.find_elements(:xpath, "//android.widget.Button[@index=0]")
289
+ cur_month = cur_month[1]
290
+ cur_month.click
291
+ dec_date = $driver.find_elements(:xpath, "//android.widget.Button[@index=0]")
292
+ dec_date = dec_date[0]
293
+ dec_date.click
294
+ else
295
+ dec_date = $driver.find_elements(:xpath, "//android.widget.Button[@index=0]")
296
+ dec_date = dec_date[0]
297
+ dec_date.click
298
+ end
299
+ else
300
+ dec_date = $driver.find_elements(:xpath, "//android.widget.Button[@index=0]")
301
+ dec_date = dec_date[1]
302
+ cur_date = $driver.find_elements(:xpath, "//android.widget.EditText[@index=1]")
303
+ cur_date = cur_date[1]
304
+ cur_date = cur_date.text
305
+ if cur_date == "01"
306
+ cur_month = $driver.find_elements(:xpath, "//android.widget.Button[@index=0]")
307
+ cur_month = cur_month[0]
308
+ cur_month.click
309
+ dec_date = $driver.find_elements(:xpath, "//android.widget.Button[@index=0]")
310
+ dec_date = dec_date[1]
311
+ dec_date.click
312
+ else
313
+ dec_date = $driver.find_elements(:xpath, "//android.widget.Button[@index=0]")
314
+ dec_date = dec_date[1]
315
+ dec_date.click
316
+ end
317
+ end
318
+ end
319
+
320
+ def increase_month_by_one
321
+ if $device_name != 'GOOGLE NEXUS 5'
322
+ sleep 2
323
+ ele_month = $driver.find_elements(:xpath, "//android.widget.Button[@index=2]")
324
+ ele_month = ele_month[1]
325
+ ele_month.click
326
+ else
327
+ ele_month = $driver.find_elements(:xpath, "//android.widget.Button[@index=2]")
328
+ ele_month = ele_month[0]
329
+ ele_month.click
330
+ end
331
+ end
332
+
333
+ def increase_year_by_one
334
+ ele_year = $driver.find_elements(:xpath, "//android.widget.Button[@index=2]")
335
+ ele_year = ele_year[2]
336
+ ele_year.click
337
+ end
338
+
339
+ def decrease_year_by_one
340
+ ele_year = $driver.find_elements(:xpath, "//android.widget.Button[@index=0]")
341
+ ele_year = ele_year[2]
342
+ ele_year.click
343
+ end
344
+
345
+ def set_year(year)
346
+ year = year.to_i
347
+ ele_year = $driver.find_elements(:xpath, "//android.widget.EditText[@index=1]")
348
+ ele_year = ele_year[2]
349
+ #puts ele_year
350
+ if ele_year.text.to_i == year
351
+ #puts "equal"
352
+ step %[I click on element having id "android:id/button1"]
353
+ else
354
+ if ele_year.text.to_i < year
355
+ begin
356
+ increase_year_by_one
357
+ end while ele_year.text.to_i != year
358
+ step %[I click on element having id "android:id/button1"]
359
+ else
360
+ begin
361
+ decrease_year_by_one
362
+ end while ele_year.text.to_i != year
363
+ step %[I click on element having id "android:id/button1"]
364
+ end
365
+ end
366
+ end
367
+
368
+ def increase_hour_by_one
369
+ ele_hour = $driver.find_elements(:xpath, "//android.widget.Button[@index=2]")
370
+ ele_hour = ele_hour[0]
371
+ ele_hour.click
372
+ end
373
+
374
+ def decrease_hour_by_one
375
+ ele_hour = $driver.find_elements(:xpath, "//android.widget.Button[@index=0]")
376
+ ele_hour = ele_hour[0]
377
+ ele_hour.click
378
+ end
379
+
380
+ def increase_min_by_one
381
+ ele_min = $driver.find_elements(:xpath, "//android.widget.Button[@index=2]")
382
+ ele_min = ele_min[1]
383
+ ele_min.click
384
+ end
385
+
386
+ def decrease_min_by_one
387
+ ele_min = $driver.find_elements(:xpath, "//android.widget.Button[@index=0]")
388
+ ele_min = ele_min[1]
389
+ ele_min.click
390
+ end
391
+
392
+ def set_am_pm(am_pm)
393
+ #puts "In AM+PM"
394
+ if am_pm == 'AM'
395
+ begin
396
+ $driver.find_element(:xpath, "//android.widget.EditText[@text='AM']").displayed?
397
+ step %[I click on element having id "android:id/button1"]
398
+ rescue
399
+ $driver.find_element(:xpath, "//android.widget.Button[@index=0]").click
400
+ step %[I click on element having id "android:id/button1"]
401
+ end
402
+ else
403
+ begin
404
+ $driver.find_element(:xpath, "//android.widget.EditText[@text='PM']").displayed?
405
+ step %[I click on element having id "android:id/button1"]
406
+ rescue
407
+ $driver.find_element(:xpath, "//android.widget.Button[@index=1]").click
408
+ step %[I click on element having id "android:id/button1"]
409
+ end
410
+ end
411
+ end
412
+
413
+