leap_salesforce_ui 0.1.5 → 0.1.9

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
  SHA256:
3
- metadata.gz: 526d7426b4cbc68a811661af10184c81150a07d5b9f7441909758a84a6ff6353
4
- data.tar.gz: '0248a74aeaf95af16ac34ffecac449710687283b3b27bedef3bb0814e4d95106'
3
+ metadata.gz: a32b636aadfb8ad4d0a4cdbbacf3d5be6bd826b6ba68beb87229df3d16c35c9f
4
+ data.tar.gz: 1fb0bbfcccc439e62971da6c2fa044431f7f3a03aa899b2051be5e2568bfe50f
5
5
  SHA512:
6
- metadata.gz: 829da20fbece1a80e9e01e099d6bbdaf1d1f949670c9e91ac09d37154dd194c62fe91e9a5dd65586dc53a1597e80a3a2e0d9aa6b6fead07d61aa32cc0b051a76
7
- data.tar.gz: 0612cb14198ae7ec1cd0200ec952661346262aefab0c746f4e4fb3ded1a4d7269bb1c925bf593ab3280dfc7c37f4ce5a261b8585f4dd11119ddc514b84602272
6
+ metadata.gz: dbd02870870749274f24409c049899773df5080b0af2ecce9f98007ccbee275b3ac69dfcfddb4de5633a81c6ffd6f37bbeb195f496fcc6f3e1b86bf9fa823338
7
+ data.tar.gz: 4d9e90c2ee97d6f372f9951d15dc5bef78f3b08aef3253a7604cd9b4c31b0cf4bb61858970bb3cbe6877aefdd3879d629c3464b55ee1a4b347aa3dc0c57077bd
data/ChangeLog CHANGED
@@ -1,3 +1,16 @@
1
+ Version 0.1.9
2
+ * Ability to login through SOAP session with the LeapSalesforce.login_through_session parameter
3
+
4
+ Version 0.1.8
5
+ * Fixed Watir version at 6.19. Need to update syntax to work with latest version
6
+
7
+ Version 0.1.7
8
+ * Fixed filling in form for Salesforce's new layout
9
+
10
+ Version 0.1.6
11
+ * Bug fix
12
+ * Not appending to Gemfile meant Rakefile could not load leap_salesfore_ui rake tasks
13
+
1
14
  Version 0.1.5
2
15
  * Enhancements
3
16
  * Added logging of actions
data/README.md CHANGED
@@ -125,6 +125,26 @@ Follow other examples in `spec` to build tests using the auto-generated classes.
125
125
  unless run from an IP address that your Salesforce Org trusts. Many shared CI environments have runners that would
126
126
  be hard to whitelist as the address is dynamic.
127
127
 
128
+ ### Options
129
+
130
+ To run tests in headless mode, set headless mode to true.
131
+ ```ruby
132
+ LeapSalesforce.headless = true
133
+ ```
134
+
135
+
136
+ ### Helpful commands
137
+
138
+ Go to Salesforce instance defined by logging in
139
+ ```ruby
140
+ LeapSalesforce.browser.goto SoqlHandler.instance_url
141
+ ```
142
+
143
+ ```ruby
144
+
145
+ session = LeapSalesforce::Session.new LeapSalesforce.ui_user, LeapSalesforce.password
146
+ ```
147
+
128
148
  ## Development
129
149
 
130
150
  After checking out the repo, run `bin/setup` to install dependencies.
@@ -31,6 +31,7 @@ module LeapSalesforce
31
31
  def init
32
32
  puts "Initialising initial files to get started with leap_salesforce_ui"
33
33
  append "Rakefile", "Rakefile.erb"
34
+ append "Gemfile", "Gemfile.erb"
34
35
  puts 'Running Rake task "leaps:create_poms"'
35
36
  puts `rake leaps:create_poms`
36
37
  append File.join("spec", "spec_helper.rb"), "spec_helper.rb.erb"
@@ -29,8 +29,8 @@ It reads the Metadata from Salesforce and creates the foundation for UI tests.'
29
29
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
30
  spec.require_paths = ["lib"]
31
31
 
32
- spec.add_dependency "leap_salesforce", ">= 1.0.3"
33
- spec.add_dependency "watir", ">= 6.17.0"
32
+ spec.add_dependency "leap_salesforce", ">= 1.1.2"
33
+ spec.add_dependency "watir", "6.19.1"
34
34
  spec.add_dependency "webdrivers"
35
35
 
36
36
  # For more information and examples about making a new gem, checkout our
@@ -55,7 +55,8 @@ module LeapSalesforce
55
55
  def set_text_area(label, value)
56
56
  LeapSalesforce.logger.info "Setting text area, label '#{label}' with '#{value}'"
57
57
  field_transaction label, value do
58
- form.textarea(xpath: "//label[contains(.,'#{label}')]//following-sibling::textarea").set value
58
+ text_area = form.textarea(xpath: "//lightning-textarea[./label[contains(.,'#{label}')]]//following-sibling::div/textarea")
59
+ text_area.set value
59
60
  end
60
61
  end
61
62
 
@@ -88,11 +89,15 @@ module LeapSalesforce
88
89
  def set_picklist(label, value)
89
90
  LeapSalesforce.logger.info "Setting picklist, label '#{label}' with '#{value}'"
90
91
  field_transaction label, value do
91
- dropdown = form.link(xpath: "//*[./*[text()='#{label}']]//following-sibling::div//a")
92
+ dropdown = form.text_field(xpath: "//*[./*[text()='#{label}']]//following-sibling::div//input")
93
+ dropdown_id = dropdown.attribute "id"
94
+ LeapSalesforce.logger.debug "Using dropdown id: #{dropdown_id}"
92
95
  dropdown.focus
