thefrontside / thefrontside/interactors

Allow to define array of locator functions as a interactor's locator

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

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
36
Forks
2
Avg merge
4m
Merged PRs (30d)
2

Description

For example, this is a locator of material-ui Button
https://github.com/thefrontside/interactors/blob/6454cc6caccbd12303a2d4776f399385c0e47c09/packages/material-ui/src/button.ts#L10
As you can see, buttons can be located by aria-label attribute and by innerText. But the problem is if we have a button with both aria-label and innerText values, we can't find that button by innerText value, because our locator return the first value from aria-label attribute.

So I suggest to add ability to define an array of functions as locator. So locator could be look like this:

.locator([
  (element) => element.getAttribute("aria-label"),
  (element) => element.innerText
])

And then you can find your button by any of these possible ways.

Contributor guide

No contributing guide indexed for this repository

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 packages/material-ui/src/button.ts#L10 and trace the interactor locator implementation used by the material-ui Button. Check how locator values are resolved and where locator behavior is tested. Done means an interactor can accept multiple locator functions, find a button through any matching value, and retain existing single-locator behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.