prestashop-automation 0.7.7 → 0.8
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.
- data/lib/actions/carriers.rb +5 -0
- data/lib/actions/general.rb +14 -2
- data/lib/actions/installer.rb +26 -0
- data/lib/helpers/general.rb +4 -0
- metadata +1 -1
data/lib/actions/carriers.rb
CHANGED
@@ -4,6 +4,11 @@ module PrestaShopAutomation
|
|
4
4
|
goto_admin_tab 'AdminCarriers'
|
5
5
|
find('#page-header-desc-carrier-new_carrier').click
|
6
6
|
|
7
|
+
#some versions have an additional step
|
8
|
+
if has_selector? 'a.btn[href*="controller=AdminCarrierWizard"]'
|
9
|
+
click 'a.btn[href*="controller=AdminCarrierWizard"]'
|
10
|
+
end
|
11
|
+
|
7
12
|
fill_in 'name', :with => options[:name]
|
8
13
|
fill_in 'delay_1', :with => options[:delay] || 'Turtle'
|
9
14
|
fill_in 'grade', :with => options[:grade] if options[:grade]
|
data/lib/actions/general.rb
CHANGED
@@ -51,15 +51,27 @@ module PrestaShopAutomation
|
|
51
51
|
@logged_in_to_front_office_as = nil
|
52
52
|
end
|
53
53
|
|
54
|
-
def
|
55
|
-
|
54
|
+
def get_menu
|
55
|
+
Hash[all('ul.menu a', :visible => false).to_a.keep_if do |a|
|
56
56
|
a['href'] =~ /\?controller=/
|
57
57
|
end.map do |a|
|
58
58
|
[a['href'][/\?controller=(.+?)\b/, 1], a['href']]
|
59
59
|
end]
|
60
|
+
end
|
61
|
+
|
62
|
+
def goto_admin_tab tab
|
63
|
+
links = get_menu
|
60
64
|
expect(links[tab]).not_to eq nil
|
61
65
|
visit links[tab]
|
62
66
|
expect(current_url).to match /\bcontroller=#{tab}\b/
|
63
67
|
end
|
68
|
+
|
69
|
+
def goto_module_configuration name
|
70
|
+
goto_admin_tab 'AdminModules'
|
71
|
+
link = first("a[href*='configure='][href*='controller=AdminModules']", :visible => false)['href']
|
72
|
+
randomname = link[/\bconfigure=([^&?#]+)/, 1]
|
73
|
+
link.gsub! randomname, name
|
74
|
+
visit link
|
75
|
+
end
|
64
76
|
end
|
65
77
|
end
|
data/lib/actions/installer.rb
CHANGED
@@ -64,6 +64,32 @@ module PrestaShopAutomation
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
+
def add_module_from_repo repo, branch=nil
|
68
|
+
b = branch ? ['-b', branch] : []
|
69
|
+
unless system 'git', 'clone', repo, *b, :chdir => File.join(@filesystem_path, 'modules')
|
70
|
+
throw "Could not clone '#{repo}' into '#{@filesystem_path}'"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def install_module name
|
75
|
+
goto_admin_tab 'AdminModules'
|
76
|
+
link = first("a[href*='install='][href*='controller=AdminModules']", :visible => false)['href']
|
77
|
+
randomname = link[/\binstall=([^&?#]+)/, 1]
|
78
|
+
link.gsub! randomname, name
|
79
|
+
visit link
|
80
|
+
#check that the entry was added to the DB
|
81
|
+
expect(client.query("SELECT * FROM #{safe_database_name}.#{@database_prefix}module WHERE name='#{client.escape name}'").count).to be 1
|
82
|
+
end
|
83
|
+
|
84
|
+
def update_all_modules
|
85
|
+
goto_admin_tab 'AdminModules'
|
86
|
+
if has_selector? '#desc-module-update-all'
|
87
|
+
click '#desc-module-update-all'
|
88
|
+
goto_admin_tab 'AdminModules'
|
89
|
+
expect_to have_selector '#desc-module-check-and-update-all'
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
67
93
|
def drop_database
|
68
94
|
client.query("DROP DATABASE IF EXISTS #{safe_database_name}")
|
69
95
|
end
|
data/lib/helpers/general.rb
CHANGED