firebase-cloning-tool 0.1.4 → 0.1.5

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: c36023b44d7ed9f5d55766de054e67256b41bdd8
4
- data.tar.gz: ce9be3186c7ea668d4fee253a80b71286c575104
3
+ metadata.gz: 4634526b41558357af0a9866e37f533ba2cc53fc
4
+ data.tar.gz: 629c6410dccc6faaf6368c7951a66a779f7a0dcc
5
5
  SHA512:
6
- metadata.gz: 6d362b74f2944d57bc782814347d1fbf8a64bd15ea0be9d60857bad8d87b46700eb3061a0982b235c7f40a77e09703989a51330a015cc12e0d84f8fdba650931
7
- data.tar.gz: 5e6ade00dcc422d32d071e93f14759158ca4b1098efc22e76a88250ff8229605785b729320c39a0101a906f8d50bed672c6ea22f5998193841f5935c78c66172
6
+ metadata.gz: 5d24b87285eba55cac98ee5da25a4312815cd4387992f93fc64334c71006c2405e763b767ab2e7def0e6b52fb53b92cb9fc8d283b0f835e7808a0dba0c067d84
7
+ data.tar.gz: 1b0c7813a43b7f37dec3013c165fc9b53b9050a72810f74afc3d71e083294c372ded3bccc1af1cab7dd9c26e662dcd1e4b85c3e28b8e66d9d2334d7b4021a413
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.description = %q{Tool for cloning firebase remote config projects.}
14
14
  spec.homepage = "https://github.com/epool/firebase-cloning-tool"
15
15
  spec.license = "MIT"
16
- spec.required_ruby_version = '>= 2.2.2'
16
+ spec.required_ruby_version = '>= 2.3.0'
17
17
 
18
18
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
19
19
  # to allow pushing to a single host or delete this section to allow pushing to any host.
@@ -28,12 +28,12 @@ Gem::Specification.new do |spec|
28
28
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
29
29
  spec.require_paths = ["lib"]
30
30
 
31
- spec.add_dependency 'capybara', '~> 2.7.1'
32
- spec.add_dependency 'selenium-webdriver', '~> 2.53.1'
33
- spec.add_dependency 'chromedriver-helper', '~> 1.0.0'
31
+ spec.add_dependency 'capybara', '~> 3.3.1'
32
+ spec.add_dependency 'selenium-webdriver', '~> 3.13.0'
33
+ spec.add_dependency 'chromedriver-helper', '~> 1.2.0'
34
34
  spec.add_dependency 'pry'
35
- spec.add_dependency 'pry-byebug', '~> 3.2.0'
35
+ spec.add_dependency 'pry-byebug', '~> 3.6.0'
36
36
 
37
- spec.add_development_dependency "bundler", "~> 1.12"
38
- spec.add_development_dependency "rake", "~> 10.0"
37
+ spec.add_development_dependency "bundler", "~> 1.16.3"
38
+ spec.add_development_dependency "rake", "~> 12.3.1"
39
39
  end
@@ -8,7 +8,7 @@ module Firebase
8
8
  module Cloning
9
9
  module Tool
10
10
 
11
- def self.wait_until_selector_present(selector, wait=10)
11
+ def self.wait_until_selector_present(selector, wait=30)
12
12
  wait.times do
13
13
  break if Capybara.all(selector).any?
14
14
  puts 'Waiting for selector: ' + selector + '...'
@@ -16,7 +16,15 @@ module Firebase
16
16
  end
17
17
  end
18
18
 
19
- def self.wait_until_xpath_present(xpath, wait=10)
19
+ def self.wait_until_selector_disapears(selector, wait=30)
20
+ wait.times do
21
+ break if !Capybara.all(selector).any?
22
+ puts 'Waiting for selector to disapears: ' + selector + '...'
23
+ sleep 1
24
+ end
25
+ end
26
+
27
+ def self.wait_until_xpath_present(xpath, wait=30)
20
28
  wait.times do
21
29
  break if Capybara.all(:xpath, xpath).any?
22
30
  puts 'Waiting for xpath: ' + xpath + '...'
@@ -24,46 +32,40 @@ module Firebase
24
32
  end
25
33
  end
26
34
 
