Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add aliases for find() and findAll() command in new Element API #4057

Closed
3 tasks
garg3133 opened this issue Feb 26, 2024 · 28 comments
Closed
3 tasks

Add aliases for find() and findAll() command in new Element API #4057

garg3133 opened this issue Feb 26, 2024 · 28 comments
Assignees

Comments

@garg3133
Copy link
Member

garg3133 commented Feb 26, 2024

Description of the issue

The following APIs should work in the new Element API:

Commands to find a single element:

  • browser.element.find('selector')
  • browser.element.get('selector')
  • browser.element.findElement('selector')
  • browser.element('selector').find('child-selector')
  • browser.element('selector').get('child-selector')
  • browser.element('selector').findElement('child-selector')

Commands to find multiple elements:

  • browser.element.findAll('selector')
  • browser.element.getAll('selector')
  • browser.element.findElements('selector')
  • browser.element('selector').findAll('child-selector')
  • browser.element('selector').getAll('child-selector')
  • browser.element('selector').findElements('child-selector')

The main commands above are find() and findAll() (for which corresponding files are present in lib/api/web-element/commands directory) and all others are the aliases of these two commands.

Some of the aliases above already exist while others don't, so we need to make sure that all of the above commands work in both JS and TS (with correct typings).

TODO

  • Add missing aliases
  • Add tests for the added aliases
  • Add missing types and tests for the added types
@garg3133
Copy link
Member Author

The two sections of commands above (find and findAll) can be taken up separately by different contributors.

@abhishekchauhan15
Copy link

abhishekchauhan15 commented Feb 26, 2024

Hey, @garg3133 can take up this issue?

@garg3133
Copy link
Member Author

Hi, please go through GSoC Contributor Guidance for Nightwatch. It contains details on how the issues will be assigned.

@subhajit20
Copy link
Contributor

Hey @garg3133 I have a question that let us suppose the find command - it is an aliases of findall command right and get is aliases of getall and vice versa.
right ?

@garg3133
Copy link
Member Author

@subhajit20 No, find and findAll are separate commands.

@subhajit20
Copy link
Contributor

@subhajit20 No, find and findAll are separate commands.

Then find and findElement are almost the same. Are they can be aliases for each other?

@garg3133
Copy link
Member Author

@subhajit20 Yes, all the commands that are written together in the issue description are supposed to be aliases of each other.

@subhajit20
Copy link
Contributor

@subhajit20 Yes, all the commands that are written together in the issue description are supposed to be aliases of each other.

Okay Got it.
Thanks!!

@subhajit20
Copy link
Contributor

Hey @garg3133 can you check my PR once and let me know if any further changes are needed?

@its-kunal
Copy link

Hey @garg3133, Please review my pull request - #4067 .

@srajan07
Copy link

can you assign me this issue?

@Chamara00
Copy link

@garg3133 can you assign this to me?

@its-kunal
Copy link

Hey @garg3133, Please review my pull request - #4067

@Jai0401 Jai0401 mentioned this issue Mar 4, 2024
8 tasks
@Jai0401
Copy link

Jai0401 commented Mar 4, 2024

@garg3133 can you please review my PR?

@AritraLeo
Copy link
Contributor

AritraLeo commented Mar 15, 2024

Hi @garg3133 just curious if this issue is still open because there are so many PRs open so far. If not I am willing to work on this one!

@garg3133
Copy link
Member Author

@AritraLeo Yes, this issue is still open and we still don't have a PR that solves this issue completely, although #4067 is quite close but there are still a few things missing from there.

@AritraLeo
Copy link
Contributor

@AritraLeo Yes, this issue is still open and we still don't have a PR that solves this issue completely, although #4067 is quite close but there are still a few things missing from there.

Ohk I'll start working on it and come up with a PR soon !

@AritraLeo
Copy link
Contributor

@garg3133 so far I have added declarations for get and getAll() and findElement and findElements in types/web-element.d.ts also added alias tag to find and findAll command files.
but to run the test for checking in ecosia file I had written -

it('Test get() alias', function(browser) {
   browser
     .find('input[type=search]')
     .assert.visible('input[type=search]');
 });

this simple test but it seems even find is not working properly. Please correct me so that I can run the tests successfully!

@garg3133
Copy link
Member Author

@AritraLeo .find() is not directly available on browser. It's either browser.element('selector').find('child selector') or browser.element.find('selector') as mentioned in the issue description.

@AritraLeo
Copy link
Contributor

@AritraLeo .find() is not directly available on browser. It's either browser.element('selector').find('child selector') or browser.element.find('selector') as mentioned in the issue description.

Ohk, I see my bad apologies for the oversight.

@AritraLeo
Copy link
Contributor

@garg3133 Please have a look at my PR !

@Ankuristic
Copy link

could i start working on this issue or this issue is already closed

bboinnovate20 pushed a commit to bboinnovate20/nightwatch that referenced this issue Mar 22, 2024
@Visbhavesh
Copy link

hey assign these issue to me and I will resolve these

@garg3133
Copy link
Member Author

In order to discourage duplicate PRs on an issue, assigning this issue to @AritraLeo since their PR #4130 is under active development and also very close to the solution.

Moving forward, we will only be reviewing PRs from the person to whom the issue is assigned.

@Ashu463
Copy link

Ashu463 commented Mar 29, 2024

Hey @AritraLeo could you pls share current status of this issue ? because upon following your and @garg3133 conversation it's too much clear in my head.
so that I could help to solve this issue soon.

@garg3133
Copy link
Member Author

@Ashu463 This issue is almost solved in #4130, I just need to do a final review of the PR.

@Ashu463
Copy link

Ashu463 commented Mar 29, 2024

Yeah! I think that it is solved but I just asked if any task remaining then I could help.
Btw Thanks for informing.

@garg3133
Copy link
Member Author

Fixed in #4130.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.