leap_salesforce_ui 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
  SHA256:
3
- metadata.gz: 34a3cff8f0fe0cb8b8b3c80d45a2dd9bf9a875c9f97692230b673ebbf52526ad
4
- data.tar.gz: a289dd23876c1b998a4e6665c2c6d813f0563e0030e175a08c1c001d7cd41664
3
+ metadata.gz: 49dd5004bf8b345bd392443488da5b806db264a7dd50dd2aa5ab9992d1169028
4
+ data.tar.gz: a091e11758fafcb039c7cf7bdd1bc06a061d605e742704e8ffc7bd4198a30395
5
5
  SHA512:
6
- metadata.gz: 6f38f584f42b2c6b069d54e36e2174780dee40bc9c9b3498f6ea1eb718c46f925711a78023e2610fd57ced91711123c2ccbc20f9e163af7ee65119db6ce90e8f
7
- data.tar.gz: 248b5b4ba8d953e2fe83ad672d590394ee4686f7b258b1b9ed0936bc43ce8752152e04c0a893047c2c9a8515fff029420bab49e5d85005a64bd7ee6415b61d55
6
+ metadata.gz: 9462ecb9055aa0d8902096b5b4a2189e8e7fcb3bcd6ed2f25fe252e197d0df6fde9c3436f014f79375850c9fb462b81c62dc5921ef2ccf70f9bafdbf09120a5d
7
+ data.tar.gz: 076a3803d5be1a35d0da5dc4114482a15f4f6d22f372a2a00a5ca9da0c196f50f5e949e8cf0dfff3007c5e9d2b5f2e4cff7929389e3f039520e69d578246202a
data/.gitignore CHANGED
@@ -14,9 +14,6 @@
14
14
  # Gem version
15
15
  Gemfile.lock
16
16
 
17
- # Generated files for now
18
- spec/support/
19
-
20
17
  # Here are folders related to testing this project in it's own CI
21
18
  config/credentials/
22
19
 
@@ -3,3 +3,4 @@ lib_folder: spec/support
3
3
  sfdx: false
4
4
  soql_objects:
5
5
  - Contact
6
+ - Account
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ Version 0.1.1
2
+ * Enhancements
3
+ * Add filling in of dropdown, reference field and text area to create
4
+
1
5
  Version 0.1.0
2
6
  * Enhancements
3
7
  * Initial version with example of using the UI in an integration test
data/Rakefile CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "bundler/gem_tasks"
4
4
  require "rspec/core/rake_task"
5
+ require 'leap_salesforce/rake'
5
6
 
6
7
  RSpec::Core::RakeTask.new(:spec)
7
8
 
@@ -17,16 +17,57 @@ module NewMethods
17
17
  @soql_object.accessors[field.to_sym][:label]
18
18
  end
19
19
 
20
+ # @return [Hash] Description of field
21
+ def field_for(desc)
22
+ ruby_desc = @soql_object.accessors[desc.to_sym]
23
+ return ruby_desc if ruby_desc
24
+
25
+ @soql_object.properties_for(desc)
26
+ end
27
+
20
28
  # Based on data type of field passed, fill in each field
21
29
  # @param [Hash] data
22
30
  def populate_with(data)
23
- data.each do |field, value|
24
- label_name = get_label_for field
25
- # TODO: Change based on type
26
- new_panel.text_field(xpath: "//label[contains(.,'#{label_name}')]//following-sibling::input").set value
31
+ data.each do |desc, value|
32
+ field = field_for(desc)
33
+ label_name = field[:label] || field['label']
34
+
35
+ type = field[:type] || field['type']
36
+ case type
37
+ when 'string'
38
+ new_panel.text_field(xpath: "//label[contains(.,'#{label_name}')]//following-sibling::input").set value
39
+ when 'picklist' then set_picklist(label_name, value)
40
+ when 'textarea'
41
+ new_panel.textarea(xpath: "//label[contains(.,'#{label_name}')]//following-sibling::textarea").set value
42
+ when 'reference'
43
+ set_reference_field(label_name, value)
44
+ else
45
+ raise NotImplementedError, "#{type} not yet defined in #{self.class}"
46
+ end
27
47
  end
28
48
  end
29
49
 
50
+ # Set value of picklist
51
+ # @param [String] label Label of picklist
52
+ # @param [String] value Value to set picklist to
53
+ def set_picklist(label, value)
54
+ dropdown = new_panel.link(xpath: "//*[./*[text()='#{label}']]//following-sibling::div//a")
55
+ dropdown.focus
56
+ sleep 0.5
57
+ dropdown.click
58
+ browser.link(xpath: ".//div[contains(@class, 'select-options')]//a[contains(.,'#{value}')]").click
59
+ end
60
+
61
+ def set_reference_field(label, value)
62
+ ref_label = label.gsub('ID', 'Name')
63
+ search_val = value[0..12]
64
+ search_field = browser.text_field(xpath: "//label[contains(.,'#{ref_label}')]//following-sibling::div[1]//input")
65
+ search_field.set search_val
66
+ sleep 1.5
67
+ search_field.send_keys :enter
68
+ browser.link(xpath: "//div[contains(@class,'searchScroller')]//a[contains(.,'#{search_val}')]").click
69
+ end
70
+
30
71
  def submit_with(data)
31
72
  populate_with data
32
73
  save
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LeapSalesforceUi
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
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.0
4
+ version: 0.1.1
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-01-29 00:00:00.000000000 Z
12
+ date: 2021-01-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: leap_salesforce