leap_salesforce_ui 0.2.0 → 0.3.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: 86c39389d370e267d626261bc6b31d1e9507188f2a6ec1419a7abff1e1890372
4
- data.tar.gz: fcf1b213f877ca3c7eab4edf1ce80e91b1be3eed46f411f6e8fd2adc767548b2
3
+ metadata.gz: 9e1be86926699d819e7022902b56f15ac1b8bdf1e57a66558a26c4cfc5a2285d
4
+ data.tar.gz: 6b590aa9a06d618c77e55280b56903b92ed8eeb5a6bf1f550bd91575f8e25c96
5
5
  SHA512:
6
- metadata.gz: 91701a2ec7d396345b8633edf1d25f2d9e05eb887dba96fdb9f8b9c488ebfc9331c7c4fb8fbd2aa3b87942172591f27b210278cf815bf13098c8e836cbb561b4
7
- data.tar.gz: a04f7e04e7e34d4a29ea1667fa38fc9c6b3c60f8e2776dac1f077a3fbd4ea6e4cb552c98fb55dec6811e5eb6d439151acc7c7dfa75a4bffb683ccbbf70abd7ae
6
+ metadata.gz: d9f507fcef6ccc42efebaa071ca82c23d2da3647a3b2320269a42c02f226e1d3d2497212ae7192e4a27c002045e3b2223cdbcba37fcdd548a50a183b5b1fa756
7
+ data.tar.gz: 3c49e8e58f6101fc3cd1bf7f378c93d4490de36a5893af083a43b702f6f288419d0772c9a4185f30bf04e5556ddf5e25905acfbe5ca6226765ff744d41e22cf4
data/.gitlab-ci.yml CHANGED
@@ -3,7 +3,7 @@ variables:
3
3
  client_id: $client_id
4
4
  client_secret: $client_secret
5
5
 
6
- test:
6
+ .zal_test:
7
7
  services:
8
8
  - docker:19.03.5-dind
9
9
  image: docker:19.03.5
@@ -24,5 +24,18 @@ test:
24
24
  variables:
25
25
  BROWSER: chrome
26
26
 
27
+ test:
28
+ image: ruby:2.7
29
+ script:
30
+ - export CHROME_VERSION="google-chrome-stable"
31
+ - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
32
+ - echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
33
+ - apt-get update -qqy
34
+ - apt-get -qqy install google-chrome-stable
35
+
36
+ - bundle install
37
+ - bundle exec rake leaps:create_poms
38
+ - bundle exec rake spec
39
+
27
40
  include:
28
41
  - template: Code-Quality.gitlab-ci.yml
data/.leap_salesforce.yml CHANGED
@@ -5,3 +5,4 @@ soql_objects:
5
5
  - Contact
6
6
  - Account
7
7
  - Broker: Broker__c
8
+ - RecordType
data/ChangeLog CHANGED
@@ -1,3 +1,9 @@
1
+ Version 0.3.0
2
+ * New
3
+ * Ability to set record type on creating an object with 'set_record_type' method
4
+ * Fixed
5
+ * New syntax for clicking on dropdown/picklist
6
+
1
7
  Version 0.2.0
2
8
  * Pass in security token defined by leap_salesforce with convention ENV['KEY'_token] to SOAP
3
9
  session login
data/README.md CHANGED
@@ -107,6 +107,14 @@ finds the corresponding label and uses that to fill in the field.
107
107
  This test then uses the API to setup a dependent account (through FactoryBot) and then to find the contact
108
108
  created to verify that what was entered on the UI was saved as expected.
109
109
 
110
+ To specify a record_type, call the `set_record_type` method after the `visit` method.
111
+ The default record type can be used by calling visit with
112
+ ```ruby
113
+ visit(use_record_type: false)
114
+ ```
115
+
116
+ > See create spec for example
117
+
110
118
  ### Manually specify label
111
119
 
112
120
  Sometimes the label on the UI does not match the metadata label. In that case, one case manually
data/install_chrome.sh ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ export CHROME_VERSION="google-chrome-stable"
3
+ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
4
+ echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
5
+ apt-get update -qqy
6
+ apt-get -qqy install google-chrome-stable
@@ -30,7 +30,7 @@ It reads the Metadata from Salesforce and creates the foundation for UI tests.'
30
30
  spec.require_paths = ["lib"]
