Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: softrams/gauge-taiko-steps
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.1.3
Choose a base ref
...
head repository: softrams/gauge-taiko-steps
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Sep 1, 2023

  1. Copy the full SHA
    338b66d View commit details
  2. Merge pull request #36 from softrams/new-steps

    new-steps: added new steps for web table cell element and file uploads
    mkmurali authored Sep 1, 2023
    Copy the full SHA
    06a9db5 View commit details

Commits on Oct 8, 2023

  1. Bump postcss from 8.4.27 to 8.4.31

    Bumps [postcss](https://github.com/postcss/postcss) from 8.4.27 to 8.4.31.
    - [Release notes](https://github.com/postcss/postcss/releases)
    - [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
    - [Commits](postcss/postcss@8.4.27...8.4.31)
    
    ---
    updated-dependencies:
    - dependency-name: postcss
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Oct 8, 2023
    Copy the full SHA
    44811f0 View commit details

Commits on Oct 19, 2023

  1. Bump @babel/traverse from 7.22.8 to 7.23.2

    Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.22.8 to 7.23.2.
    - [Release notes](https://github.com/babel/babel/releases)
    - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
    - [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)
    
    ---
    updated-dependencies:
    - dependency-name: "@babel/traverse"
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Oct 19, 2023
    Copy the full SHA
    320b6af View commit details

Commits on Nov 20, 2023

  1. Bump @faker-js/faker from 8.0.2 to 8.3.1

    Bumps [@faker-js/faker](https://github.com/faker-js/faker) from 8.0.2 to 8.3.1.
    - [Release notes](https://github.com/faker-js/faker/releases)
    - [Changelog](https://github.com/faker-js/faker/blob/next/CHANGELOG.md)
    - [Commits](faker-js/faker@v8.0.2...v8.3.1)
    
    ---
    updated-dependencies:
    - dependency-name: "@faker-js/faker"
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Nov 20, 2023
    Copy the full SHA
    74655fc View commit details

Commits on Dec 5, 2023

  1. Merge pull request #41 from softrams/dependabot/npm_and_yarn/faker-js…

    …/faker-8.3.1
    
    Bump @faker-js/faker from 8.0.2 to 8.3.1
    mkmurali authored Dec 5, 2023
    Copy the full SHA
    3f6c75e View commit details
  2. Copy the full SHA
    341db10 View commit details
  3. Merge pull request #38 from softrams/dependabot/npm_and_yarn/postcss-…

    …8.4.31
    
    Bump postcss from 8.4.27 to 8.4.31
    mkmurali authored Dec 5, 2023
    Copy the full SHA
    feebeee View commit details
  4. Copy the full SHA
    a47391a View commit details
  5. Merge pull request #40 from softrams/dependabot/npm_and_yarn/babel/tr…

    …averse-7.23.2
    
    Bump @babel/traverse from 7.22.8 to 7.23.2
    mkmurali authored Dec 5, 2023
    Copy the full SHA
    c038b6d View commit details
  6. Copy the full SHA
    c8a8d82 View commit details
  7. Merge pull request #42 from softrams/bump-up

    Merged with updated versions
    mkmurali authored Dec 5, 2023
    Copy the full SHA
    e42c4ea View commit details

Commits on Jan 29, 2024

  1. Added scrollIntoView

    GGOT committed Jan 29, 2024
    Copy the full SHA
    5d56d88 View commit details

Commits on Jan 30, 2024

  1. trigger build

    GGOT committed Jan 30, 2024
    Copy the full SHA
    6df01a6 View commit details

Commits on Feb 7, 2024

  1. Updated version

    GGOT committed Feb 7, 2024
    Copy the full SHA
    d2cf509 View commit details
  2. Merge pull request #45 from inoshikag/scroll-to-element

    Added scrollIntoView
    mkmurali authored Feb 7, 2024
    Copy the full SHA
    195e975 View commit details

Commits on Mar 16, 2024

  1. file-download-path-set

    erla-softrams committed Mar 16, 2024
    Copy the full SHA
    a429b33 View commit details
  2. file-download-path-set

    erla-softrams committed Mar 16, 2024
    Copy the full SHA
    0bebf08 View commit details

Commits on Mar 18, 2024

  1. Merge pull request #47 from softrams/file-download-path-set

    File download path set
    mkmurali authored Mar 18, 2024
    Copy the full SHA
    fd551c9 View commit details

Commits on Jun 20, 2024

  1. Updated dependencies

    mkmurali committed Jun 20, 2024
    Copy the full SHA
    e9f7696 View commit details
  2. Updated dependencies

    mkmurali committed Jun 20, 2024
    Copy the full SHA
    01288f6 View commit details
  3. Merge pull request #48 from softrams/deps

    Updated dependencies
    mkmurali authored Jun 20, 2024
    Copy the full SHA
    fc3e9bd View commit details

Commits on Jul 15, 2024

  1. Bump taiko-accessibility from 0.3.2 to 0.3.3

    Bumps [taiko-accessibility](https://github.com/andreas-ku/taiko-accessibility) from 0.3.2 to 0.3.3.
    - [Release notes](https://github.com/andreas-ku/taiko-accessibility/releases)
    - [Commits](andreas-ku/taiko-accessibility@v0.3.2...v0.3.3)
    
    ---
    updated-dependencies:
    - dependency-name: taiko-accessibility
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jul 15, 2024
    Copy the full SHA
    32933f2 View commit details

Commits on Jul 22, 2024

  1. Bump taiko from 1.4.0 to 1.4.1

    Bumps [taiko](https://github.com/getgauge/taiko) from 1.4.0 to 1.4.1.
    - [Release notes](https://github.com/getgauge/taiko/releases)
    - [Commits](https://github.com/getgauge/taiko/commits)
    
    ---
    updated-dependencies:
    - dependency-name: taiko
      dependency-type: direct:development
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jul 22, 2024
    Copy the full SHA
    5453324 View commit details

Commits on Jul 24, 2024

  1. Copy the full SHA
    eacf4d6 View commit details
  2. Copy the full SHA
    f1c5617 View commit details
  3. Copy the full SHA
    829b547 View commit details
  4. Copy the full SHA
    d5446af View commit details
  5. Copy the full SHA
    0888213 View commit details
  6. Copy the full SHA
    8df5c29 View commit details
  7. Merge pull request #49 from softrams/dependabot/npm_and_yarn/taiko-ac…

    …cessibility-0.3.3
    
    Bump taiko-accessibility from 0.3.2 to 0.3.3
    mkmurali authored Jul 24, 2024
    Copy the full SHA
    01b5c53 View commit details
  8. Copy the full SHA
    1ae883a View commit details
  9. Merge pull request #50 from softrams/dependabot/npm_and_yarn/taiko-1.4.1

    Bump taiko from 1.4.0 to 1.4.1
    mkmurali authored Jul 24, 2024
    Copy the full SHA
    e452f16 View commit details
  10. Copy the full SHA
    8b35a84 View commit details
  11. Merge pull request #51 from softrams/file-download-path

    File download path
    mkmurali authored Jul 24, 2024
    Copy the full SHA
    90f46c8 View commit details

Commits on Nov 4, 2024

  1. Bump @faker-js/faker from 8.4.1 to 9.2.0

    Bumps [@faker-js/faker](https://github.com/faker-js/faker) from 8.4.1 to 9.2.0.
    - [Release notes](https://github.com/faker-js/faker/releases)
    - [Changelog](https://github.com/faker-js/faker/blob/next/CHANGELOG.md)
    - [Commits](faker-js/faker@v8.4.1...v9.2.0)
    
    ---
    updated-dependencies:
    - dependency-name: "@faker-js/faker"
      dependency-type: direct:development
      update-type: version-update:semver-major
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Nov 4, 2024
    Copy the full SHA
    efbe131 View commit details

Commits on Nov 19, 2024

  1. Copy the full SHA
    e16dc8e View commit details
  2. Merge pull request #56 from softrams/dependabot/npm_and_yarn/faker-js…

    …/faker-9.2.0
    
    Bump @faker-js/faker from 8.4.1 to 9.2.0
    mkmurali authored Nov 19, 2024
    Copy the full SHA
    5f3a36b View commit details

Commits on Jan 14, 2025

  1. Pkg updates

    mkmurali committed Jan 14, 2025
    Copy the full SHA
    443d2d5 View commit details
  2. Merge pull request #60 from softrams/pkg-updates

    Pkg updates
    mkmurali authored Jan 14, 2025
    Copy the full SHA
    8493e2b View commit details
Showing with 899 additions and 922 deletions.
  1. +1 −1 README.md
  2. +11 −0 lib/_helpers.js
  3. +2 −0 lib/_init.js
  4. +38 −6 lib/_pageElement.js
  5. +29 −11 lib/page_steps.js
  6. +3 −4 lib/page_steps_continue_on_failure.js
  7. +812 −897 package-lock.json
  8. +3 −3 package.json
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@ sleep_after_scenario = 5000
- Emulate timezone "America/New_York"
- Set screen size as width "1600" height "900"

- Goto "/"
- Goto ""

- Check "link" with text "Link Text" exists
- Check "button" with text "FAQs" exists
11 changes: 11 additions & 0 deletions lib/_helpers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const { faker } = require("@faker-js/faker");
const path = require("path");
const moment = require("moment");

const download_dir = process.env.file_download_path;

exports.parseString = text => {
let result = text;
try {
@@ -28,6 +31,14 @@ exports.getValue = value => {
return String(getDynamicValue(value));
};

exports.setFileDownloadPath = async (taiko) => {
if (download_dir) {
const file_download_dir = path.isAbsolute(`${download_dir}`) ? `${download_dir}` : process.cwd() + `/${download_dir}`;
var downloadPath = path.resolve(__dirname, file_download_dir);
await taiko.client().send('Page.setDownloadBehavior', { behavior: 'allow', downloadPath: downloadPath });
}
};

const getDynamicValue = value => {
return process.env[value] || gauge.dataStore.scenarioStore.get(value) || getDate(value) || getFakeData(value) || value;
};
2 changes: 2 additions & 0 deletions lib/_init.js
Original file line number Diff line number Diff line change
@@ -17,6 +17,8 @@ addl_browser_args = process.env.window_size ? addl_browser_args.concat(process.e

const browser_args = docker_env === 'true' ? docker_args.concat(addl_browser_args) : addl_browser_args;

const download_dir = process.env.file_download_path;

beforeSuite(async () => {
if (!browser_for_each_scenario || browser_for_each_scenario === 'false') {
await taiko.openBrowser({ headless: headless === 'true', args: browser_args});
44 changes: 38 additions & 6 deletions lib/_pageElement.js
Original file line number Diff line number Diff line change
@@ -122,12 +122,29 @@ async function getFileContent(path) {
return fs.existsSync(path) ? await readFile(path, 'utf8') : null;
}

exports.getPageElement = async (taiko, element) => {
const _element = await getHelper(taiko, element);
if (_element !== element) {
return await _element;
async function tableCellElement(taiko, element) {
if (element.startsWith("table")) {
const tableCellObject = JSON.parse(element.replace("table", "").trim());
const tableElementValue = tableCellObject["tableElement"];
const columnNameValue = tableCellObject["columnName"];
const rowValue = tableCellObject["row"];
const tableElement = await getElement(taiko, tableElementValue);
const tableElementLocatorValue = tableElement.description.replace("CustomSelector with query", "").trim();
const columnHeaders = await taiko.$(tableElementLocatorValue + "//thead//th").elements();
let columnIndex = 0;
for (let index in columnHeaders) {
const columnHeader = (await columnHeaders[index].text()).toString();
if (columnHeader === columnNameValue) {
columnIndex = ++index;
break;
}
}
return await taiko.$("(" + tableElementLocatorValue + "//tbody//tr[" + rowValue + "])//td[" + columnIndex + "]");
}

return element;
}

async function getElement(taiko, element) {
let elementText;
if (element.includes("with text")) {
const elementParts = element.split("with text");
@@ -153,13 +170,28 @@ exports.getPageElement = async (taiko, element) => {
if (hasElement) {
let elementLocatorValue = fileObject[element];
elementLocatorValue = elementText ?
elementLocatorValue.replace("{text}", elementText) : elementLocatorValue;
elementLocatorValue.replaceAll("{text}", elementText) : elementLocatorValue;

return await taiko.$(elementLocatorValue);
}

return await element;
}

exports.getPageElement = async (taiko, element) => {
let _element = await getHelper(taiko, element);
if (_element !== element) {
return await _element;
}

_element = await tableCellElement(taiko, element);
if (_element !== element) {
return await _element;
}

return await getElement(taiko, element);
}

exports.checkElementState = async (taiko, element, elementState) => {
const pageElement = await this.getPageElement(taiko, element);
switch (elementState) {
40 changes: 29 additions & 11 deletions lib/page_steps.js
Original file line number Diff line number Diff line change
@@ -4,7 +4,9 @@ const taiko = require("taiko");
const assert = require("assert");
const selectors = require("./_selectors");
const helpers = require("./_helpers");
const path = require("path");
const { getPageElement, checkElementState, scrollToElementView } = require("./_pageElement");
const { setFileDownloadPath } = require("./_helpers");

step(["Goto <url>", "Open <url>", "Goto <url> in new tab", "Open <url> in new tab"], async url => {
let navigateUrl = process.env[url] ? process.env[url] : (url ? url : process.env.APP_ROOT_URL);
@@ -19,6 +21,7 @@ step(["Goto <url>", "Open <url>", "Goto <url> in new tab", "Open <url> in new ta
const response = await taiko.goto(navigateUrl);
assert.strictEqual(response.status.code, 200);
}
setFileDownloadPath(taiko);
});

step(["Switch to <urlTitle>", "Switch to <urlTitle> window"], async urlTitle => {
@@ -46,18 +49,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);
}
);

@@ -358,17 +363,21 @@ 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 => {
await taiko.clear(await getPageElement(taiko, element))
await taiko.clear(await getPageElement(taiko, element));
});

step(["Enter <value> to <element> text box", "Enter <value> to <element>"], async (value, element) => {
@@ -401,8 +410,7 @@ step("Verify <element> text is <elementText>", async (element, elementText) => {
elementText = helpers.getValue(elementText);
gauge.message("Verifying " + element + " text contains " + elementText);

await taiko.waitFor(element + ' did not contain text ' + elementText,
async () => (await (await getPageElement(taiko, element)).text()).toString()
await taiko.waitFor(async () => (await (await getPageElement(taiko, element)).text()).toString()
.replaceAll("\\s+", " ")
.replaceAll("\n", " ")
.includes(elementText));
@@ -419,6 +427,16 @@ step(["Save <element> as <elementTextKey>", "Save <element> text as <elementText
gauge.message("Saved " + elementText + " as " + elementTextKey);
});

/* file actions steps 👇 */

step("Upload <filePath> file to <element>", async (filePath, element) => {
const fileAbsolutePath = process.env.file_upload_directory && !path.isAbsolute(filePath) ?
path.join(process.env.file_upload_directory, filePath) : path.join(filePath);
await taiko.attach(fileAbsolutePath, await getPageElement(taiko, element));
});

/* file actions steps 👆 */

step(["Wait <seconds> seconds", "Wait for <seconds> seconds"], async seconds => {
await taiko.waitFor(seconds * 1000);
});
7 changes: 3 additions & 4 deletions lib/page_steps_continue_on_failure.js
Original file line number Diff line number Diff line change
@@ -17,13 +17,12 @@ step(["Verify <element> <elementText> <elementState>", "Verify <element> <elem
await checkElementState(taiko, element, elementState);
});

step("Verify <element> text is <elementText>",
{continueOnFailure: true}, async (element, elementText) => {
step("Verify <element> text is <elementText>",
{continueOnFailure: true}, async (element, elementText) => {
elementText = helpers.getValue(elementText);
gauge.message("Verifying " + element + " text contains " + elementText);

await taiko.waitFor(element + ' did not contain text ' + elementText,
async () => (await (await getPageElement(taiko, element)).text()).toString()
await taiko.waitFor(async () => (await (await getPageElement(taiko, element)).text()).toString()
.replaceAll("\\s+", " ")
.replaceAll("\n", " ")
.includes(elementText))
Loading