-
Notifications
You must be signed in to change notification settings - Fork 22
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
[WIP] Add new action, click each element in list and drag & drop #47
base: master
Are you sure you want to change the base?
Conversation
Nice, I was going to have to write a drag and drop step, thank you! :) |
packages/browser.smash
Outdated
@@ -148,6 +148,20 @@ | |||
} | |||
} | |||
|
|||
* Click each {{element}} { | |||
if(!Array.isArray(element)){ | |||
const elems = await $(element); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you meant to use $$()
, which returns multiple elements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I don't really envision many users passing in an array, as everything in smashtest is a string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i set a array if people need to set array with multiple element haven't a same Id or class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it won't be easy for them to set an array. They'd have to set it in a code block using something like g()
.
Click each [one, two] // NOT an array - this is the string 'one, two'
Easier just to use multiple Click
steps in succession.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh ! nice I did not think about doing it like that but it's a great idea a table disguised to make several clicks on items of different name
packages/browser.smash
Outdated
} | ||
} | ||
|
||
* Drag {{dragPosition}} in {{dropPosition}} { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would reword this as
Drag {{elementFrom}} to {{elementTo}}
and Drag {{elementFrom}} to {{x}}, {{y}}
(2 different functions)
See dragAndDrop()
docs: https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/input_exports_Actions.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok i can reword this and create 2 different functions.
Not a final function i work on it, i push so that you can see where I am |
packages/browser.smash
Outdated
} | ||
|
||
* Drag {{elementFrom}} to {{x}}, {{y}} { | ||
await browser.driver.actions({bridge: true}).dragAndDrop(dragPosition, {x: parseInt(x), y: parseInt(y)}).perform(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable dragPosition
doesn't exist. A unit test would catch that :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry iu didn't test this :)
packages/browser.smash
Outdated
elems.forEach(elem => elem.click()); | ||
} | ||
|
||
* Drag {{elementFrom}} in {{elementTo}} { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in --> to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its good now
packages/browser.smash
Outdated
@@ -148,6 +148,20 @@ | |||
} | |||
} | |||
|
|||
* Click each {{element}} { | |||
const list = element.split(","); | |||
const elems = await $$(list); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No this isn't right. You had it right before. You shouldn't take a comma-separated list (among many things, the comma is a special character in an EF and this will interfere with that). You just $$(element)
and do the forEach()
below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok my bad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good! Can you add some unit tests to tests/packages/browser.smash
?
yeah i write this test |
I add a new function for multi click on page :
I add a drag and drop function.