31
31
 
32
32
  spec.add_dependency "leap_salesforce", ">= 1.2.1"
33
- spec.add_dependency "watir", "6.19.1"
33
+ spec.add_dependency "watir", "7"
34
34
  spec.add_dependency "webdrivers"
35
35
 
36
36
  # For more information and examples about making a new gem, checkout our
@@ -15,9 +15,11 @@ module BasePage
15
15
  end
16
16
 
17
17
  # Visit the current page, logging in if required
18
- def visit
18
+ # @param [Boolean] use_record_type Whether to specify record type
19
+ def visit(use_record_type: true)
19
20
  LoginPage.login
20
21
  page_url = "#{SoqlHandler.instance_url}/lightning/o/#{@soql_object.soql_object_name}/new"
22
+ page_url += '?useRecordTypeCheck=1' if use_record_type
21
23
  LeapSalesforce.logger.info "Visiting #{self}"
22
24
  browser.goto page_url
23
25
  self
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
+ require_relative 'set_record_type'
2
3
 
3
4
  # Base class for creating entities in Salesforce
4
5
  class CreatePage
5
6
  extend BasePage
6
7
  extend LeapSalesforce::FormFiller
8
+ extend LeapSalesforce::SetRecordType
7
9
  end
@@ -89,7 +89,7 @@ module LeapSalesforce
89
89
  def set_picklist(label, value)
90
90
  LeapSalesforce.logger.info "Setting picklist, label '#{label}' with '#{value}'"
91
91
  field_transaction label, value do
92
- dropdown = form.text_field(xpath: "//*[./*[text()='#{label}']]//following-sibling::div//input")
92
+ dropdown = form.button(xpath: "//*[./*[text()='#{label}']]//following-sibling::div//button")
93
93
  dropdown_id = dropdown.attribute "id"
94
94
  LeapSalesforce.logger.debug "Using dropdown id: #{dropdown_id}"
95
95
  dropdown.focus
@@ -0,0 +1,12 @@
1
+ module LeapSalesforce
2
+ module SetRecordType
3
+ # Set record type for an object before create form appears
4
+ def set_record_type(record_type)
5
+ LeapSalesforce.logger.info "Setting record type to '#{record_type}'"
6
+ option = browser.label(xpath: "//label[.//*[@class='slds-form-element__label' and text()='#{record_type}']]")
7
+ option.click
8
+ browser.button(text: 'Next').click
9
+ self
10
+ end
11
+ end
12
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LeapSalesforceUi
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
@@ -70,7 +70,7 @@ module LeapSalesforce
70
70
  def new_browser(test_name = nil)
71
71
  if ENV["WEBDRIVER_URL"]
72
72
  # TODO: Get working on Ruby 3
73
- Watir::Browser.new :chrome, { **zalenium_args("LeapSalesforce", test_name || "Test") }
73
+ Watir::Browser.new :chrome, options: { **zalenium_args("LeapSalesforce", test_name || "Test") }
74
74
  else
75
75
  args = {}
76
76
  args[:headless] = true if headless
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.2.0
4
+ version: 0.3.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: 2022-02-09 00:00:00.000000000 Z
12
+ date: 2022-02-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: leap_salesforce
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - '='
33
33
  - !ruby/object:Gem::Version
34
- version: 6.19.1
34
+ version: '7'
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.19.1
41
+ version: '7'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: webdrivers
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -83,6 +83,7 @@ files:
83
83
  - config/general.rb
84
84
  - docker-compose.yml
85
85
  - exe/leap_salesforce_ui
86
+ - install_chrome.sh
86
87
  - leap_salesforce_ui.gemspec
87
88
  - lib/leap_salesforce_ui.rb
88
89
  - lib/leap_salesforce_ui/base_page.rb
@@ -102,6 +103,7 @@ files:
102
103
  - lib/leap_salesforce_ui/page_introspection.rb
103
104
  - lib/leap_salesforce_ui/rake.rb
104
105
  - lib/leap_salesforce_ui/rake/pom.rake
106
+ - lib/leap_salesforce_ui/set_record_type.rb
105
107
  - lib/leap_salesforce_ui/update_page.rb
106
108
  - lib/leap_salesforce_ui/version.rb
107
109
  - lib/leap_salesforce_ui/view_page.rb