haya_select_helpers 0.0.24 → 0.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d289ef00a14194f8d755422fbfb764557cc4d9942cfb09556235bd19c4cb3bed
4
- data.tar.gz: c764a04952e83c05eac23e3199dda1e46c3986435724b305b478feac858eb027
3
+ metadata.gz: 05b374c85552157843a43eb39e2bab963e470750d4e81ba2e2e010bb5363831f
4
+ data.tar.gz: 2bab3373c574a92ac537b8d827a174ba04afc433f4b6e4104bdef4e62611a852
5
5
  SHA512:
6
- metadata.gz: cdea7c07e9ca63f5318d240086afec8754425385b7c1763b685fe9dd52c7922ae5ad39fab7aab30e00396821411dfd2a939d768f3d417d5d854210f8b868a222
7
- data.tar.gz: 0ed2c3a90ee5c44f03e95b0c12cbffe8786456687cfc0fe56db610154deeb46491396da0ddcadf8b887ea5c06c2cac48bf6abb57821c1af8fead1800d0ebca80
6
+ metadata.gz: ed4ec58328e3ce849f03c505b28fb1fd30947205f9e1395be8990de40e078932a64cd63a616a401c8859329db277ef7a10523f657d0a01bdd03443ee8baa82ea
7
+ data.tar.gz: 5df071cca7c02cf29d92d6d955bec778bf80dbafccff6a36741c635e0eff8a208f6eeb4ea783f0c55d9cf06b8aecf12129af89146c548ad2e1b1b005550e161c
data/lib/haya_select.rb CHANGED
@@ -23,14 +23,14 @@ class HayaSelect
23
23
  def initialize(id:, scope:, debug: false)
24
24
  @base_selector = "[data-component='haya-select'][data-id='#{id}']"
25
25
  @debug = debug
26
- @not_opened_current_selected_selector = "#{base_selector}[data-opened='false'] [data-class='current-selected']"
27
- @opened_current_selected_selector = "#{base_selector}[data-opened='true'] [data-class='current-selected']"
28
- @options_selector = "[data-class='options-container'][data-id='#{id}']"
26
+ @not_opened_current_selected_selector = "#{base_selector}[data-opened='false'] [data-testid='haya-select/current-selected']"
27
+ @opened_current_selected_selector = "#{base_selector}[data-opened='true'] [data-testid='haya-select/current-selected']"
28
+ @options_selector = "[data-testid='haya-select/options-container'][data-id='#{id}']"
29
29
  @scope = scope
30
30
  end
31
31
 
32
32
  def label
33
- wait_for_and_find("#{base_selector} [data-class='current-selected'] [data-class='current-option']").text
33
+ wait_for_and_find("#{base_selector} [data-testid='haya-select/current-selected'] [data-testid='haya-select/current-option']").text
34
34
  rescue Selenium::WebDriver::Error::StaleElementReferenceError
35
35
  retry
36
36
  end
@@ -58,13 +58,13 @@ class HayaSelect
58
58
 
59
59
  def close
60
60
  wait_for_selector opened_current_selected_selector
61
- wait_for_and_find("[data-class='search-text-input']").click
61
+ wait_for_and_find("[data-testid='haya-select/search-input']").click
62
62
  wait_for_no_selector opened_current_selected_selector
63
63
  end
64
64
 
65
65
  def options
66
- wait_for_selector "#{options_selector} [data-class='select-option']"
67
- option_elements = all("#{options_selector} [data-class='select-option']")
66
+ wait_for_selector "#{options_selector} [data-testid='haya-select/option']"
67
+ option_elements = all("#{options_selector} [data-testid='haya-select/option']")
68
68
  option_elements.map do |option_element|
69
69
  {
70
70
  label: option_element.text,
@@ -83,7 +83,7 @@ class HayaSelect
83
83
  end
84
84
 
85
85
  def search(value)
86
- search_input = wait_for_and_find("#{base_selector} [data-class='search-text-input']")
86
+ search_input = wait_for_and_find("#{base_selector} [data-testid='haya-select/search-input']")
87
87
  search_input.set("")
88
88
  search_input.send_keys(value)
89
89
  self
@@ -129,7 +129,7 @@ class HayaSelect
129
129
 
130
130
  begin
131
131
  option = scope.page.first(
132
- "#{options_selector} [data-class='select-option'][data-value='#{value}']",
132
+ "#{options_selector} [data-testid='haya-select/option'][data-value='#{value}']",
133
133
  minimum: 0,
134
134
  wait: 0
135
135
  )
@@ -141,7 +141,7 @@ class HayaSelect
141
141
 
142
142
  def value_no_wait
143
143
  hidden_input = scope.page.first(
144
- "#{base_selector} [data-class='current-selected'] input[type='hidden']",
144
+ "#{base_selector} [data-testid='haya-select/current-selected'] input[type='hidden']",
145
145
  minimum: 0,
146
146
  visible: false,
147
147
  wait: 0
@@ -152,14 +152,14 @@ class HayaSelect
152
152
 
153
153
  def label_no_wait
154
154
  current_option = scope.page.first(
155
- "#{base_selector} [data-class='current-selected'] [data-class='current-option']",
155
+ "#{base_selector} [data-testid='haya-select/current-selected'] [data-testid='haya-select/current-option']",
156
156
  minimum: 0,
157
157
  wait: 0
158
158
  )
159
159
 
160
160
  return nil unless current_option
161
161
 
162
- option_text = current_option.first("[data-testid='option-presentation-text']", minimum: 0)
162
+ option_text = current_option.first("[data-testid='haya-select/option-presentation-text']", minimum: 0)
163
163
  option_text ? option_text.text : current_option.text
164
164
  end
165
165
 
@@ -227,7 +227,7 @@ class HayaSelect
227
227
  end
228
228
 
229
229
  def value
230
- wait_for_and_find("#{base_selector} [data-class='current-selected'] input[type='hidden']", visible: false)[:value]
230
+ wait_for_and_find("#{base_selector} [data-testid='haya-select/current-selected'] input[type='hidden']", visible: false)[:value]
231
231
  rescue Selenium::WebDriver::Error::StaleElementReferenceError
232
232
  retry
233
233
  end
@@ -240,7 +240,7 @@ class HayaSelect
240
240
  end
241
241
 
242
242
  def toggles
243
- all("#{base_selector} [data-testid='option-presentation']").map do |element|
243
+ all("#{base_selector} [data-testid='haya-select/option-presentation']").map do |element|
244
244
  {
245
245
  toggle_icon: element['data-toggle-icon'],
246
246
  toggle_value: element['data-toggle-value'],
@@ -252,7 +252,7 @@ class HayaSelect
252
252
  end
253
253
 
254
254
  def selected_option_values
255
- all("[data-class='select-option'][data-selected='true']").map do |select_option_element|
255
+ all("[data-testid='haya-select/option'][data-selected='true']").map do |select_option_element|
256
256
  select_option_element['data-value']
257
257
  end
258
258
  end
@@ -283,7 +283,7 @@ class HayaSelect
283
283
 
284
284
  def wait_for_value(expected_value)
285
285
  wait_for_selector(
286
- "#{base_selector} [data-class='current-selected'] input[type='hidden'][value='#{expected_value}']",
286
+ "#{base_selector} [data-testid='haya-select/current-selected'] input[type='hidden'][value='#{expected_value}']",
287
287
  visible: false
288
288
  )
289
289
  self
@@ -338,7 +338,7 @@ private
338
338
  if value
339
339
  "#{select_option_container_selector}[data-value='#{value}']"
340
340
  else
341
- selector = "#{options_selector} [data-testid='option-presentation']"
341
+ selector = "#{options_selector} [data-testid='haya-select/option-presentation']"
342
342
  selector << "[data-text='#{label}']" unless label.nil?
343
343
  selector
344
344
  end
@@ -362,11 +362,11 @@ private
362
362
  click_option_element(option)
363
363
  return unless option_selected?(option, label, option_value)
364
364
 
365
- option_text = option.first("[data-testid='option-presentation-text']", minimum: 0)
365
+ option_text = option.first("[data-testid='haya-select/option-presentation-text']", minimum: 0)
366
366
  click_option_element(option_text) if option_text
367
367
  return unless option_selected?(option, label, option_value)
368
368
 
369
- option_presentation = option.all("[data-testid='option-presentation']", minimum: 0).first
369
+ option_presentation = option.all("[data-testid='haya-select/option-presentation']", minimum: 0).first
370
370
  click_option_element(option_presentation) if option_presentation
371
371
  return unless option_selected?(option, label, option_value)
372
372
 
@@ -374,7 +374,7 @@ private
374
374
  end
375
375
 
376
376
  def wait_for_selected_value_or_label(label, value, allow_blank: false)
377
- value_input_selector = "#{base_selector} [data-class='current-selected'] input[type='hidden']"
377
+ value_input_selector = "#{base_selector} [data-testid='haya-select/current-selected'] input[type='hidden']"
378
378
 
379
379
  if scope.page.has_selector?(value_input_selector, visible: false, wait: 0)
380
380
  return wait_for_selector(current_value_selector(value), visible: false) if value
@@ -452,7 +452,7 @@ private
452
452
  end
453
453
 
454
454
  def search_input_selector
455
- "#{base_selector} [data-class='search-text-input']"
455
+ "#{base_selector} [data-testid='haya-select/search-input']"
456
456
  end
457
457
 
458
458
  def click_open_target_element
@@ -474,7 +474,7 @@ private
474
474
  end
475
475
 
476
476
  def current_selected_selector
477
- "#{base_selector} [data-class='current-selected']"
477
+ "#{base_selector} [data-testid='haya-select/current-selected']"
478
478
  end
479
479
 
480
480
  def wait_for_open
@@ -529,15 +529,15 @@ private
529
529
 
530
530
  def current_option_label_selectors
531
531
  [
532
- "#{base_selector} [data-class='current-selected'] [data-testid='option-presentation-text']",
533
- "#{base_selector} [data-class='current-selected'] [data-class='current-option']"
532
+ "#{base_selector} [data-testid='haya-select/current-selected'] [data-testid='haya-select/option-presentation-text']",
533
+ "#{base_selector} [data-testid='haya-select/current-selected'] [data-testid='haya-select/current-option']"
534
534
  ]
535
535
  end
536
536
 
537
537
  def label_matches?(label)
538
538
  return false unless label
539
539
  return true if scope.page.has_selector?(
540
- "#{base_selector} [data-class='current-selected'] [data-testid='option-presentation'][data-text='#{label}']",
540
+ "#{base_selector} [data-testid='haya-select/current-selected'] [data-testid='haya-select/option-presentation'][data-text='#{label}']",
541
541
  wait: 0
542
542
  )
543
543
 
@@ -547,19 +547,19 @@ private
547
547
  end
548
548
 
549
549
  def current_value_selector(value)
550
- "#{base_selector} [data-class='current-selected'] input[type='hidden'][value='#{value}']"
550
+ "#{base_selector} [data-testid='haya-select/current-selected'] input[type='hidden'][value='#{value}']"
551
551
  end
552
552
 
553
553
  def no_options_selector
554
- "#{options_selector} [data-class='no-options-container']"
554
+ "#{options_selector} [data-testid='haya-select/no-options-container']"
555
555
  end
556
556
 
557
557
  def select_container_selector
558
- "#{base_selector} [data-class='select-container']"
558
+ "#{base_selector} [data-testid='haya-select/select-container']"
559
559
  end
560
560
 
561
561
  def option_label_selector
562
- "#{options_selector} [data-testid='option-presentation-text']"
562
+ "#{options_selector} [data-testid='haya-select/option-presentation-text']"
563
563
  end
564
564
 
565
565
  def options_visibility_selector
@@ -590,13 +590,13 @@ private
590
590
 
591
591
  if selector.include?("option-presentation")
592
592
  option_presentation = wait_for_and_find(selector)
593
- return option_presentation.find(:xpath, "./ancestor::*[@data-class='select-option']")
593
+ return option_presentation.find(:xpath, "./ancestor::*[@data-testid='haya-select/option']")
594
594
  end
595
595
 
596
596
  return wait_for_and_find(selector) if scope.page.has_selector?(selector, wait: 0)
597
597
 
598
598
  option_text = wait_for_and_find(option_label_selector, text: label)
599
- option_text.find(:xpath, "./ancestor::*[@data-class='select-option']")
599
+ option_text.find(:xpath, "./ancestor::*[@data-testid='haya-select/option']")
600
600
  rescue Selenium::WebDriver::Error::StaleElementReferenceError
601
601
  retry
602
602
  end
@@ -649,7 +649,7 @@ private
649
649
  end
650
650
 
651
651
  def select_option_container_selector
652
- "#{options_selector} [data-class='select-option']"
652
+ "#{options_selector} [data-testid='haya-select/option']"
653
653
  end
654
654
 
655
655
  def select_value_and_close(label:, value:, allow_if_selected: false)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HayaSelectHelpers
4
- VERSION = "0.0.24"
4
+ VERSION = "0.0.26"
5
5
  end
@@ -22,6 +22,8 @@ namespace :release do
22
22
  gem_file = "haya_select_helpers-#{new_version}.gem"
23
23
  run_command("gem build haya_select_helpers.gemspec")
24
24
  run_command("gem push #{gem_file}")
25
+ File.delete(gem_file)
26
+ puts "Deleted local gem file: #{gem_file}"
25
27
  end
26
28
 
27
29
  def run_command(command)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haya_select_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.24
4
+ version: 0.0.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaspernj
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-25 00:00:00.000000000 Z
11
+ date: 2026-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails