firebase-cloning-tool 0.1.0 → 0.1.1

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: 8bbc183fa81c4278c81c6c6799fcd6ff5af74095
4
- data.tar.gz: 59c9eb735d2afd8895c6f4f09e08f54d3166b295
3
+ metadata.gz: c94e5a8557c8f074c072221a47e03c80578e6cfa
4
+ data.tar.gz: 22a9b246ad25898b382207604c545c95ed763fa6
5
5
  SHA512:
6
- metadata.gz: 5934a4124fb6c9a705e1c56ce1ad5bc414abd5368da77bd1443e82ca77002191ee49be85b389a3be44f396f5a2ca6bec4cce8fa983ac688c7938a434c2eb4b30
7
- data.tar.gz: 82b73b5bfa574db035b88844f7e149e5f56d5792b3fc42708d76b248e626a1fb47d05c8644d8818a459ce0f4423451ab24e91edbcedaec6d85df5e2c119b1b02
6
+ metadata.gz: df2acbfdb03495216fa9948ea6d75c019b54ab37adb8710994a4e1272b3cb16431a8d411de791184cf18ead59d1992099123333d3028976db3e382fc688cddb9
7
+ data.tar.gz: 6d607fcaca48762700e8a0178d1dcbf4d3c99826ef984ec5f5e26bfec939f6e22e568c1babb708e3331367ae121a03caf1435e59b521d17dfd7b835310222724
@@ -8,76 +8,86 @@ module Firebase
8
8
  module Cloning
9
9
  module Tool
10
10
 
11
- def self.wait_until_text_is_present(text, wait=5)
11
+ def self.wait_until_selector_present(selector, wait=10)
12
12
  wait.times do
13
- break if Capybara.has_text? text
14
- puts 'Waiting for text: ' + text + '...'
13
+ break if Capybara.all(selector).any?
14
+ puts 'Waiting for selector: ' + selector + '...'
15
15
  sleep 1
16
16
  end
17
17
  end
18
18
 
19
- def self.wait_until_text_is_not_present(text, wait=5)
19
+ def self.wait_until_xpath_present(xpath, wait=10)
20
20
  wait.times do
21
- break if Capybara.has_no_text? text
22
- puts 'Waiting until text dissapear: ' + text + '...'
21
+ break if Capybara.all(:xpath, xpath).any?
22
+ puts 'Waiting for xpath: ' + xpath + '...'
23
23
  sleep 1
24
24
  end
25
25
  end
26
26
 
27
27
  def self.do_login(email, password)
28
28
  puts 'Trying sign in for ' + email + '...'
29
+ wait_until_selector_present('#Email')
29
30
  Capybara.fill_in('Email', with: email)
31
+ wait_until_selector_present('#next')
30
32
  Capybara.find('#next').click
33
+ wait_until_selector_present('#Passwd')
31
34
  Capybara.fill_in('Passwd', with: password)
35
+ wait_until_selector_present('#signIn')
32
36
  Capybara.find('#signIn').click
33
- wait_until_text_is_present('Welcome back to Firebase')
37
+ wait_until_selector_present('div.c5e-landing-welcome-existing-projects-title')
34
38
  puts 'Sign in completed.'
35
39
  end
36
40
 
37
41
  def self.go_to_settings
38
42
  puts 'Going to project settings...'
39
43
  Capybara.find('.md-button.md-gmp-blue-theme.md-ink-ripple.md-icon-button').click
40
- Capybara.find('button', :text => 'Project settings').click
41
- wait_until_text_is_present('Web API Key')
44
+ Capybara.find(:xpath, '//button[@ng-click="controller.navEntryClick(controller.settings)"]').click
45
+ wait_until_xpath_present('//span[@ng-if="::controller.webApiKey"]')
42
46
  puts 'Project settings loaded.'
43
47
  end
44
48
 
45
49
  def self.update_web_api_key(remoteConfigValues)
50
+ if !remoteConfigValues.key?('firebase_web_api_key')
51
+ return
52
+ end
46
53
  puts 'Updating web api key...'
47
- web_api_key = Capybara.find('label', :text => 'Web API Key').first(:xpath,".//..").find('span').text()
54
+ web_api_key = Capybara.find(:xpath, '//span[@ng-if="::controller.webApiKey"]').text
48
55
  remoteConfigValues['firebase_web_api_key'] = web_api_key
49
56
  puts 'Web api key updated.'
50
57
  end
51
58
 
52
59
  def self.create_new_project(project_name)
53
60
  puts 'Creating new project: ' + project_name + '...'
54
- Capybara.find('button', :text => 'CREATE NEW PROJECT').click
55
- Capybara.find(:xpath, '//input[@placeholder="My awesome project"]').set project_name
56
- Capybara.find('button', :text => 'CREATE PROJECT').click
57
- wait_until_text_is_not_present('Create a project')
61
+ Capybara.find(:xpath, '//button[@ng-click="controller.showCreateProjectDialog()"]').click
62
+ Capybara.find(:xpath, '//input[@name="projectName"]').set project_name
63
+ Capybara.find(:xpath, '//button[@ng-click="controller.createProject()"]').click
64
+ wait_until_xpath_present('//button[@ng-click="controller.closeCreateProjectDialog()"]')
58
65
  puts 'Project ' + project_name + ' created.'
