magento / magento/magento2-functional-testing-framework

cannot use strings with comma sign in locatorFunction as it is wrapped with " which breaks Php

Open
#913 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
154
Forks
134
PR merge metrics
No merged PRs in 30d

Description

https://github.com/magento/magento2-functional-testing-framework/blob/0a5672871f31784e9a646bbd2ecb7d64173bbfd2/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php#L1818 This feature is exploding the whole string inside the paranntheses.

Its more or less impossible to use XPATH in this method as we cannot use //span[contains(@class,'class-to-search-for') and contains(@class,'has-another-class')] it will add " around the comma signs.
I know this is translatable to css selector but thats not the issue. I cannot use string literals with , sign as variables

Where vehicle is: 2.0 TDI (CKUB, CSNA) 163Hk | Bakhjulsdrift | 201107-201612 | Skåp
`

`

### Preconditions
Using Magento 2.4.6-p3

### Steps to reproduce
1.

### Expected result

`
$I->click(Locator::contains("span.select2-dropdown.vehicle-select > li.select2-results__option", "2.0 TDI (CKUB, CSNA) 163Hk | Bakhjulsdrift | 201107-201612 | Skåp")); // stepKey: clicksOnVehicleOptionCustomerGivesAChoiceToSelectSpecificVehicle
`

### Actual result

`
$I->click(Locator::contains("span.select2-dropdown.vehicle-select > li.select2-results__option", "2.0 TDI (CKUB", "CSNA) 163Hk | Bakhjulsdrift | 201107-201612 | Skåp")); // stepKey: clicksOnVehicleOptionCustomerGivesAChoiceToSelectSpecificVehicle
`

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/Magento/FunctionalTestingFramework/Util/TestGenerator.php around line 1818 and reproduce the issue with the parameterized locatorFunction XML shown. Compare the generated PHP with the expected result, and consider the issue done when a comma inside the vehicle value remains part of one argument rather than splitting the generated Locator::contains call.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.