chemlab 0.9.2 → 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: 5511ef5fd5d6d4aba05a6ad59ba41d25d75c019b5314a2b079feada7cba946db
4
- data.tar.gz: 9bbfbf9bf30ddd61c2f6caf5ede340be131217c2cf3e8e0db462abcad21b30c6
3
+ metadata.gz: c2dc9ad21f1a35f251bb519640b1f72d2d6efd678c8390417d9bc1deff56983d
4
+ data.tar.gz: 4190f846b7a160dba3d3289b257c9c88f9864f75448dbae6528d3d0e168c0647
5
5
  SHA512:
6
- metadata.gz: 88ade200b47c7f01db6a4ca215da19a3c877cc9aede859ece778591f039d597def1f2d986146677ec5143d9e1df585ac23b3627e9f6dc06de1bab0061cb3f47e
7
- data.tar.gz: f1b87c97400fee349d7eac0e94576eaec15ccc9694e0a92826e02865e79135f6a812b9dce3491961fa4fdcf2f1d9fd1a43621e10aacf73881875176ca6dda25c
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.9.2'
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.9.2
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: 2021-10-13 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
@@ -256,8 +254,9 @@ files:
256
254
  homepage: https://about.gitlab.com/
257
255
  licenses:
258
256
  - MIT
259
- metadata: {}
260
- post_install_message:
257
+ metadata:
258
+ source_code_uri: https://gitlab.com/gitlab-org/quality/chemlab
259
+ post_install_message:
261
260
  rdoc_options: []
262
261
  require_paths:
263
262
  - lib
@@ -272,8 +271,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
272
271
  - !ruby/object:Gem::Version
273
272
  version: '0'
274
273
  requirements: []
275
- rubygems_version: 3.1.4
276
- signing_key:
274
+ rubygems_version: 3.1.6
275
+ signing_key:
277
276
  specification_version: 4
278
277
  summary: Automation framework built by GitLab, for the world.
279
278
  test_files: []
data/bin/chemlab-suite DELETED
@@ -1 +0,0 @@
1
- bin/chemlab
data/bin/chemlab-test DELETED
@@ -1 +0,0 @@
1
- bin/chemlab