Skip to content

Commit

Permalink
Merge pull request #45 from inoshikag/scroll-to-element
Browse files Browse the repository at this point in the history
Added scrollIntoView
  • Loading branch information
mkmurali authored Feb 7, 2024
2 parents e42c4ea + d2cf509 commit 195e975
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
22 changes: 14 additions & 8 deletions lib/page_steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,20 @@ step("Check text <text> exists", async text => {
});

step("Click <eleType> with text <text>", async (eleType, text) => {
await taiko.click(await selectors.getElementBySelector(eleType, text));
const ele = await selectors.getElementBySelector(eleType, text);
await taiko.evaluate(ele, (item) => item.scrollIntoView());
await taiko.click(ele);
});

step(
"Click <eleType> closer <proximity> text <text>",
async (eleType, proximity, text) => {
await taiko.click(
await selectors.getElementBySelector(
eleType,
await selectors.getProximitySelector(proximity, text)
)
const ele = await selectors.getElementBySelector(
eleType,
await selectors.getProximitySelector(proximity, text)
);
await taiko.evaluate(ele, (item) => item.scrollIntoView());
await taiko.click(ele);
}
);

Expand Down Expand Up @@ -359,13 +361,17 @@ step("Scroll to <element>", async element => {
});

step(["Click <element>", "Click on <element>"], async element => {
await taiko.click(await getPageElement(taiko, element));
const ele = await getPageElement(taiko, element);
await taiko.evaluate(ele, (item) => item.scrollIntoView());
await taiko.click(ele);
});

step(["Click <element> <elementText>", "Click on <element> <elementText>", "Click <element> for <elementText>"],
async (element, elementText) => {
element = element + " with text " + helpers.getValue(elementText);
await taiko.click(await getPageElement(taiko, element));
const ele = await getPageElement(taiko, element);
await taiko.evaluate(ele, (item) => item.scrollIntoView());
await taiko.click(ele);
});

step("Clear <element> text box", async element => {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@softrams/gauge-taiko-steps",
"version": "0.1.5",
"version": "0.1.6",
"description": "Implementation of common test steps with Taiko driver for writing tests with Gauge framework",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 195e975

Please sign in to comment.