leap_salesforce_ui 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 34a3cff8f0fe0cb8b8b3c80d45a2dd9bf9a875c9f97692230b673ebbf52526ad
4
+ data.tar.gz: a289dd23876c1b998a4e6665c2c6d813f0563e0030e175a08c1c001d7cd41664
5
+ SHA512:
6
+ metadata.gz: 6f38f584f42b2c6b069d54e36e2174780dee40bc9c9b3498f6ea1eb718c46f925711a78023e2610fd57ced91711123c2ccbc20f9e163af7ee65119db6ce90e8f
7
+ data.tar.gz: 248b5b4ba8d953e2fe83ad672d590394ee4686f7b258b1b9ed0936bc43ce8752152e04c0a893047c2c9a8515fff029420bab49e5d85005a64bd7ee6415b61d55
@@ -0,0 +1,30 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /.idea/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
13
+
14
+ # Gem version
15
+ Gemfile.lock
16
+
17
+ # Generated files for now
18
+ spec/support/
19
+
20
+ # Here are folders related to testing this project in it's own CI
21
+ config/credentials/
22
+
23
+ # sfdx
24
+ /JWT/
25
+ /scripts/setup_env.sh
26
+ sf_log.log
27
+ */server.*
28
+
29
+ # Logs
30
+ /logs/
@@ -0,0 +1,24 @@
1
+ variables:
2
+ password: $password
3
+ client_id: $client_id
4
+ client_secret: $client_secret
5
+
6
+ test:
7
+ services:
8
+ - docker:19.03.5-dind
9
+ image: docker:19.03.5
10
+ stage: test
11
+ script:
12
+ - apk add docker-compose
13
+ - docker-compose version
14
+ - docker pull --quiet elgalu/selenium:3.141.59-p37 # Explicitly pull selenium image with working version
15
+ - docker-compose up --abort-on-container-exit --exit-code-from test
16
+ artifacts:
17
+ paths:
18
+ - tmp/ # Where video is stored
19
+ reports:
20
+ junit: logs/*.xml
21
+ expire_in: 1 week
22
+ when: always
23
+ variables:
24
+ BROWSER: chrome
@@ -0,0 +1,5 @@
1
+ environment: prod
2
+ lib_folder: spec/support
3
+ sfdx: false
4
+ soql_objects:
5
+ - Contact
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
@@ -0,0 +1 @@
1
+ leap_salesforce_ui
@@ -0,0 +1 @@
1
+ ruby-3.0.0
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at TODO: Write your email address. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
@@ -0,0 +1,3 @@
1
+ Version 0.1.0
2
+ * Enhancements
3
+ * Initial version with example of using the UI in an integration test
@@ -0,0 +1,16 @@
1
+ FROM ruby:2.6
2
+ MAINTAINER Samuel Garratt
3
+
4
+ # Required ruby gems
5
+ RUN mkdir /mysuite
6
+ WORKDIR /mysuite
7
+ COPY Gemfile /mysuite/Gemfile
8
+ COPY leap_salesforce_ui.gemspec /mysuite/leap_salesforce_ui.gemspec
9
+ COPY lib/leap_salesforce_ui/version.rb /mysuite/lib/leap_salesforce_ui/version.rb
10
+ RUN gem install bundler
11
+ RUN bundle install
12
+
13
+ # Add language settings to handle special characters
14
+ RUN export LANG=C.UTF-8
15
+ RUN export LANGUAGE=C.UTF-8
16
+ RUN export LC_ALL=C.UTF-8
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in leap_salesforce_ui.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+
12
+ gem "rubocop", "~> 1.7"
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 TODO: Write your name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,52 @@
1
+ # LeapSalesforce Ui
2
+
3
+ UI capability built on top of `leap_salesforce` gem to aid getting started
4
+ with UI testing in Salesforce fast and easy.
5
+
6
+ > This only works in Lightning view, not classic. If you need UI testing of classic, raise an issue
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'leap_salesforce_ui'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle install
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install leap_salesforce_ui
23
+
24
+ ## Usage
25
+
26
+ Setup `leap_salesforce` with `leap_salesforce init`.
27
+
28
+ Follow examples in `spec` to build a test using base classes.
29
+
30
+ 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
+ unless run from an IP address that your Salesforce Org trusts. Many shared CI environments have runners that would
32
+ be hard to whitelist as the address is dynamic.
33
+
34
+ > In the future a script will be used to scaffold base classes based on `.leap_salesforce.yml`
35
+
36
+ ## Development
37
+
38
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
39
+
40
+ To install this gem onto your local machine, run `bundle exec rake install`. 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
+
42
+ ## Contributing
43
+
44
+ Bug reports and pull requests are welcome on GitLab at https://gitlab.com/leap-dojo/leap_salesforce_ui. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://gitlab.com/leap-dojo/leap_salesforce_ui/blob/master/CODE_OF_CONDUCT.md).
45
+
46
+ ## License
47
+
48
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
49
+
50
+ ## Code of Conduct
51
+
52
+ Everyone interacting in the LeapSalesforceUi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://gitlab.com/leap-dojo/leap_salesforce_ui/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec]
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "leap_salesforce_ui"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Add users to LeapSalesforce context. First user is the default
4
+ module LeapSalesforce
5
+ Users.add User.new :admin, "samuel.garratt@brave-otter-ttxype.com"
6
+ Users.add User.new :not_there, "not.there@brave-otter-ttxype.com"
7
+ Users.add User.new :cet, "test.cet@brave-otter-ttxype.com"
8
+ end
9
+
10
+ ENV["SF_USERNAME"] = "samuel.garratt@brave-otter-ttxype.com"
@@ -0,0 +1,32 @@
1
+ version: '3.7'
2
+
3
+ services:
4
+ #--------------#
5
+ zalenium:
6
+ image: "dosel/zalenium"
7
+ hostname: zalenium
8
+ tty: true
9
+ volumes:
10
+ - ./tmp:/home/seluser/videos
11
+ - /var/run/docker.sock:/var/run/docker.sock
12
+ ports:
13
+ - 4444 # Using just container port (an ephemeral host port is chosen)
14
+ command: start --sendAnonymousUsageInfo false
15
+ environment:
16
+ TZ: Pacific/Auckland
17
+ shm_size: '2gb' # Needed for Firefox to work from docker in docker
18
+ test:
19
+ build: .
20
+ command: ./run_tests_when_ready.sh
21
+ volumes:
22
+ - .:/mysuite
23
+ depends_on:
24
+ - zalenium
25
+ environment:
26
+ WEBDRIVER_URL: http://zalenium:4444/wd/hub # the WebDriver container, referenced by its service name
27
+ WEBDRIVER_CHROMEOPTIONS: start-maximized disable-popup-blocking no-sandbox disable-dev-shm-usage # additional chrome args separated by a space
28
+ remote: "true"
29
+ BROWSER: "${BROWSER}"
30
+ client_id: "${client_id}"
31
+ password: "${password}"
32
+ client_secret: "${client_secret}"
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "leap_salesforce_ui"
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/leap_salesforce_ui/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "leap_salesforce_ui"
7
+ spec.version = LeapSalesforceUi::VERSION
8
+ spec.authors = ["IQA", "Samuel Garratt"]
9
+ spec.email = %w[samuel.garratt@integrationqa.com leap.salesforce@integrationqa.com]
10
+
11
+ spec.summary = 'Helps with setting up integrated automated test frameworks
12
+ against Salesforce UI.'
13
+ spec.description = 'This gem helps ones to perform integration tests on Salesforce.
14
+ It reads the Metadata from Salesforce and creates the foundation for UI tests.'
15
+ spec.homepage = "https://gitlab.com/leap-dojo/leap_salesforce_ui"
16
+ spec.license = "MIT"
17
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.5")
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = "https://gitlab.com/leap-dojo/leap_salesforce_ui"
21
+ spec.metadata["changelog_uri"] = "https://gitlab.com/leap-dojo/leap_salesforce_ui/ChangeLog"
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:spec)/}) }
27
+ end
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+
32
+ spec.add_dependency "leap_salesforce", ">= 1.0.2"
33
+ spec.add_dependency "watir"
34
+ spec.add_dependency "webdrivers"
35
+
36
+ # For more information and examples about making a new gem, checkout our
37
+ # guide at: https://bundler.io/guides/creating_gem.html
38
+ end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "watir"
4
+ require "webdrivers"
5
+ require "leap_salesforce"
6
+ require_relative "leap_salesforce_ui/version"
7
+ require_relative "leap_salesforce_ui/base_page"
8
+ require_relative "leap_salesforce_ui/create_page"
9
+ require_relative "leap_salesforce_ui/view_page"
10
+
11
+ def zalenium_args(feature_name, scenario)
12
+ args = { timeout: 120, url: ENV['WEBDRIVER_URL'], name: "Scenario: #{scenario} #{Time.now}",
13
+ 'zal:build': "Feature: #{feature_name}" }
14
+ if ENV['BROWSER'] == 'chrome'
15
+ args.merge!('goog:chromeOptions': {
16
+ args: ENV['WEBDRIVER_CHROMEOPTIONS']&.split(' ') || %w[]
17
+ })
18
+ elsif ENV['BROWSER'] == 'firefox'
19
+ args.merge!(timeouts: 120)
20
+ end
21
+ args
22
+ end
23
+
24
+ # Adding additional UI capability to leap_salesforce gem
25
+ module LeapSalesforce
26
+ # @return [String] User for UI
27
+ @ui_user = nil
28
+ class << self
29
+ def browser(test_name = nil)
30
+ @browser ||= new_browser(test_name)
31
+ end
32
+
33
+ def close_browser
34
+ @browser&.close
35
+ @browser = nil
36
+ end
37
+
38
+ attr_reader :ui_user
39
+
40
+ # @param [String, Symbol, Regexp, LeapSalesforce::User] user User or email address of user
41
+ def ui_user=(user)
42
+ @ui_user = if user.is_a? String
43
+ user
44
+ else
45
+ LeapSalesforce::Users.where(user)&.username
46
+ end
47
+ Soaspec::SpecLogger.info "Using user '#{@ui_user}' for UI"
48
+ end
49
+
50
+ private
51
+
52
+ def new_browser(test_name = nil)
53
+ if ENV['WEBDRIVER_URL']
54
+ Watir::Browser.new :chrome, **zalenium_args('LeapSalesforce', test_name || 'Test')
55
+ else
56
+ Watir::Browser.new
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "login_page"
4
+
5
+ module BasePage
6
+ # @return [Watir::Browser]
7
+ def browser
8
+ LeapSalesforce.browser
9
+ end
10
+
11
+ def soql_object(soql_object)
12
+ @soql_object = soql_object
13
+ end
14
+
15
+ def visit
16
+ LoginPage.visit
17
+ LoginPage.login
18
+ page_url = "#{SoqlHandler.instance_url}/lightning/o/#{@soql_object}/new"
19
+ browser.goto page_url
20
+ self
21
+ end
22
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NewMethods
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
+ # Based on data type of field passed, fill in each field
21
+ # @param [Hash] data
22
+ 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
27
+ end
28
+ end
29
+
30
+ def submit_with(data)
31
+ populate_with data
32
+ save
33
+ end
34
+
35
+ # Save the current form, creating the new object
36
+ def save
37
+ browser.button(title: "Save").click
38
+ new_panel.wait_until do |panel|
39
+ browser_list = browser.ul(class: "errorsList")
40
+ if browser_list.exists?
41
+ errors = browser_list.lis
42
+ raise "Errors creating: #{errors.collect(&:text)}" if errors.count.positive?
43
+ end
44
+
45
+ !panel.present?
46
+ end
47
+ end
48
+ end
49
+
50
+ # Base class for creating entities
51
+ class CreatePage
52
+ extend BasePage
53
+ extend NewMethods
54
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ class LoginPage
4
+ class << self
5
+ DISABLE_2STEP_URL = 'https://gitlab.com/leap-dojo/leap_salesforce_ui/-/wikis/Disable-2-step-authentication-and-allow-IP-range'
6
+
7
+ # @return [Watir::Browser]
8
+ def browser
9
+ LeapSalesforce.browser
10
+ end
11
+
12
+ def error_message_element
13
+ browser.div(id: "error")
14
+ end
15
+
16
+ def error_message
17
+ error_message_element.text
18
+ end
19
+
20
+ def error_message?
21
+ error_message_element.present?
22
+ end
23
+
24
+ def visit
25
+ browser.goto LeapSalesforce.general_url
26
+ end
27
+
28
+ def login
29
+ browser.text_field(id: "username").set(LeapSalesforce.ui_user)
30
+ browser.text_field(id: "password").set(LeapSalesforce.password)
31
+ browser.button(id: "Login").click
32
+ Watir::Wait.until(timeout: 60, message: "Did not login within the expected time") do
33
+ raise "Cannot Login. #{error_message}" if error_message?
34
+
35
+ if browser.url.include? '_ui/identity/verification/'
36
+ raise LeapSalesforce::SetupError, "2 step verification page appears.
37
+ Go to #{DISABLE_2STEP_URL} to learn how to disable it"
38
+ end
39
+
40
+ !browser.url.include? LeapSalesforce.general_url
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LeapSalesforceUi
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ViewPage
4
+ extend BasePage
5
+ class << self
6
+ # @return [String] Id of current entity
7
+ def id
8
+ LeapSalesforce.browser.url.split("/")[-2]
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env bash
2
+ # exit if a command returns a non-zero exit code and also print the commands and their args as they are executed
3
+ set -e -x
4
+ # Wait for Zalenium to be up and running
5
+ 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
+ bundle exec rake spec
metadata ADDED
@@ -0,0 +1,121 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: leap_salesforce_ui
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - IQA
8
+ - Samuel Garratt
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2021-01-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: leap_salesforce
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: 1.0.2
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: 1.0.2
28
+ - !ruby/object:Gem::Dependency
29
+ name: watir
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: webdrivers
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ description: |-
57
+ This gem helps ones to perform integration tests on Salesforce.
58
+ It reads the Metadata from Salesforce and creates the foundation for UI tests.
59
+ email:
60
+ - samuel.garratt@integrationqa.com
61
+ - leap.salesforce@integrationqa.com
62
+ executables:
63
+ - leap_salesforce_ui
64
+ extensions: []
65
+ extra_rdoc_files: []
66
+ files:
67
+ - ".gitignore"
68
+ - ".gitlab-ci.yml"
69
+ - ".leap_salesforce.yml"
70
+ - ".rspec"
71
+ - ".rubocop.yml"
72
+ - ".ruby-gemset"
73
+ - ".ruby-version"
74
+ - CODE_OF_CONDUCT.md
75
+ - ChangeLog
76
+ - Dockerfile
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - bin/console
82
+ - bin/setup
83
+ - config/general.rb
84
+ - docker-compose.yml
85
+ - exe/leap_salesforce_ui
86
+ - leap_salesforce_ui.gemspec
87
+ - lib/leap_salesforce_ui.rb
88
+ - lib/leap_salesforce_ui/base_page.rb
89
+ - lib/leap_salesforce_ui/create_page.rb
90
+ - lib/leap_salesforce_ui/login_page.rb
91
+ - lib/leap_salesforce_ui/version.rb
92
+ - lib/leap_salesforce_ui/view_page.rb
93
+ - run_tests_when_ready.sh
94
+ homepage: https://gitlab.com/leap-dojo/leap_salesforce_ui
95
+ licenses:
96
+ - MIT
97
+ metadata:
98
+ homepage_uri: https://gitlab.com/leap-dojo/leap_salesforce_ui
99
+ source_code_uri: https://gitlab.com/leap-dojo/leap_salesforce_ui
100
+ changelog_uri: https://gitlab.com/leap-dojo/leap_salesforce_ui/ChangeLog
101
+ post_install_message:
102
+ rdoc_options: []
103
+ require_paths:
104
+ - lib
105
+ required_ruby_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '2.5'
110
+ required_rubygems_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ requirements: []
116
+ rubygems_version: 3.2.3
117
+ signing_key:
118
+ specification_version: 4
119
+ summary: Helps with setting up integrated automated test frameworks against Salesforce
120
+ UI.
121
+ test_files: []