leap_salesforce_ui 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.gitlab-ci.yml +3 -0
- data/ChangeLog +5 -0
- data/Dockerfile +1 -1
- data/Gemfile +1 -0
- data/README.md +53 -7
- data/Rakefile +3 -1
- data/bin/console +2 -5
- data/bin/setup +1 -2
- data/exe/leap_salesforce_ui +1 -0
- data/leap_salesforce_ui.gemspec +2 -2
- data/lib/leap_salesforce_ui.rb +14 -7
- data/lib/leap_salesforce_ui/base_page.rb +0 -1
- data/lib/leap_salesforce_ui/create_page.rb +2 -90
- data/lib/leap_salesforce_ui/form_filler.rb +107 -0
- data/lib/leap_salesforce_ui/generator/page_objects.rb +30 -0
- data/lib/leap_salesforce_ui/generator/templates/create_page.rb.erb +5 -0
- data/lib/leap_salesforce_ui/generator/templates/update_page.rb.erb +5 -0
- data/lib/leap_salesforce_ui/generator/templates/view_page.rb.erb +5 -0
- data/lib/leap_salesforce_ui/login_page.rb +14 -6
- data/lib/leap_salesforce_ui/page_introspection.rb +11 -0
- data/lib/leap_salesforce_ui/rake.rb +4 -0
- data/lib/leap_salesforce_ui/rake/pom.rake +9 -0
- data/lib/leap_salesforce_ui/update_page.rb +16 -0
- data/lib/leap_salesforce_ui/version.rb +1 -1
- data/lib/leap_salesforce_ui/view_page.rb +6 -3
- data/run_tests_when_ready.sh +1 -1
- metadata +13 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65465514f36ec0940f42f0531e837572c823d3c1bddf7a2a230057628af1319c
|
4
|
+
data.tar.gz: 73e68defaa86dbecdccf8558fcb1e78681f5edd4f82f82ba625d18dfc8aaa096
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dd977fd6623b8a6ef334ede9abe640703a090a6c5586e9dc3aa0f03f15900550eea2e8be05169c3c97f3f012f8df55caaa29dbf39b8ad0d920f91eb174cc0b8
|
7
|
+
data.tar.gz: 8bbb5669682163a049fa1780ef99a2b5efd6197e5f4d688131eabc9cd0d275e616ca91eb5ace4c71c6f01ec4739129d58c16bf2a6b5cf16851d731a93ac1a5c3
|
data/.gitignore
CHANGED
data/.gitlab-ci.yml
CHANGED
data/ChangeLog
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
Version 0.1.2
|
2
|
+
* Enhancements
|
3
|
+
* Added Rake task to auto-generate page classes from soql_objects
|
4
|
+
* Added update base class to update entities in a similar way to creating them
|
5
|
+
|
1
6
|
Version 0.1.1
|
2
7
|
* Enhancements
|
3
8
|
* Add filling in of dropdown, reference field and text area to create
|
data/Dockerfile
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -23,21 +23,67 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
## Usage
|
25
25
|
|
26
|
-
|
26
|
+
This gem is an extension to [leap salesforce](https://gitlab.com/leap-dojo/leap_salesforce)
|
27
|
+
Setup `leap_salesforce` with `leap_salesforce init` and use the retrospective rake tasks to create soql objects.
|
27
28
|
|
28
|
-
|
29
|
+
Add the line `require 'leap_salesforce_ui/rake'` to your `Rakefile`. Then run the Rake task `rake leaps:create_poms`
|
30
|
+
which will generate page objects based upon the `soql_objects`
|
29
31
|
|
30
|
-
|
32
|
+
### Populate form using label in metadata
|
33
|
+
|
34
|
+
Following is a walk through of one of the tests
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
it "populate form and save" do
|
38
|
+
account = FactoryBot.create(:account)
|
39
|
+
CreateContactPage.visit.submit_with({ "First Name" => first_name,
|
40
|
+
last_name: last_name,
|
41
|
+
salutation: salutation,
|
42
|
+
other_street: other_street,
|
43
|
+
account_id: account.account_name})
|
44
|
+
contact_id = ViewContactPage.id
|
45
|
+
@contact = Contact.find(id: contact_id)
|
46
|
+
expect(@contact.first_name).to eq first_name
|
47
|
+
expect(@contact.last_name).to eq last_name
|
48
|
+
expect(@contact.salutation).to eq salutation
|
49
|
+
expect(@contact.other_street).to eq other_street
|
50
|
+
expect(@contact.account_id).to eq account.id
|
51
|
+
end
|
52
|
+
```
|
53
|
+
|
54
|
+
One doesn’t have to identify how to recognise first_name, last_name, etc.
|
55
|
+
From the metadata it works out what kind of field (textfield, textarea, reference) and then
|
56
|
+
finds the corresponding label and uses that to fill in the field.
|
57
|
+
|
58
|
+
This test then uses the API to setup a dependent account (through FactoryBot) and then to find the contact
|
59
|
+
created to verify that what was entered on the UI was saved as expected.
|
60
|
+
|
61
|
+
### Manually specify label
|
62
|
+
|
63
|
+
Sometimes the label on the UI does not match the metadata label. In that case, one case manually
|
64
|
+
specify the type of object, the label and what to set it to. E.g.,
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
UpdateAccountPage.visit(@account.id).set_picklist("Type", Account::AccountType.prospect).save
|
68
|
+
```
|
69
|
+
|
70
|
+
This will set a picklist with the label `Type` to the value defined by the picklist `AccountType`, and
|
71
|
+
the value `prospect`.
|
72
|
+
|
73
|
+
Follow other examples in `spec` to build tests using the auto-generated classes.
|
74
|
+
|
75
|
+
> These tests require that you [disable 2 step authentication for users](https://gitlab.com/leap-dojo/leap_salesforce_ui/-/wikis/Disable-2-step-authentication-and-allow-IP-range)
|
31
76
|
unless run from an IP address that your Salesforce Org trusts. Many shared CI environments have runners that would
|
32
77
|
be hard to whitelist as the address is dynamic.
|
33
78
|
|
34
|
-
> In the future a script will be used to scaffold base classes based on `.leap_salesforce.yml`
|
35
|
-
|
36
79
|
## Development
|
37
80
|
|
38
|
-
After checking out the repo, run `bin/setup` to install dependencies.
|
81
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
82
|
+
Then, run `rake spec` to run the tests.
|
83
|
+
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
39
84
|
|
40
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
85
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
86
|
+
To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
41
87
|
|
42
88
|
## Contributing
|
43
89
|
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -8,8 +8,5 @@ require "leap_salesforce_ui"
|
|
8
8
|
# with your gem easier. You can also use a different console, if you like.
|
9
9
|
|
10
10
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
require "irb"
|
15
|
-
IRB.start(__FILE__)
|
11
|
+
require "pry"
|
12
|
+
Pry.start
|
data/bin/setup
CHANGED
data/exe/leap_salesforce_ui
CHANGED
data/leap_salesforce_ui.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative "lib/leap_salesforce_ui/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "leap_salesforce_ui"
|
@@ -29,7 +29,7 @@ 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.
|
32
|
+
spec.add_dependency "leap_salesforce", ">= 1.0.3"
|
33
33
|
spec.add_dependency "watir"
|
34
34
|
spec.add_dependency "webdrivers"
|
35
35
|
|
data/lib/leap_salesforce_ui.rb
CHANGED
@@ -5,17 +5,23 @@ require "webdrivers"
|
|
5
5
|
require "leap_salesforce"
|
6
6
|
require_relative "leap_salesforce_ui/version"
|
7
7
|
require_relative "leap_salesforce_ui/base_page"
|
8
|
+
require_relative "leap_salesforce_ui/page_introspection"
|
9
|
+
require_relative "leap_salesforce_ui/form_filler"
|
8
10
|
require_relative "leap_salesforce_ui/create_page"
|
9
11
|
require_relative "leap_salesforce_ui/view_page"
|
12
|
+
require_relative "leap_salesforce_ui/update_page"
|
13
|
+
page_obj_folder = File.join(LeapSalesforce.lib_folder, "page_objects")
|
14
|
+
require_all page_obj_folder if Dir.exist? page_obj_folder
|
10
15
|
|
11
16
|
def zalenium_args(feature_name, scenario)
|
12
|
-
args = { timeout: 120, url: ENV[
|
17
|
+
args = { timeout: 120, url: ENV["WEBDRIVER_URL"], name: "Scenario: #{scenario} #{Time.now}",
|
13
18
|
'zal:build': "Feature: #{feature_name}" }
|
14
|
-
|
19
|
+
case ENV["BROWSER"]
|
20
|
+
when "chrome"
|
15
21
|
args.merge!('goog:chromeOptions': {
|
16
|
-
|
17
|
-
|
18
|
-
|
22
|
+
args: ENV["WEBDRIVER_CHROMEOPTIONS"]&.split(" ") || %w[]
|
23
|
+
})
|
24
|
+
when "firefox"
|
19
25
|
args.merge!(timeouts: 120)
|
20
26
|
end
|
21
27
|
args
|
@@ -50,8 +56,9 @@ module LeapSalesforce
|
|
50
56
|
private
|
51
57
|
|
52
58
|
def new_browser(test_name = nil)
|
53
|
-
if ENV[
|
54
|
-
|
59
|
+
if ENV["WEBDRIVER_URL"]
|
60
|
+
# TODO: Get working on Ruby 3
|
61
|
+
Watir::Browser.new :chrome, **zalenium_args("LeapSalesforce", test_name || "Test")
|
55
62
|
else
|
56
63
|
Watir::Browser.new
|
57
64
|
end
|
@@ -1,95 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
def new_panel
|
5
|
-
browser.div(class: "inlinePanel")
|
6
|
-
end
|
7
|
-
|
8
|
-
# Use metadata to get label for field
|
9
|
-
# @param [String] field
|
10
|
-
def get_label_for(field)
|
11
|
-
raise "SoqlObject not defined" unless @soql_object
|
12
|
-
|
13
|
-
return field if @soql_object.label_names.include? field
|
14
|
-
|
15
|
-
raise "Cannot find field #{field} on #{@soql_object}" unless @soql_object.accessors[field.to_sym]
|
16
|
-
|
17
|
-
@soql_object.accessors[field.to_sym][:label]
|
18
|
-
end
|
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
|
-
|
28
|
-
# Based on data type of field passed, fill in each field
|
29
|
-
# @param [Hash] data
|
30
|
-
def populate_with(data)
|
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
|
47
|
-
end
|
48
|
-
end
|
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
|
-
|
71
|
-
def submit_with(data)
|
72
|
-
populate_with data
|
73
|
-
save
|
74
|
-
end
|
75
|
-
|
76
|
-
# Save the current form, creating the new object
|
77
|
-
def save
|
78
|
-
browser.button(title: "Save").click
|
79
|
-
new_panel.wait_until do |panel|
|
80
|
-
browser_list = browser.ul(class: "errorsList")
|
81
|
-
if browser_list.exists?
|
82
|
-
errors = browser_list.lis
|
83
|
-
raise "Errors creating: #{errors.collect(&:text)}" if errors.count.positive?
|
84
|
-
end
|
85
|
-
|
86
|
-
!panel.present?
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
# Base class for creating entities
|
3
|
+
# Base class for creating entities in Salesforce
|
92
4
|
class CreatePage
|
93
5
|
extend BasePage
|
94
|
-
extend
|
6
|
+
extend LeapSalesforce::FormFiller
|
95
7
|
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module LeapSalesforce
|
4
|
+
module FormFiller
|
5
|
+
def new_panel
|
6
|
+
browser.div(class: "inlinePanel")
|
7
|
+
end
|
8
|
+
|
9
|
+
# Use metadata to get label for field
|
10
|
+
# @param [String] field
|
11
|
+
def get_label_for(field)
|
12
|
+
raise "SoqlObject not defined" unless @soql_object
|
13
|
+
|
14
|
+
return field if @soql_object.label_names.include? field
|
15
|
+
|
16
|
+
raise "Cannot find field #{field} on #{@soql_object}" unless @soql_object.accessors[field.to_sym]
|
17
|
+
|
18
|
+
@soql_object.accessors[field.to_sym][:label]
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [Hash] Description of field
|
22
|
+
def field_for(desc)
|
23
|
+
ruby_desc = @soql_object.accessors[desc.to_sym]
|
24
|
+
return ruby_desc if ruby_desc
|
25
|
+
|
26
|
+
@soql_object.properties_for(desc)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Based on data type of field passed, fill in each field
|
30
|
+
# @param [Hash] data
|
31
|
+
def populate_with(data)
|
32
|
+
sleep 1 # Being too fast can cause issues with first value. TODO: Wait for a condition
|
33
|
+
data.each do |desc, value|
|
34
|
+
field = field_for(desc)
|
35
|
+
label_name = field[:label] || field["label"]
|
36
|
+
|
37
|
+
type = field[:type] || field["type"]
|
38
|
+
case type
|
39
|
+
when "string"
|
40
|
+
set_text_field(label_name, value)
|
41
|
+
when "picklist" then set_picklist(label_name, value)
|
42
|
+
when "textarea"
|
43
|
+
new_panel.textarea(xpath: "//label[contains(.,'#{label_name}')]//following-sibling::textarea").set value
|
44
|
+
when "reference"
|
45
|
+
set_reference_field(label_name, value)
|
46
|
+
else
|
47
|
+
raise NotImplementedError, "#{type} not yet defined in #{self.class}"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
self
|
51
|
+
end
|
52
|
+
|
53
|
+
def set_text_field(label, value)
|
54
|
+
text_field = new_panel.text_field(xpath: "//label[contains(.,'#{label}')]//following-sibling::input")
|
55
|
+
text_field.focus
|
56
|
+
text_field.set! value
|
57
|
+
return self if text_field.value == value
|
58
|
+
|
59
|
+
sleep 2 # Wait a bit and then set field
|
60
|
+
text_field.set! value
|
61
|
+
self
|
62
|
+
end
|
63
|
+
|
64
|
+
# Set value of picklist
|
65
|
+
# @param [String] label Label of picklist
|
66
|
+
# @param [String] value Value to set picklist to
|
67
|
+
def set_picklist(label, value)
|
68
|
+
dropdown = new_panel.link(xpath: "//*[./*[text()='#{label}']]//following-sibling::div//a")
|
69
|
+
dropdown.focus
|
70
|
+
sleep 0.5
|
71
|
+
dropdown.click
|
72
|
+
browser.link(xpath: ".//div[contains(@class, 'select-options')]//a[contains(.,'#{value}')]").click
|
73
|
+
self
|
74
|
+
end
|
75
|
+
|
76
|
+
def set_reference_field(label, value)
|
77
|
+
ref_label = label.gsub("ID", "Name")
|
78
|
+
search_val = value[0..12]
|
79
|
+
search_field = browser.text_field(xpath: "//label[contains(.,'#{ref_label}')]//following-sibling::div[1]//input")
|
80
|
+
search_field.set search_val
|
81
|
+
browser.div(xpath: "//div[contains(@data-aura-class,'forceSearchInputLookupDesktopActionItem') and contains(., 'Search')]").click
|
82
|
+
browser.link(xpath: "//div[contains(@class,'searchScroller')]//a[contains(.,'#{search_val}')]").click
|
83
|
+
self
|
84
|
+
end
|
85
|
+
|
86
|
+
def submit_with(data)
|
87
|
+
populate_with data
|
88
|
+
save
|
89
|
+
end
|
90
|
+
|
91
|
+
# Save the current form, creating the new object
|
92
|
+
def save
|
93
|
+
browser.button(title: "Save").click
|
94
|
+
new_panel.wait_until do |panel|
|
95
|
+
browser_list = browser.ul(class: "errorsList")
|
96
|
+
if browser_list.exists?
|
97
|
+
sleep 3
|
98
|
+
errors = browser_list.lis
|
99
|
+
sleep 1 if errors.collect(&:text) != [""] # Wait for error to come
|
100
|
+
raise "Errors creating: #{errors.collect(&:text)}" if errors.count.positive?
|
101
|
+
end
|
102
|
+
|
103
|
+
!panel.present?
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "leap_salesforce/generator/generator"
|
4
|
+
|
5
|
+
module LeapSalesforce
|
6
|
+
# Generators for creating code
|
7
|
+
module Generator
|
8
|
+
# Creates SoqlObjects and related modules
|
9
|
+
class PageObjects
|
10
|
+
include Generator
|
11
|
+
|
12
|
+
POM_FOLDER = File.join(LeapSalesforce.lib_folder, "page_objects").freeze
|
13
|
+
|
14
|
+
def create
|
15
|
+
LeapSalesforce.objects_to_verify.each { |entity| create_poms_for entity }
|
16
|
+
end
|
17
|
+
|
18
|
+
# @param [LeapSalesforce::SoqlData] entity An object representing an object in Salesforce
|
19
|
+
def create_poms_for(entity)
|
20
|
+
@entity_name = entity
|
21
|
+
@soql_object = LeapSalesforce.soql_objects.find { |so| so.class_name == entity.to_s }
|
22
|
+
%w[create view update].each do |page_action|
|
23
|
+
content = read_template "#{page_action}_page.rb.erb", binding, folder: __dir__
|
24
|
+
file = File.join(POM_FOLDER, "#{@entity_name.to_s.snakecase}/#{page_action}_page.rb")
|
25
|
+
generate_file file, content, overwrite: false
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
class LoginPage
|
4
4
|
class << self
|
5
|
-
DISABLE_2STEP_URL =
|
5
|
+
DISABLE_2STEP_URL = "https://gitlab.com/leap-dojo/leap_salesforce_ui/-/wikis/Disable-2-step-authentication-and-allow-IP-range"
|
6
6
|
|
7
7
|
# @return [Watir::Browser]
|
8
8
|
def browser
|
@@ -21,18 +21,17 @@ class LoginPage
|
|
21
21
|
error_message_element.present?
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
# Could be used if a user wants to login through UI for login specific tests
|
25
|
+
# which should not be necessary
|
26
|
+
def login_manually
|
25
27
|
browser.goto LeapSalesforce.general_url
|
26
|
-
end
|
27
|
-
|
28
|
-
def login
|
29
28
|
browser.text_field(id: "username").set(LeapSalesforce.ui_user)
|
30
29
|
browser.text_field(id: "password").set(LeapSalesforce.password)
|
31
30
|
browser.button(id: "Login").click
|
32
31
|
Watir::Wait.until(timeout: 60, message: "Did not login within the expected time") do
|
33
32
|
raise "Cannot Login. #{error_message}" if error_message?
|
34
33
|
|
35
|
-
if browser.url.include?
|
34
|
+
if browser.url.include? "_ui/identity/verification/"
|
36
35
|
raise LeapSalesforce::SetupError, "2 step verification page appears.
|
37
36
|
Go to #{DISABLE_2STEP_URL} to learn how to disable it"
|
38
37
|
end
|
@@ -40,5 +39,14 @@ Go to #{DISABLE_2STEP_URL} to learn how to disable it"
|
|
40
39
|
!browser.url.include? LeapSalesforce.general_url
|
41
40
|
end
|
42
41
|
end
|
42
|
+
|
43
|
+
def login
|
44
|
+
browser.goto "#{LeapSalesforce.general_url}/?un=#{LeapSalesforce.ui_user}&pw=#{LeapSalesforce.password}"
|
45
|
+
continue_button = browser.button(id: "thePage:inputForm:continue")
|
46
|
+
if continue_button.exists?
|
47
|
+
browser.checkbox(id: "thePage:inputForm:remember").set
|
48
|
+
continue_button.click
|
49
|
+
end
|
50
|
+
end
|
43
51
|
end
|
44
52
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Base class for updating an entity in Salesforce
|
4
|
+
class UpdatePage
|
5
|
+
extend BasePage
|
6
|
+
extend LeapSalesforce::PageIntrospection
|
7
|
+
extend LeapSalesforce::FormFiller
|
8
|
+
|
9
|
+
class << self
|
10
|
+
def visit(id)
|
11
|
+
LoginPage.login
|
12
|
+
browser.goto "#{SoqlHandler.instance_url}/lightning/r/#{@soql_object}/#{id}/edit"
|
13
|
+
self
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,11 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Base class for viewing an entity in Salesforce
|
3
4
|
class ViewPage
|
4
5
|
extend BasePage
|
6
|
+
extend LeapSalesforce::PageIntrospection
|
5
7
|
class << self
|
6
|
-
|
7
|
-
|
8
|
-
|
8
|
+
def visit(id)
|
9
|
+
LoginPage.login
|
10
|
+
browser.goto "#{SoqlHandler.instance_url}lightning/r/#{@soql_object}/#{id}/view"
|
11
|
+
self
|
9
12
|
end
|
10
13
|
end
|
11
14
|
end
|
data/run_tests_when_ready.sh
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
2
|
# exit if a command returns a non-zero exit code and also print the commands and their args as they are executed
|
3
3
|
set -e -x
|
4
|
+
bin/setup # Setup POMs fresh each time testing generator
|
4
5
|
# Wait for Zalenium to be up and running
|
5
6
|
timeout 30 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' zalenium:4444/wd/hub/status)" != "200" ]]; do sleep 5; done' || false
|
6
|
-
bundle install
|
7
7
|
bundle exec rake spec
|
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.
|
4
|
+
version: 0.1.2
|
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-
|
12
|
+
date: 2021-02-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: leap_salesforce
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.0.
|
20
|
+
version: 1.0.3
|
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.
|
27
|
+
version: 1.0.3
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: watir
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,7 +87,16 @@ files:
|
|
87
87
|
- lib/leap_salesforce_ui.rb
|
88
88
|
- lib/leap_salesforce_ui/base_page.rb
|
89
89
|
- lib/leap_salesforce_ui/create_page.rb
|
90
|
+
- lib/leap_salesforce_ui/form_filler.rb
|
91
|
+
- lib/leap_salesforce_ui/generator/page_objects.rb
|
92
|
+
- lib/leap_salesforce_ui/generator/templates/create_page.rb.erb
|
93
|
+
- lib/leap_salesforce_ui/generator/templates/update_page.rb.erb
|
94
|
+
- lib/leap_salesforce_ui/generator/templates/view_page.rb.erb
|
90
95
|
- lib/leap_salesforce_ui/login_page.rb
|
96
|
+
- lib/leap_salesforce_ui/page_introspection.rb
|
97
|
+
- lib/leap_salesforce_ui/rake.rb
|
98
|
+
- lib/leap_salesforce_ui/rake/pom.rake
|
99
|
+
- lib/leap_salesforce_ui/update_page.rb
|
91
100
|
- lib/leap_salesforce_ui/version.rb
|
92
101
|
- lib/leap_salesforce_ui/view_page.rb
|
93
102
|
- run_tests_when_ready.sh
|