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

drag and drop using .contains and .eq commands #100

Open
qa-joerg opened this issue Apr 12, 2022 · 3 comments
Open

drag and drop using .contains and .eq commands #100

qa-joerg opened this issue Apr 12, 2022 · 3 comments

Comments

@qa-joerg
Copy link

Hi,
I installed this API for our application to test the drag and drop features of our application. Unfortunately there is only the possibility to use unique selectors. Our application has partly same selectors which can only be selected by contains or by index and the command eq.

Is there a possibility to work with this commands, e.g. like this:

        cy.get("selectorA").eq(1).drag("selectorB").eq(2);
        cy.get("selectorA").contains("start").drag("selectorB").contains("end");

Or is there any workaround I can use to drag from selectorA to selectorB?

Thank you
Best
Joerg

@craigsumner
Copy link

I'm struggling with the same issue. I wish we could indicate the targeting using chaining, the same way we do the source.

@qa-joerg
Copy link
Author

qa-joerg commented Nov 9, 2022

Any news on this?

@Thomaash
Copy link

Thomaash commented Nov 8, 2023

You can achieve this with aliases:

cy.get("selectorA").eq(1).as("source");
cy.get("selectorB").contains("end").as("target");
cy.get("@source").drag("@target");

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

No branches or pull requests

3 participants