93
96
  sleep 0.5
94
97
  dropdown.click
95
- browser.link(xpath: ".//div[contains(@class, 'select-options')]//a[contains(.,'#{value}')]").click
98
+ has_value = "@data-value='#{value}'"
99
+ in_dropdown = "starts-with(@data-item-id, '#{dropdown_id}')"
100
+ browser.element(xpath: ".//lightning-base-combobox-item[#{has_value} and #{in_dropdown}]").click
96
101
  end
97
102
  self
98
103
  end
@@ -105,7 +110,7 @@ module LeapSalesforce
105
110
  field_transaction label, value do
106
111
  search_field = browser.text_field(xpath: "//label[contains(.,'#{ref_label}')]//following-sibling::div[1]//input")
107
112
  search_field.set search_val
108
- browser.div(xpath: "//div[contains(@data-aura-class,'forceSearchInputLookupDesktopActionItem') and contains(., 'Search')]").click
113
+ browser.element(xpath: ".//lightning-base-combobox-item[starts-with(.,'SearchShow')]").click
109
114
  browser.link(xpath: "//div[contains(@class,'searchScroller')]//a[contains(.,'#{search_val}')]").click
110
115
  end
111
116
  self
@@ -10,12 +10,16 @@ module LeapSalesforce
10
10
 
11
11
  # Create content in a file, adding to an existing file if present
12
12
  def append(filename, template_path)
13
- FileUtils.touch filename unless File.exist? filename
13
+ verb = "Appending to"
14
+ unless File.exist? filename
15
+ FileUtils.touch filename
16
+ verb = "Creating"
17
+ end
14
18
  content = read_template template_path, binding, folder: __dir__
15
19
  if File.read(filename).include?(content)
16
20
  puts "File '#{filename}' already has expected content, skipping...".colorize :red
17
21
  else
18
- puts "\u2713 Appending to #{filename}".colorize :green
22
+ puts "\u2713 #{verb} #{filename}".colorize :green
19
23
  open(filename, "a") { |f| f.puts content }
20
24
  end
21
25
  end
@@ -0,0 +1 @@
1
+ gem 'leap_salesforce_ui'
@@ -41,8 +41,17 @@ Go to #{DISABLE_2STEP_URL} to learn how to disable it"
41
41
  end
42
42
 
43
43
  def login
44
+ raise "Need to set LeapSalesforce.ui_user" unless LeapSalesforce.ui_user
44
45
  LeapSalesforce.logger.info "Logging in as user '#{LeapSalesforce.ui_user}'"
45
- browser.goto "#{LeapSalesforce.general_url}/?un=#{LeapSalesforce.ui_user}&pw=#{LeapSalesforce.password}"
46
+ if LeapSalesforce.login_through_session
47
+ browser.goto SoqlHandler.instance_url
48
+ session = LeapSalesforce::Session.new LeapSalesforce.ui_user, LeapSalesforce.password
49
+ browser.cookies.add "sid", session.session_id
50
+ browser.cookies.add "sidClient", session.user_id
51
+ browser.goto SoqlHandler.instance_url
52
+ else
53
+ browser.goto "#{LeapSalesforce.general_url}/?un=#{LeapSalesforce.ui_user}&pw=#{LeapSalesforce.password}"
54
+ end
46
55
  continue_button = browser.button(id: "thePage:inputForm:continue")
47
56
  if continue_button.exists?
48
57
  browser.checkbox(id: "thePage:inputForm:remember").set
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LeapSalesforceUi
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.9"
5
5
  end
@@ -35,6 +35,8 @@ module LeapSalesforce
35
35
  @ui_user = nil
36
36
  # @return [Boolean] Whether to run in headless mode
37
37
  @headless = false
38
+ # @return [Boolean] Whether to login using session obtained via SOAP
39
+ @login_through_session = false
38
40
  class << self
39
41
  def browser(test_name = nil)
40
42
  @browser ||= new_browser(test_name)
@@ -50,6 +52,8 @@ module LeapSalesforce
50
52
 
51
53
  # @return [Boolean] Whether to run in headless mode. Default false
52
54
  attr_accessor :headless
55
+ # @return [Boolean] Whether to login using session obtained via SOAP
56
+ attr_accessor :login_through_session
53
57
 
54
58
  # @param [String, Symbol, Regexp, LeapSalesforce::User] user User or email address of user
55
59
  def ui_user=(user)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leap_salesforce_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - IQA
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2021-02-16 00:00:00.000000000 Z
12
+ date: 2022-02-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: leap_salesforce
@@ -17,28 +17,28 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 1.0.3
20
+ version: 1.1.2
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 1.0.3
27
+ version: 1.1.2
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: watir
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ">="
32
+ - - '='
33
33
  - !ruby/object:Gem::Version
34
- version: 6.17.0
34
+ version: 6.19.1
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
39
+ - - '='
40
40
  - !ruby/object:Gem::Version
41
- version: 6.17.0
41
+ version: 6.19.1
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: webdrivers
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -91,6 +91,7 @@ files:
91
91
  - lib/leap_salesforce_ui/form_filler.rb
92
92
  - lib/leap_salesforce_ui/generator/appenders.rb
93
93
  - lib/leap_salesforce_ui/generator/page_objects.rb
94
+ - lib/leap_salesforce_ui/generator/templates/Gemfile.erb
94
95
  - lib/leap_salesforce_ui/generator/templates/Rakefile.erb
95
96
  - lib/leap_salesforce_ui/generator/templates/create_page.rb.erb
96
97
  - lib/leap_salesforce_ui/generator/templates/spec_helper.rb.erb