Closed InduKrish closed 2 years ago
It looks like you're not deserializing the RegExp
from your JSON, so you're passing the string "/NEW HIRE/"
instead of /NEW HIRE/
as the name
option.
const groupCode = JSON.parse(JSON.stringify(require("../../data/groupCodes.json")));
i am already deserializing using JSON.parse, not sure why it is passed as string.
But you're storing it as a string in your JSON file:
// groupCodes.json file
[
{
"code":"03",
"description" : "/NEW HIRE/"
// ↑↑ string ↑↑
}
]
When running parameterized tests using the JSON file or csv file, or from array, see the following error proxy.click: TestingLibraryElementError: Unable to find an accessible element with the role "row" and name "/NEW HIRE/", Can you please advise why it throws an error while reading from json or csv file.
// await checkRow(screen, /NEW HIRE/);---> this RegExp works when passed directly, trying to read the same from json or csv file.
await checkRow(screen, "/" + data.description + "/"); ---> string concat also resulted in the same error, Screenshot is attached,
JSON file:
groupCodes.json file [ { "code":"03", "description" : "/NEW HIRE/" } ]
groupCodes.csv file: "code","description" "03","/NEW HIRE/"
CSV file:
helper method: