Skip to content

Commit

Permalink
file-download-path-set
Browse files Browse the repository at this point in the history
  • Loading branch information
erla-softrams committed Mar 16, 2024
1 parent 195e975 commit a429b33
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions lib/_init.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const browser_args = docker_env === 'true' ? docker_args.concat(addl_browser_arg
beforeSuite(async () => {
if (!browser_for_each_scenario || browser_for_each_scenario === 'false') {
await taiko.openBrowser({ headless: headless === 'true', args: browser_args});
await setFileDownloadPath();
}
taiko.setConfig({
navigationTimeout: Number((process.env.navigation_timeout || taiko.getConfig("navigationTimeout"))),
Expand All @@ -37,6 +38,7 @@ beforeScenario(async context => {
headless: headless === 'true',
args: browser_args
});
await setFileDownloadPath();
}
});

Expand Down Expand Up @@ -77,3 +79,11 @@ gauge.customScreenshotWriter = async function () {
await taiko.screenshot({ path: screenshotFilePath, fullPage: false });
return path.basename(screenshotFilePath);
};

async function setFileDownloadPath() {
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 });
}
};
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.6",
"version": "0.1.7",
"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 a429b33

Please sign in to comment.