35
+ def self.wait_until_xpath_disapears(xpath, wait=30)
36
+ wait.times do
37
+ break if !Capybara.all(:xpath, xpath).any?
38
+ puts 'Waiting for xpath: ' + xpath + '...'
39
+ sleep 1
40
+ end
41
+ end
42
+
27
43
  def self.do_login(email, password)
28
44
  puts 'Trying sign in for ' + email + '...'
29
- wait_until_selector_present('#Email')
30
- Capybara.fill_in('Email', with: email)
31
- wait_until_selector_present('#next')
32
- Capybara.find('#next').click
33
- wait_until_selector_present('#Passwd')
34
- Capybara.fill_in('Passwd', with: password)
35
- wait_until_selector_present('#signIn')
36
- Capybara.find('#signIn').click
37
- wait_until_selector_present('div.c5e-landing-welcome-existing-projects-title')
45
+ wait_until_selector_present('#identifierId')
46
+ Capybara.fill_in('identifierId', with: email)
47
+ wait_until_selector_present('#identifierNext')
48
+ Capybara.find('#identifierNext').click
49
+ wait_until_xpath_present('//input[@name="password"]')
50
+ # Capybara.fill_in('Passwd', with: password)
51
+ Capybara.find(:xpath, '//input[@name="password"]').set(password)
52
+ wait_until_selector_present('#passwordNext')
53
+ Capybara.find('#passwordNext').click
54
+ wait_until_selector_present('div.c5e-landing-create-project-button')
38
55
  puts 'Sign in completed.'
39
56
  end
40
57
 
41
- def self.go_to_settings
42
- puts 'Going to project settings...'
43
- wait_until_xpath_present('//button[@aria-label="Settings" and contains(@class, "md-icon-button")]')
44
- Capybara.find(:xpath, '//button[@aria-label="Settings" and contains(@class, "md-icon-button")]').click
45
- wait_until_xpath_present('//a[@ng-click="controller.navEntryClick(controller.settings)"]')
46
- Capybara.find(:xpath, '//a[@ng-click="controller.navEntryClick(controller.settings)"]').click
47
- wait_until_xpath_present('//span[@ng-if="::controller.webApiKey"]')
48
- puts 'Project settings loaded.'
49
- end
50
-
51
- def self.update_web_api_key(remote_config_values)
52
- if !remote_config_values.key?('firebase_web_api_key')
53
- return
54
- end
55
- puts 'Updating web api key...'
56
- web_api_key = Capybara.find(:xpath, '//span[@ng-if="::controller.webApiKey"]').text
57
- remote_config_values['firebase_web_api_key'] = web_api_key
58
- puts 'Web api key updated.'
59
- end
60
-
61
58
  def self.create_new_project(project_name)
62
59
  puts 'Creating new project: ' + project_name + '...'
63
- Capybara.find(:xpath, '//button[@ng-click="controller.showCreateProjectDialog()"]').click
60
+ Capybara.find('div.c5e-landing-create-project-button').click
61
+ wait_until_selector_disapears('circle.ng-star-inserted')
62
+ wait_until_xpath_present('//input[@name="projectName"]')
64
63
  Capybara.find(:xpath, '//input[@name="projectName"]').set project_name
64
+ Capybara.find('#mat-checkbox-2-input').first(:xpath,".//..").click
65
+ wait_until_xpath_disapears('//button[@ng-click="controller.createProject()" and @disabled="disabled"]')
65
66
  Capybara.find(:xpath, '//button[@ng-click="controller.createProject()"]').click
66
- wait_until_xpath_present('//button[@ng-click="controller.closeCreateProjectDialog()"]')
67
+ wait_until_xpath_present('//button[@name="continueButton"]')
68
+ Capybara.find(:xpath, '//button[@name="continueButton"]').click
67
69
  puts 'Project ' + project_name + ' created.'
68
70
  wait_until_selector_present('div.fb-featurebar-title')
69
71
  puts 'Project ' + project_name + ' loaded.'
@@ -71,7 +73,7 @@ module Firebase
71
73
 
72
74
  def self.go_to_project(project_name)
73
75
  puts 'Opening ' + project_name + ' project...'
74
- Capybara.find('md-card', :text => project_name).click
76
+ Capybara.find('div.c5e-project-card-project-name', :exact_text => project_name).click
75
77
  wait_until_selector_present('div.fb-featurebar-title')
76
78
  puts 'Project ' + project_name + ' loaded.'
77
79
  end
@@ -82,14 +84,14 @@ module Firebase
82
84
 
