chemlab 0.10.0 → 0.11.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: af0d8dedf01608e38acfc484a962e9de977f9295465c34ad1f0966508f2b445e
4
- data.tar.gz: 7215d12dcaa5a553f8a8dec115cf0071d27fd43a57c8957625fdfe6104261361
3
+ metadata.gz: c2dc9ad21f1a35f251bb519640b1f72d2d6efd678c8390417d9bc1deff56983d
4
+ data.tar.gz: 4190f846b7a160dba3d3289b257c9c88f9864f75448dbae6528d3d0e168c0647
5
5
  SHA512:
6
- metadata.gz: 6b17e06556b3acbb32169b1b4ce0ecdb3ddbd57fa7a7e3bdefa35c29a7ecf52f56242044cb818f85663f8ae403a96a86107a714deb65567ed76a95aadf3c60a2
7
- data.tar.gz: 21ad99860894e2bb2990ff667063b5400d9bd9c3203d46b5db4812690d94153a718e28cb3adfded773183cf4f6433c178967ab856127da91aa5434b13043e00f
6
+ metadata.gz: c41a95737aac16d56b0ee0defbfa7c179d2d8569c9e09141c22828de0141938213302f8697ee7e7a1d75622aaa0825cd0e00a8b7c5ab85e1941fcd971097c3a0
7
+ data.tar.gz: 766a65bc6cd78a34dbf7da24f768a7d898b99ea566b4e93cad877f86fa1911547ca499c8e858ec05a902a3de8fc78fe176e96be4b93a4a8ab028be4446967a3e
@@ -133,7 +133,7 @@ module Chemlab
133
133
  # @example
134
134
  # #find_element(:text_field, :username) #=>
135
135
  def find_element(watir_method, name, locator = nil, **args, &block)
136
- locator = { css: %([data-qa-selector="#{name}"]) } if locator.nil?
136
+ locator = { css: selector_attribute(name).join(',') } if locator.nil?
137
137
 
138
138
  # extract extraneous arguments from the locator and insert them into args
139
139
  chemlab_options, locator = extract_chemlab_options(**locator)
@@ -189,6 +189,25 @@ module Chemlab
189
189
 
190
190
  protected
191
191
 
192
+ # Utility function to convert a snake_case string to
193
+ # kebab-case
194
+ # @param [String] text string to convert
195
+ # @return [String] with underscores converted to hyphens
196
+ def convert_to_kebabcase(text)
197
+ text.to_s.tr('_', '-')
198
+ end
199
+
200
+ # Utility function to return array of selector attributes
201
+ # @param [String] name of element to find
202
+ # @return [Array] array of attributes
203
+ def selector_attribute(name)
204
+ [
205
+ %([data-testid="#{name}"]),
206
+ %([data-testid="#{convert_to_kebabcase(name)}"]),
207
+ %([data-qa-selector="#{name}"])
208
+ ]
209
+ end
210
+
192
211
  # Check existence of an element on the page
193
212
  # @note this method will _not_ wait for the element
194
213
  # @see [find_element]
@@ -196,7 +215,7 @@ module Chemlab
196
215
  # @example
197
216
  # #has_element?(:text_field, :username) => returns false if the element is is not there
198
217
  def has_element?(watir_method, name, locator = nil)
199
- locator = { css: %([data-qa-selector="#{name}"]) } if locator.nil?
218
+ locator = { css: selector_attribute(name).join(',') } if locator.nil?
200
219
 
201
220
  Chemlab.configuration.browser.session.engine.public_send(watir_method, locator).present?
202
221
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Chemlab
4
- VERSION = '0.10.0'
4
+ VERSION = '0.11.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chemlab
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab Quality
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-30 00:00:00.000000000 Z
11
+ date: 2023-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control
@@ -210,7 +210,7 @@ dependencies:
210
210
  - - "<"
211
211
  - !ruby/object:Gem::Version
212
212
  version: '8'
213
- description:
213
+ description:
214
214
  email:
215
215
  - quality@gitlab.com
216
216
  executables:
@@ -220,8 +220,6 @@ extra_rdoc_files: []
220
220
  files:
221
221
  - Rakefile
222
222
  - bin/chemlab
223
- - bin/chemlab-suite
224
- - bin/chemlab-test
225
223
  - lib/chemlab.rb
226
224
  - lib/chemlab/attributable.rb
227
225
  - lib/chemlab/cli/fixtures/new_library/.gitignore
@@ -258,7 +256,7 @@ licenses:
258
256
  - MIT
259
257
  metadata:
260
258
  source_code_uri: https://gitlab.com/gitlab-org/quality/chemlab
261
- post_install_message:
259
+ post_install_message:
262
260
  rdoc_options: []
263
261
  require_paths:
264
262
  - lib
@@ -273,8 +271,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
273
271
  - !ruby/object:Gem::Version
274
272
  version: '0'
275
273
  requirements: []
276
- rubygems_version: 3.3.3
277
- signing_key:
274
+ rubygems_version: 3.1.6
275
+ signing_key:
278
276
  specification_version: 4
279
277
  summary: Automation framework built by GitLab, for the world.
280
278
  test_files: []
data/bin/chemlab-suite DELETED
@@ -1 +0,0 @@
1
- chemlab
data/bin/chemlab-test DELETED
@@ -1 +0,0 @@
1
- chemlab