texei / texei-sfdx-plugin

Texeï's plugin for sfdx
https://texei.github.io/texei-sfdx-plugin/
BSD 3-Clause "New" or "Revised" License
123 stars 38 forks source link

Updated logic to select input/select elements for updating CPQ Settings #146

Closed w-andre closed 11 months ago

w-andre commented 11 months ago

Fixes #145

This PR updates the logic to select the correct input/select element for the specified label to support config options without an help text (e.g. "Enable Evergreen Subscriptions").

This PR uses the following logic to select the correct input:

  1. Find the label containing the specified label text
  2. Traverse to the ancestor th element with class labelCol
  3. Go to the first sibling td element with class dataCol or data2Col
  4. Select the first child input or select element

The selection of the current and target picklist values uses the following logic:

  1. Current value: Get the value property of the input and select the option by using this property.
  2. Target value: Get the option element by using the display value and then get the value property of the element. Afterwards the input is updated by using the select() method and specifying the target value.

Additionally, I have added a check to look for options which cannot be updated (disabled controls). If the target value does not match the existing value an error is logged. This is necessary because you cannot deactivate the "Enable Evergreen Subscriptions" checkbox after it is enabled. Maybe this applies to other controls as well. Therefore I have added this check for all controls.

FabienTaillon commented 11 months ago

Thank you !