leap_salesforce 0.1.8 → 0.1.9

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: 457d0417a4b8be95ecd61db1b0ac53616900b504ce8c1eecc333c1e7ea5abfe9
4
- data.tar.gz: 792af4fccfe7d765c7885cec8c3a4ff359bdcf1acf929869a2c4aa754173f885
3
+ metadata.gz: b19edc03763b60a2d097dde77935d9db5c5aed17ee22d0c3978f695a861cf603
4
+ data.tar.gz: 7c6487aa730adc662ab69109aa9a0f49270746e2dfd06b15989c5fb064b5693e
5
5
  SHA512:
6
- metadata.gz: 8f2dce774c2571a06064ea7c2f865dc77719eb889df63d03f86313bb37c52b3360a48ab58c8183f6644cbbf70ec221db5759f5274a91c4f0d6f913835613221b
7
- data.tar.gz: c96e12f15cdd3857d5b5766d95a70f443c6f8054345c2acf4c69ff6a640213f03173262b6dcd57b2fa779cf223f8c23cdf891ed5b95319c3c217c3a64273d1e4
6
+ metadata.gz: 5c9b6f9ed699b7f8708523e4d31cf03e5a2e34794d2050429dc463997b2f49a5b1f52c4ee23048355eb59086c153d1983a128eaade27ee332c40c8f41e0cd8a9
7
+ data.tar.gz: dc89cb3970f516154ef2fd6e72173e2cca4c13ef313ef7840d24b447887ce2d689400867f9203b342dfe4fc1bfbad8ad089c392e9b497fab72e34fc7f8069e55
data/ChangeLog CHANGED
@@ -1,3 +1,9 @@
1
+ Version 0.1.9
2
+ * Enhancements
3
+ * Updated logs handling so that the user used for API is not unnecessarily repeated
4
+ * Bug Fix
5
+ * Fixed issue with handling a string with '$Number' by updating order
6
+
1
7
  Version 0.1.8
2
8
  * Bug Fix
3
9
  * Numbers at start of picklist names were not working and having different label and backend names broke things too
data/README.md CHANGED
@@ -7,6 +7,8 @@ In the future it will also planned to be used to create page objects based on me
7
7
 