83
85
  wait_until_selector_present('div.fb-featurebar-title')
84
86
 
85
- if Capybara.all('img.fb-zero-state-image').any?
87
+ if Capybara.all('img.fire-zero-state-image').any?
86
88
  puts 'Waiting to add new remote config data...'
87
- wait_until_xpath_present('//button[@ng-click="fbButtonCtaClick($event)"]')
88
- Capybara.find(:xpath, '//button[@ng-click="fbButtonCtaClick($event)"]').click
89
+ wait_until_xpath_present('//*[@id="main"]/ng-transclude/div/div/div/r10g-ng2-parameter-list/div/div/mat-card/fire-zero-state/div/button')
90
+ Capybara.find(:xpath, '//*[@id="main"]/ng-transclude/div/div/div/r10g-ng2-parameter-list/div/div/mat-card/fire-zero-state/div/button').click
89
91
  else
90
92
  puts 'Waiting for remote config data...'
91
- wait_until_xpath_present('//button[@ng-click="controller.addParameter($event)"]')
92
- Capybara.find(:xpath, '//button[@ng-click="controller.addParameter($event)"]').click
93
+ wait_until_selector_present('button.mat-raised-button.mat-primary.ng-star-inserted')
94
+ # Capybara.find('button.mat-raised-button.mat-primary.ng-star-inserted').click
93
95
  end
94
96
  puts 'Remote config loaded.'
95
97
  end
@@ -97,34 +99,41 @@ module Firebase
97
99
  def self.copy_remote_config
98
100
  puts 'Copying remote config to memory...'
99
101
  remote_config_values = {}
