Repository navigation
Expand file tree
/
Copy pathregistrationlvee.rb
More file actions
executable file
·99 lines (83 loc) · 2.59 KB
/
Copy pathregistrationlvee.rb
File metadata and controls
executable file
·99 lines (83 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# coding: utf-8
load 'config.rb'
module MyModule
class Registrator
def login(login)
@login = login
end
def email(email)
@email = email
end
def rules_agree
Capybara.visit('https://lvee.org')
Capybara.find(:xpath, '//*[@id="login-panel"]/ul/li[3]/a').click
end
def form_filling
#Capybara.current_driver = :selenium
# Capybara.visit('https://lvee.org')
# Capybara.click_link('Register')
Capybara.fill_in('record_login_', :with => @login)
Capybara.fill_in('record_password_', :with => '6279508')
Capybara.fill_in('record_password_confirmation_', :with => '6279508')
Capybara.fill_in('record_email_', :with => @email)
Capybara.fill_in('record_first_name_', :with => 'Galina')
Capybara.fill_in('record_last_name_', :with => 'Test')
Capybara.find('#record_country_').find(:xpath, 'option[2]').select_option #first Belarus
#Capybara.select("Albania", :from => 'record_country') # except duplicated countries
Capybara.fill_in('record_city_', :with => 'Minsk')
Capybara.fill_in('record_occupation_', :with => 'Test')
Capybara.check('record_subscribed_')
Capybara.check('record_subscribed_talks_')
Capybara.click_button('Create')
end
def nick_generate
Capybara.visit('http://nick-name.ru/generate/')
Capybara.click_on('generate')
return Capybara.find_field('resname').value
end
def email_generate
Capybara.visit 'http://www.fakeinbox.com/'
Capybara.find('#random input ').click
return Capybara.find_field('mail').value
end
def email_regenerate
Capybara.visit 'http://www.fakeinbox.com/'
Capybara.click_on('Delete E-mail Address')
Capybara.find('#random input ').click
return Capybara.find_field('mail').value
end
def email_confirm
sleep 10
Capybara.visit 'http://www.fakeinbox.com/'
#sleep 5
#Capybara.click_on('Show')
Capybara.visit Capybara.find('a', :text => 'Show')[:href]
Capybara.visit Capybara.find('a', :text => '/activate/')[:href]
end
def user_logout
Capybara.click_on('Logout')
sleep 10
end
end
end
t = MyModule::Registrator.new
logins = []
puts 'Enter a number of registration users'
numberOfUsers = gets.chomp
i=0
while i < numberOfUsers.to_i
login =t.nick_generate + 'unique'
if (i==0)
email =t.email_generate
else email =t.email_regenerate
end
t.login(login)
t.email(email)
t.rules_agree
t.form_filling
t.email_confirm
t.user_logout
logins = logins + [login + ' ' + email]
i+=1
end
puts logins