8
8
  [![Build Status](https://gitlab.com/leap-dojo/leap_salesforce/badges/master/build.svg)](https://gitlab.com/leap-dojo/leap_salesforce/pipelines)
9
9
 
10
+ > Note this documentation is a work in progress. Look at `spec` for code examples.
11
+
10
12
  ## Installation
11
13
 
12
14
  Add this line to your application's Gemfile:
@@ -48,17 +50,89 @@ E.g.,
48
50
 
49
51
  `rake` # Run all tests
50
52
 
51
- API Traffic logs can be seen in the `logs` folder.
53
+ API Traffic logs can be seen in the `logs` folder. You can see an example of running through this [here](https://asciinema.org/a/259098)
54
+
55
+ ### Understanding how things work
56
+
57
+ #### Important files
58
+
59
+ To see how things fit together, look at the [structure](#structure) section below.
60
+
61
+ ##### `.leap_salesforce.yml`
62
+
63
+ This YAML file describes common configuration for the project.
64
+
65
+ Following is a description of each key in this file:
66
+ * `environment`: Specifies the default environment for this suite. This can be overwritten with the `LEAP_ENV` environment variable.
67
+ * `lib_folder`: Can be set to change the default location (`lib/leap_salesforce`) of where all generated code is put
68
+ and read from.
69
+ * `soql_objects`: List of SOQL objects that the generator will create for and update
70
+
71
+ ##### `salesforce_oauth2.yml`
72
+
73
+ * client_id: OAuth2 client id / customer id obtained from your Test App
74
+ * client_secret: OAuth2 client_secret / customer secret obtained from your Test App
75
+ * password: Password expected to be generic across test users and the same as what's used on the UI to logon with
76
+
77
+ This file is read and sets attributes of `LeapSalesforce` globally. These can also be set with the following format
78
+
79
+ ```ruby
80
+ LeapSalesforce.password = 'PASS'
81
+ ```
82
+
83
+ ##### `config/general.rb`
84
+
85
+ This is where common code is stored for all the environments. This is where you would usually put your test users
86
+ as described in the next section.
87
+
88
+ #### Test Users
89
+ Test users are defined using the `LeapSalesforce::Users` module. Following is an example of setting up a few test
90
+ users:
91
+
92
+ ```ruby
93
+ module LeapSalesforce
94
+ # Example where email address changes according to environment
95
+ # Users can be added by passing an array or passing a LeapSalesforce::User object
96
+ Users.add [:admin, 'admin@<%= LeapSalesforce.environment %>.email.com', description: 'System Admin User']
97
+ Users.add User.new :sales, 'test.sales@test<%= LeapSalesforce.environment %>.com'
98
+ end
99
+ ```
52
100
 
53
- TODO: Finish this. A lot more needed
101
+ The first user defined will be the default user. Following users can be set by using the `api_user` attribute.
102
+
103
+ ```ruby
104
+ # Using key to specify user
105
+ LeapSalesforce.api_user = LeapSalesforce::Users.where(key: :sales)
106
+ # Using username that has a partial match with a Regex
107
+ LeapSalesforce.api_user = LeapSalesforce::Users.where username: /admin/
108
+ # Using description that has a partial match with a Regex. This might be helpful if you're setting users from
109
+ # a Cucumber step definition where readability is important
110
+ LeapSalesforce.api_user = LeapSalesforce::Users.where description: /System Admin/
111
+ ```
54
112
 
55
113
  ## Structure
56
114
 
57
- .
58
- ├── config # Code for the configuration of the automation suite
59
- │ ├── general.rb # Code loaded for common (non confidential code) setup across environments
60
- │ ├── credentials #
115
+ Following is the general structure of test automation suite that uses this approach. Details may vary depending on the
116
+ test framework used and other preferences.
61
117
 
118
+ .
119
+ ├── config # Code for the configuration of the automation suite
120
+ │ ├── general.rb # Code loaded for common (non confidential code) setup across environments
121
+ │ ├── credentials # Setting of secret properties like passwords
122
+ │ │ └── salesforce_oauth2.yml # Credentials for connecting to Salesforce via OAuth2
123
+ │ └── environments # Contains ruby files loaded specific to environment following `ENVIRONMENT_NAME.rb`
124
+ ├── lib # Common library code
125
+ │ └── leap_salesforce # Code generated by or specific to leap_salesforce
126
+ │ ├── factories # FactoryBot definitions, describing how to mass produce objects
127
+ │ ├── metadata # Code generated and updated automatically from metadata
128
+ │ │ └── enum # Picklist enumeration objects are stored here
129
+ │ └── soql_data # Objects for handling each object in the backend specified in '.leap_salesforce.yml'
130
+ ├── logs # Contains API traffic logs for transactions against Salesforce
131
+ ├── spec # Where RSpec automated tests are stored
132
+ ├── .leap_salesforce.yml # Where common configuration is stored regarding your project. This complements and is read before what's in 'config'
133
+ ├── Gemfile # Where required ruby gems/libraries are specified
134
+ ├── Gemfile.lock # Generated file specified details of versions installed by `Gemfile`
135
+ └── Rakefile # Where common `Rake` tasks are specified. LeapSalesforce specific tasks are required from here
62
136
 
63
137
  ## Docs
64
138
 
@@ -72,7 +146,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
72
146
 
73
147
  ## Contributing
74
148
 
75
- Bug reports and pull requests are welcome on GitHub at https://gitlab.com/leap-dojo/leap_salesforce. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
149
+ Bug reports and pull requests are welcome on GitLab at https://gitlab.com/leap-dojo/leap_salesforce. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
76
150
 
77
151
  ## License
78
152
 
@@ -39,6 +39,6 @@ It reads the Metadata from Salesforce and creates the foundation for API tests.'
39
39
  spec.add_dependency 'require_all'
40
40
  spec.add_dependency 'rubocop'
41
41
  spec.add_dependency 'rubykeyword'
42
- spec.add_dependency 'soaspec'
42
+ spec.add_dependency 'soaspec', '>= 0.2.26'
43
43
  spec.add_dependency 'thor'
44
44
  end
@@ -13,9 +13,9 @@ class String
13
13
  def to_ruby_friendly
14
14
  tr('&|=', '_').gsub('<', '_lt_').gsub('>', '_gt_')
15
15
  .remove_macrons
16
- .humanize_numbered_string
17
16
  .gsub(/[\s]+/, '_')
18
17
  .gsub(/[\W]/, '') # Remove any other special characters
18
+ .humanize_numbered_string
19
19
  end
20
20
 
21
21
  # @return [String] Convert String to form a class could use
@@ -46,6 +46,7 @@ module LeapSalesforce
46
46
  else
47
47
  raise ArgumentError, "Unable to use class '#{user.class}' to set api_user"
48
48
  end
49
+ Soaspec::SpecLogger.info "Using user '#{@api_user}'"
49
50
  end
50
51
 
51
52
  # @return [String] Salesforce username used to execute API tests. This can be changed during tests
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LeapSalesforce
4
- VERSION = '0.1.8'
4
+ # @return [String] Version of leap salesforce
5
+ VERSION = '0.1.9'
5
6
  end
@@ -5,6 +5,7 @@ require 'leap_salesforce/version'
5
5
  require 'soaspec'
6
6
  Soaspec::OAuth2.refresh_token = :once # Save access token and reuse it
7
7
  Soaspec.log_warnings = false # Log any API warnings
8
+ Soaspec::OAuth2.request_message = false
8
9
  require 'active_support/core_ext/integer/time' # Creating time objects
9
10
  require 'leap_salesforce/parameters'
10
11
  require 'leap_salesforce/ext/string'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leap_salesforce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - IQA
@@ -199,14 +199,14 @@ dependencies:
199
199
  requirements:
200
200
  - - ">="
201
201
  - !ruby/object:Gem::Version
202
- version: '0'
202
+ version: 0.2.26
203
203
  type: :runtime
204
204
  prerelease: false
205
205
  version_requirements: !ruby/object:Gem::Requirement
206
206
  requirements:
207
207
  - - ">="
208
208
  - !ruby/object:Gem::Version
209
- version: '0'
209
+ version: 0.2.26
210
210
  - !ruby/object:Gem::Dependency
211
211
  name: thor
212
212
  requirement: !ruby/object:Gem::Requirement