100
- Capybara.all('.r10g-param-row.layout-xs-column.layout-row.flex').each {
102
+ Capybara.all('div.content').each {
101
103
  |element|
102
- remote_config_values[element.find('.r10g-codefont.r10g-param-row-key.fb-highlightable').text()] = element.find('.chip-value.fb-highlightable').text()
104
+ remote_config_values[element.find('div.name').text()] = element.find('div.chip-value.value.ng-star-inserted div.ng-star-inserted').text()
103
105
  }
104
106
  puts 'Remote config copied.'
105
107
  return remote_config_values
106
108
  end
107
109
 
110
+ def self.project_exists(project_name)
111
+ Capybara.all('div.c5e-project-card-project-name').each {
112
+ |element|
113
+ if element.text() == project_name
114
+ return true
115
+ end
116
+ }
117
+ return false
118
+ end
119
+
108
120
  def self.paste_remote_config(remote_config_values)
109
121
  puts 'Pasting remote config from memory...'
110
122
  remote_config_values.each do | key, value |
111
- Capybara.find(:xpath, '//input[@name="paramKey"]').set key
112
- Capybara.find(:xpath, '//input[@ng-model="property:controller.valueOption.value"]').set value
113
- if Capybara.all(:xpath, '//button[@ng-click="controller.addParameter($event)"]').any?
114
- Capybara.find(:xpath, '//button[@ng-click="controller.addParameter($event)"]').click
115
- else
116
- Capybara.find(:xpath, '//button[@ng-click="pe.onSubmitHandler()"]').click
117
- end
118
- Capybara.find(:xpath, '//button[@ng-click="controller.addParameter($event)"]').click
123
+ Capybara.find(:xpath, '//*[@id="main"]/ng-transclude/div/div/div/r10g-ng2-parameter-list/div/div/mat-card/fire-inline-editor/div/r10g-ng2-parameter-editor/form/div/div[2]/div[1]/div[1]/input').set key
124
+ Capybara.find(:xpath, '//*[@id="main"]/ng-transclude/div/div/div/r10g-ng2-parameter-list/div/div/mat-card/fire-inline-editor/div/r10g-ng2-parameter-editor/form/div/div[2]/div[2]/div/r10g-ng2-parameter-conditional-value-editor/div/div/r10g-ng2-parameter-conditional-value-input/div/input').set value
125
+ Capybara.find(:xpath, '//*[@id="main"]/ng-transclude/div/div/div/r10g-ng2-parameter-list/div/div/mat-card/fire-inline-editor[1]/div/r10g-ng2-parameter-editor/form/div/div[3]/div[2]/button[2]').click
126
+ Capybara.find(:xpath, '//*[@id="main"]/ng-transclude/div/div/div[2]/r10g-ng2-parameter-list/div/div/mat-card/fire-card-action-bar/div/div/button').click
119
127
  end
120
- Capybara.find(:xpath, '//button[@ng-click="pe.onCancel()"]').click
128
+ Capybara.find(:xpath, '//*[@id="main"]/ng-transclude/div/div/div[2]/r10g-ng2-parameter-list/div/div/mat-card/fire-inline-editor[1]/div/r10g-ng2-parameter-editor/form/div/div[3]/div[2]/button[1]').click
121
129
  puts 'Remote config pasted.'
122
130
  end
123
131
 
124
132
  def self.publish_changes
125
133
  puts 'Publishing remote config...'
126
- Capybara.find(:xpath, '//button[@ng-click="featureBar.primaryButton.buttonAction()"]').click
127
- Capybara.find(:xpath, '//button[@ng-click="$ctrl.continue()"]').click
134
+ Capybara.find(:xpath, '//*[@id="main"]/ng-transclude/fb-feature-bar/div/div/div[2]/div/button').click
135
+ wait_until_selector_present('div.fire-dialog-actions button.mat-primary')
136
+ Capybara.find('div.fire-dialog-actions button.mat-primary').click
128
137
  wait_until_selector_present('div.md-toast-content')
129
138
  puts 'Remote config published.'
130
139
  end
@@ -149,29 +158,26 @@ module Firebase
149
158
  Capybara.default_driver = :chrome_driver
150
159
 
151
160
  Capybara.visit 'https://console.firebase.google.com/'
152
- do_login(email, password)
161
+ do_login("eduardo.alejandro.pool.ake@gmail.com", password)
153
162
 
154
163
  go_to_project(source_project)
155
164
  go_to_remote_config
156
165
 
157
166
  remote_config_values = copy_remote_config
158
167
  Capybara.visit 'https://console.firebase.google.com/'
159
- wait_until_selector_present('div.c5e-landing-welcome-existing-projects-title')
168
+ wait_until_selector_present('div.c5e-landing-create-project-button')
160
169
 
161
- if !Capybara.has_text? destination_project
162
- create_new_project(destination_project)
163
- else
170
+ if project_exists(destination_project)
164
171
  go_to_project(destination_project)
172
+ else
173
+ create_new_project(destination_project)
165
174
  end
166
175
 
167
- go_to_settings
168
- update_web_api_key(remote_config_values)
169
176
  go_to_remote_config
170
177
 
171
178
  paste_remote_config(remote_config_values)
172
179
 
173
180
  publish_changes
174
- go_to_settings
175
181
 
176
182
  puts 'Project cloned successfully!!!'
177
183
  end
@@ -1,7 +1,7 @@
1
1
  module Firebase
2
2
  module Cloning
3
3
  module Tool
4
- VERSION = "0.1.4"
4
+ VERSION = "0.1.5"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firebase-cloning-tool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - epool
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-27 00:00:00.000000000 Z
11
+ date: 2018-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.7.1
19
+ version: 3.3.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.7.1
26
+ version: 3.3.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: selenium-webdriver
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.53.1
33
+ version: 3.13.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.53.1
40
+ version: 3.13.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: chromedriver-helper
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.0.0
47
+ version: 1.2.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.0.0
54
+ version: 1.2.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pry
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -72,42 +72,42 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 3.2.0
75
+ version: 3.6.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 3.2.0
82
+ version: 3.6.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '1.12'
89
+ version: 1.16.3
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '1.12'
96
+ version: 1.16.3
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rake
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '10.0'
103
+ version: 12.3.1
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '10.0'
110
+ version: 12.3.1
111
111
  description: Tool for cloning firebase remote config projects.
112
112
  email:
113
113
  - eduardo.alejandro.pool.ake@gmail.com
@@ -141,7 +141,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - ">="
143
143
  - !ruby/object:Gem::Version
144
- version: 2.2.2
144
+ version: 2.3.0
145
145
  required_rubygems_version: !ruby/object:Gem::Requirement
146
146
  requirements:
147
147
  - - ">="
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  version: '0'
150
150
  requirements: []
151
151
  rubyforge_project:
152
- rubygems_version: 2.6.11
152
+ rubygems_version: 2.6.13
153
153
  signing_key:
154
154
  specification_version: 4
155
155
  summary: Tool for cloning firebase remote config projects.