59
- wait_until_text_is_present('Overview')
66
+ wait_until_selector_present('div.fb-featurebar-title')
60
67
  puts 'Project ' + project_name + ' loaded.'
61
68
  end
62
69
 
63
70
  def self.go_to_project(project_name)
64
71
  puts 'Opening ' + project_name + ' project...'
65
72
  Capybara.find('md-card', :text => project_name).click
66
- wait_until_text_is_present('Overview')
73
+ wait_until_selector_present('div.fb-featurebar-title')
67
74
  puts 'Project ' + project_name + ' loaded.'
68
75
  end
69
76
 
70
- def self.go_to_remote_config(has_config=false)
77
+ def self.go_to_remote_config()
71
78
  puts 'Going to remote config...'
72
79
  Capybara.find('.c5e-entry-displayname', :text => 'Remote Config').first(:xpath,".//..").click
73
- if has_config
74
- puts 'Waiting for remote config data...'
75
- wait_until_text_is_present('ADD PARAMETER')
76
- Capybara.find('button', :text => 'ADD PARAMETER').click
77
- else
80
+
81
+ wait_until_selector_present('div.fb-featurebar-title')
82
+
83
+ if Capybara.all('img.fb-zero-state-image').any?
78
84
  puts 'Waiting to add new remote config data...'
79
- wait_until_text_is_present('ADD YOUR FIRST PARAMETER')
80
- Capybara.find('button', :text => 'ADD YOUR FIRST PARAMETER').click
85
+ wait_until_xpath_present('//button[@ng-click="fbButtonCtaClick($event)"]')
86
+ Capybara.find(:xpath, '//button[@ng-click="fbButtonCtaClick($event)"]').click
87
+ else
88
+ puts 'Waiting for remote config data...'
89
+ wait_until_xpath_present('//button[@ng-click="controller.addParameter($event)"]')
90
+ Capybara.find(:xpath, '//button[@ng-click="controller.addParameter($event)"]').click
81
91
  end
82
92
  puts 'Remote config loaded.'
83
93
  end
@@ -97,19 +107,23 @@ module Firebase
97
107
  puts 'Pasting remote config from memory...'
98
108
  remoteConfigValues.each do | key, value |
99
109
  Capybara.find(:xpath, '//input[@name="paramKey"]').set key
100
- Capybara.find(:xpath, '//input[@placeholder="(empty string)"]').set value
101
- Capybara.find('button', :text => 'ADD PARAMETER').click
102
- Capybara.find('button', :text => 'ADD PARAMETER').click
110
+ Capybara.find(:xpath, '//input[@ng-model="property:controller.valueOption.value"]').set value
111
+ if Capybara.all(:xpath, '//button[@ng-click="controller.addParameter($event)"]').any?
112
+ Capybara.find(:xpath, '//button[@ng-click="controller.addParameter($event)"]').click
113
+ else
114
+ Capybara.find(:xpath, '//button[@ng-click="pe.onSubmitHandler()"]').click
115
+ end
116
+ Capybara.find(:xpath, '//button[@ng-click="controller.addParameter($event)"]').click
103
117
  end
104
- Capybara.find('button', :text => 'CANCEL').click
118
+ Capybara.find(:xpath, '//button[@ng-click="pe.onCancel()"]').click
105
119
  puts 'Remote config pasted.'
106
120
  end
107
121
 
108
122
  def self.publish_changes
109
123
  puts 'Publishing remote config...'
110
- Capybara.find('button.md-secondary', :text => 'PUBLISH CHANGES').click
111
- Capybara.find('button.md-primary', :text => 'PUBLISH CHANGES').click
112
- wait_until_text_is_present('Published')
124
+ Capybara.find(:xpath, '//button[@ng-click="featureBar.primaryButton.buttonAction()"]').click
125
+ Capybara.find(:xpath, '//button[@ng-click="$ctrl.continue()"]').click
126
+ wait_until_selector_present('div.md-toast-content')
113
127
  puts 'Remote config published.'
114
128
  end
115
129
 
@@ -119,9 +133,9 @@ module Firebase
119
133
  print 'Password: '
120
134
  password = STDIN.noecho(&:gets).chomp
121
135
  puts
122
- print 'Source(Project Name): '
136
+ print 'Source(Project Name, Case sensitive): '
123
137
  source_project = gets.chomp
124
- print 'Destination(New Project Name): '
138
+ print 'Destination(New Project Name, Case sensitive, Only letters, numbers, spaces, and these characters: -!\'") : '
125
139
  destination_project = gets.chomp
126
140
 
127
141
  # overrides selenium's driver to use chrome browser
@@ -136,11 +150,11 @@ module Firebase
136
150
  do_login(email, password)
137
151
 
138
152
  go_to_project(source_project)
139
- go_to_remote_config(true)
153
+ go_to_remote_config()
140
154
 
141
155
  remoteConfigValues = copy_remote_config()
142
156
  Capybara.visit 'https://console.firebase.google.com/'
143
- wait_until_text_is_present('Welcome back to Firebase')
157
+ wait_until_selector_present('div.c5e-landing-welcome-existing-projects-title')
144
158
 
145
159
  if !Capybara.has_text? destination_project
146
160
  create_new_project(destination_project)
@@ -1,7 +1,7 @@
1
1
  module Firebase
2
2
  module Cloning
3
3
  module Tool
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
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.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - epool
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-05 00:00:00.000000000 Z
11
+ date: 2016-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara