leap_salesforce_ui 0.1.6 → 0.2.0

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: 1d7e63743b865e1a4fd706abeb9772fa5726a6304c336fe40dd6f32a455119b9
4
- data.tar.gz: da6bfe38c4f2479a0ddb06e748ff262ac80d45fe9872839d115c0ccdb1eda758
3
+ metadata.gz: 86c39389d370e267d626261bc6b31d1e9507188f2a6ec1419a7abff1e1890372
4
+ data.tar.gz: fcf1b213f877ca3c7eab4edf1ce80e91b1be3eed46f411f6e8fd2adc767548b2
5
5
  SHA512:
6
- metadata.gz: 9c0e05222bdb5c9c86f4367fc50a5e0bbb381d21329e7588cc4760011d636b4526aebe2e84db0ccf6ae60441186f673b6df70a73a1c370b3cbb54191d19f84c8
7
- data.tar.gz: 78456a3a7afcd73a3e7b779843f17485f45b6c11b406038fa1ec43bdf2b8aee1b9cb6bef4fa66796f44c32f571591e6db1ce7b8b8f636d2064c3383dc85ddb6d
6
+ metadata.gz: 91701a2ec7d396345b8633edf1d25f2d9e05eb887dba96fdb9f8b9c488ebfc9331c7c4fb8fbd2aa3b87942172591f27b210278cf815bf13098c8e836cbb561b4
7
+ data.tar.gz: a04f7e04e7e34d4a29ea1667fa38fc9c6b3c60f8e2776dac1f077a3fbd4ea6e4cb552c98fb55dec6811e5eb6d439151acc7c7dfa75a4bffb683ccbbf70abd7ae
data/ChangeLog CHANGED
@@ -1,3 +1,16 @@
1
+ Version 0.2.0
2
+ * Pass in security token defined by leap_salesforce with convention ENV['KEY'_token] to SOAP
3
+ session login
4
+
5
+ Version 0.1.9
6
+ * Ability to login through SOAP session with the LeapSalesforce.login_through_session parameter
7
+
8
+ Version 0.1.8
9
+ * Fixed Watir version at 6.19. Need to update syntax to work with latest version
10
+
11
+ Version 0.1.7
12
+ * Fixed filling in form for Salesforce's new layout
13
+
1
14
  Version 0.1.6
2
15
  * Bug fix
3
16
  * Not appending to Gemfile meant Rakefile could not load leap_salesfore_ui rake tasks
data/README.md CHANGED
@@ -100,7 +100,7 @@ RSpec.describe "Creating record" do
100
100
  end
101
101
  ```
102
102
 
103
- One doesn’t have to identify how to recognise first_name, last_name, etc.
103
+ One does not have to identify how to recognise first_name, last_name, etc.
104
104
  From the metadata it works out what kind of field (textfield, textarea, reference) and then
105
105
  finds the corresponding label and uses that to fill in the field.
106
106
 
@@ -125,6 +125,31 @@ 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
+ ### Authentication
136
+ If IP address for user profile is not allowed you will need to use a security token. See
137
+ leap_salesforce for how to set this for each user's key through environment variables.
138
+
139
+ ### Helpful commands
140
+
141
+ Go to Salesforce instance defined by logging in
142
+ ```ruby
143
+ LeapSalesforce.browser.goto SoqlHandler.instance_url
144
+ ```
145
+
146
+ Login through SOAP session to get information for browser
147
+ ```ruby
148
+ user = LeapSalesforce::Users.where username: LeapSalesforce.ui_user
149
+ session = LeapSalesforce::Session.new user.username, LeapSalesforce.password,
150
+ user.security_token
151
+ ```
152
+
128
153
  ## Development
129
154
 
130
155
  After checking out the repo, run `bin/setup` to install dependencies.
data/Rakefile CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "config/credentials/token" if File.exist? 'config/credentials/token.rb'
3
4
  require "bundler/gem_tasks"
4
5
  require "rspec/core/rake_task"
5
6
  require "leap_salesforce/rake"
@@ -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.2.1"
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
@@ -41,8 +41,18 @@ 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
+ user = LeapSalesforce::Users.where username: LeapSalesforce.ui_user
49
+ session = LeapSalesforce::Session.new user.username, LeapSalesforce.password, user.security_token
50
+ browser.cookies.add "sid", session.session_id
51
+ browser.cookies.add "sidClient", session.user_id
52
+ browser.goto SoqlHandler.instance_url
53
+ else
54
+ browser.goto "#{LeapSalesforce.general_url}/?un=#{LeapSalesforce.ui_user}&pw=#{LeapSalesforce.password}"
55
+ end
46
56
  continue_button = browser.button(id: "thePage:inputForm:continue")
47
57
  if continue_button.exists?
48
58
  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.6"
4
+ VERSION = "0.2.0"
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.6
4
+ version: 0.2.0
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-23 00:00:00.000000000 Z
12
+ date: 2022-02-09 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.2.1
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.2.1
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