@smartbit4all/playwright-qa 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/steps/download.steps.d.ts +19 -0
- package/dist/steps/download.steps.d.ts.map +1 -0
- package/dist/steps/download.steps.js +32 -0
- package/dist/steps/download.steps.js.map +1 -0
- package/dist/steps/index.d.ts +1 -0
- package/dist/steps/index.d.ts.map +1 -1
- package/dist/steps/index.js +3 -1
- package/dist/steps/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Download, Locator, Page } from '@playwright/test';
|
|
2
|
+
/**
|
|
3
|
+
* Clicks a button that triggers a download and returns the resulting `Download` object.
|
|
4
|
+
*
|
|
5
|
+
* Playwright only exposes a triggered download via the `download` event — a plain `.click()`
|
|
6
|
+
* still fires the download in the browser (you may see it in the download indicator, sometimes
|
|
7
|
+
* as a `blob:` URI), but without this the test has no handle to it, so it can't be asserted or
|
|
8
|
+
* saved.
|
|
9
|
+
*
|
|
10
|
+
* Note: this listens on `page` itself. If the button opens the download in a new tab
|
|
11
|
+
* (`target="_blank"` / `window.open`), the `download` event fires on that new `Page` instead, and
|
|
12
|
+
* this helper won't see it.
|
|
13
|
+
*
|
|
14
|
+
* @param container page or scope (e.g. a dialog) containing the button
|
|
15
|
+
* @param text data-testid or visible text of the button, as used by `findButton`
|
|
16
|
+
* @param timeout max time to wait for the download to start, in ms
|
|
17
|
+
*/
|
|
18
|
+
export declare function downloadWithButton(container: Page | Locator, text: string, timeout?: number): Promise<Download>;
|
|
19
|
+
//# sourceMappingURL=download.steps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download.steps.d.ts","sourceRoot":"","sources":["../../src/steps/download.steps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAOhE;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,IAAI,GAAG,OAAO,EACzB,IAAI,EAAE,MAAM,EACZ,OAAO,SAAQ,GACd,OAAO,CAAC,QAAQ,CAAC,CAOnB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.downloadWithButton = downloadWithButton;
|
|
4
|
+
const locators_1 = require("./locators");
|
|
5
|
+
function getPage(container) {
|
|
6
|
+
return 'page' in container ? container.page() : container;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Clicks a button that triggers a download and returns the resulting `Download` object.
|
|
10
|
+
*
|
|
11
|
+
* Playwright only exposes a triggered download via the `download` event — a plain `.click()`
|
|
12
|
+
* still fires the download in the browser (you may see it in the download indicator, sometimes
|
|
13
|
+
* as a `blob:` URI), but without this the test has no handle to it, so it can't be asserted or
|
|
14
|
+
* saved.
|
|
15
|
+
*
|
|
16
|
+
* Note: this listens on `page` itself. If the button opens the download in a new tab
|
|
17
|
+
* (`target="_blank"` / `window.open`), the `download` event fires on that new `Page` instead, and
|
|
18
|
+
* this helper won't see it.
|
|
19
|
+
*
|
|
20
|
+
* @param container page or scope (e.g. a dialog) containing the button
|
|
21
|
+
* @param text data-testid or visible text of the button, as used by `findButton`
|
|
22
|
+
* @param timeout max time to wait for the download to start, in ms
|
|
23
|
+
*/
|
|
24
|
+
async function downloadWithButton(container, text, timeout = 30000) {
|
|
25
|
+
const page = getPage(container);
|
|
26
|
+
const [download] = await Promise.all([
|
|
27
|
+
page.waitForEvent('download', { timeout }),
|
|
28
|
+
(0, locators_1.findButton)(container, text).click(),
|
|
29
|
+
]);
|
|
30
|
+
return download;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=download.steps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download.steps.js","sourceRoot":"","sources":["../../src/steps/download.steps.ts"],"names":[],"mappings":";;AAuBA,gDAWC;AAjCD,yCAAwC;AAExC,SAAS,OAAO,CAAC,SAAyB;IACxC,OAAO,MAAM,IAAI,SAAS,CAAC,CAAC,CAAE,SAAqB,CAAC,IAAI,EAAE,CAAC,CAAC,CAAE,SAAkB,CAAC;AACnF,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACI,KAAK,UAAU,kBAAkB,CACtC,SAAyB,EACzB,IAAY,EACZ,OAAO,GAAG,KAAK;IAEf,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACnC,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,CAAC;QAC1C,IAAA,qBAAU,EAAC,SAAS,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE;KACpC,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/steps/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { navigateToMain, navigateInTree, } from './navigation.steps';
|
|
|
4
4
|
export { topDialog, clickInDialog, } from './dialog.steps';
|
|
5
5
|
export { findButton, findPopupMenu, findMenuItem, POPUP_PANEL_SELECTOR, CUSTOM_PANEL_SELECTOR, } from './locators';
|
|
6
6
|
export { clickAction, openActionPath, } from './actions';
|
|
7
|
+
export { downloadWithButton, } from './download.steps';
|
|
7
8
|
export { fillField, fillDate, fillDateTime, selectOption, selectMultiple, selectRadio, setCheckbox, setCheckboxGroup, setToggle, addChip, removeChip, setChips, uploadFile, toggleAccordion, setField, setFields, type FieldValue, } from './forms';
|
|
8
9
|
export { dumpDom, type DomElementInfo, type DumpDomOptions, } from './debug';
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/steps/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAE5C,OAAO,EACL,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,SAAS,GACf,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,cAAc,EACd,cAAc,GACf,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,SAAS,EACT,aAAa,GACd,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,UAAU,EACV,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,WAAW,EACX,cAAc,GACf,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,OAAO,EACP,UAAU,EACV,QAAQ,EACR,UAAU,EACV,eAAe,EACf,QAAQ,EACR,SAAS,EACT,KAAK,UAAU,GAChB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,OAAO,EACP,KAAK,cAAc,EACnB,KAAK,cAAc,GACpB,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/steps/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAE5C,OAAO,EACL,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,SAAS,GACf,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,cAAc,EACd,cAAc,GACf,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,SAAS,EACT,aAAa,GACd,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,UAAU,EACV,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,WAAW,EACX,cAAc,GACf,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,OAAO,EACP,UAAU,EACV,QAAQ,EACR,UAAU,EACV,eAAe,EACf,QAAQ,EACR,SAAS,EACT,KAAK,UAAU,GAChB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,OAAO,EACP,KAAK,cAAc,EACnB,KAAK,cAAc,GACpB,MAAM,SAAS,CAAC"}
|
package/dist/steps/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dumpDom = exports.setFields = exports.setField = exports.toggleAccordion = exports.uploadFile = exports.setChips = exports.removeChip = exports.addChip = exports.setToggle = exports.setCheckboxGroup = exports.setCheckbox = exports.selectRadio = exports.selectMultiple = exports.selectOption = exports.fillDateTime = exports.fillDate = exports.fillField = exports.openActionPath = exports.clickAction = exports.CUSTOM_PANEL_SELECTOR = exports.POPUP_PANEL_SELECTOR = exports.findMenuItem = exports.findPopupMenu = exports.findButton = exports.clickInDialog = exports.topDialog = exports.navigateInTree = exports.navigateToMain = exports.clearGridFilters = exports.applyGridFilters = exports.filterAndSelectGridRow = exports.checkAllGridRows = exports.checkGridRowsOnPage = exports.checkGridRow = exports.selectGridRow = exports.waitForAngularIdle = void 0;
|
|
3
|
+
exports.dumpDom = exports.setFields = exports.setField = exports.toggleAccordion = exports.uploadFile = exports.setChips = exports.removeChip = exports.addChip = exports.setToggle = exports.setCheckboxGroup = exports.setCheckbox = exports.selectRadio = exports.selectMultiple = exports.selectOption = exports.fillDateTime = exports.fillDate = exports.fillField = exports.downloadWithButton = exports.openActionPath = exports.clickAction = exports.CUSTOM_PANEL_SELECTOR = exports.POPUP_PANEL_SELECTOR = exports.findMenuItem = exports.findPopupMenu = exports.findButton = exports.clickInDialog = exports.topDialog = exports.navigateInTree = exports.navigateToMain = exports.clearGridFilters = exports.applyGridFilters = exports.filterAndSelectGridRow = exports.checkAllGridRows = exports.checkGridRowsOnPage = exports.checkGridRow = exports.selectGridRow = exports.waitForAngularIdle = void 0;
|
|
4
4
|
var wait_1 = require("./wait");
|
|
5
5
|
Object.defineProperty(exports, "waitForAngularIdle", { enumerable: true, get: function () { return wait_1.waitForAngularIdle; } });
|
|
6
6
|
var grid_steps_1 = require("./grid.steps");
|
|
@@ -26,6 +26,8 @@ Object.defineProperty(exports, "CUSTOM_PANEL_SELECTOR", { enumerable: true, get:
|
|
|
26
26
|
var actions_1 = require("./actions");
|
|
27
27
|
Object.defineProperty(exports, "clickAction", { enumerable: true, get: function () { return actions_1.clickAction; } });
|
|
28
28
|
Object.defineProperty(exports, "openActionPath", { enumerable: true, get: function () { return actions_1.openActionPath; } });
|
|
29
|
+
var download_steps_1 = require("./download.steps");
|
|
30
|
+
Object.defineProperty(exports, "downloadWithButton", { enumerable: true, get: function () { return download_steps_1.downloadWithButton; } });
|
|
29
31
|
var forms_1 = require("./forms");
|
|
30
32
|
Object.defineProperty(exports, "fillField", { enumerable: true, get: function () { return forms_1.fillField; } });
|
|
31
33
|
Object.defineProperty(exports, "fillDate", { enumerable: true, get: function () { return forms_1.fillDate; } });
|
package/dist/steps/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/steps/index.ts"],"names":[],"mappings":";;;AAAA,+BAA4C;AAAnC,0GAAA,kBAAkB,OAAA;AAE3B,2CASsB;AARpB,2GAAA,aAAa,OAAA;AACb,0GAAA,YAAY,OAAA;AACZ,iHAAA,mBAAmB,OAAA;AACnB,8GAAA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