@dev-blinq/cucumber_client 1.0.1637-dev → 1.0.1639-dev
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.
|
@@ -12,7 +12,7 @@ import path from "path";
|
|
|
12
12
|
* @param {string} text the text to verify exists in page
|
|
13
13
|
* @protect
|
|
14
14
|
*/
|
|
15
|
-
async function verifyTextExistsInPage(text) {
|
|
15
|
+
export async function verifyTextExistsInPage(text) {
|
|
16
16
|
await context.web.verifyTextExistInPage(text, null, this);
|
|
17
17
|
}
|
|
18
18
|
Then("Verify the text {string} can be found in the page", verifyTextExistsInPage);
|
|
@@ -22,7 +22,7 @@ Then("Verify the text {string} can be found in the page", verifyTextExistsInPage
|
|
|
22
22
|
* @param {string} elementDescription element description
|
|
23
23
|
* @protect
|
|
24
24
|
*/
|
|
25
|
-
async function clickOnElement(elementDescription) {
|
|
25
|
+
export async function clickOnElement(elementDescription) {
|
|
26
26
|
await context.web.simpleClick(elementDescription, null, null, this);
|
|
27
27
|
}
|
|
28
28
|
When("click on {string}", clickOnElement);
|
|
@@ -36,7 +36,7 @@ When("Click {string}", clickOnElement);
|
|
|
36
36
|
* @param {string} value value to fill the element with
|
|
37
37
|
* @protect
|
|
38
38
|
*/
|
|
39
|
-
async function fillElement(elementDescription, value) {
|
|
39
|
+
export async function fillElement(elementDescription, value) {
|
|
40
40
|
await context.web.simpleClickType(elementDescription, value, null, null, this);
|
|
41
41
|
}
|
|
42
42
|
When("fill {string} with {string}", fillElement);
|
|
@@ -47,7 +47,7 @@ When("Fill {string} with {string}", fillElement);
|
|
|
47
47
|
* @param {string} text the text to verify does not exist in page
|
|
48
48
|
* @protect
|
|
49
49
|
*/
|
|
50
|
-
async function verifyTextNotExistsInPage(text) {
|
|
50
|
+
export async function verifyTextNotExistsInPage(text) {
|
|
51
51
|
await context.web.waitForTextToDisappear(text, null, this);
|
|
52
52
|
}
|
|
53
53
|
Then("Verify the text {string} cannot be found in the page", verifyTextNotExistsInPage);
|
|
@@ -57,7 +57,7 @@ Then("Verify the text {string} cannot be found in the page", verifyTextNotExists
|
|
|
57
57
|
* @param {string} url URL to navigate
|
|
58
58
|
* @protect
|
|
59
59
|
*/
|
|
60
|
-
async function navigateTo(url) {
|
|
60
|
+
export async function navigateTo(url) {
|
|
61
61
|
await context.web.goto(url, this);
|
|
62
62
|
}
|
|
63
63
|
When("Navigate to {string}", navigateTo);
|
|
@@ -66,7 +66,7 @@ When("Navigate to {string}", navigateTo);
|
|
|
66
66
|
* Navigate to the current page
|
|
67
67
|
* @protect
|
|
68
68
|
*/
|
|
69
|
-
async function browserNavigateBack() {
|
|
69
|
+
export async function browserNavigateBack() {
|
|
70
70
|
await context.web.goBack({}, this);
|
|
71
71
|
}
|
|
72
72
|
Then("Browser navigate back", browserNavigateBack);
|
|
@@ -75,7 +75,7 @@ Then("Browser navigate back", browserNavigateBack);
|
|
|
75
75
|
* Navigate forward in browser history
|
|
76
76
|
* @protect
|
|
77
77
|
*/
|
|
78
|
-
async function browserNavigateForward() {
|
|
78
|
+
export async function browserNavigateForward() {
|
|
79
79
|
await context.web.goForward({}, this);
|
|
80
80
|
}
|
|
81
81
|
Then("Browser navigate forward", browserNavigateForward);
|
|
@@ -85,7 +85,7 @@ Then("Browser navigate forward", browserNavigateForward);
|
|
|
85
85
|
* @param {string} filePath the file path or empty to store in the test data file
|
|
86
86
|
* @protect
|
|
87
87
|
*/
|
|
88
|
-
async function storeBrowserSession(filePath) {
|
|
88
|
+
export async function storeBrowserSession(filePath) {
|
|
89
89
|
await context.web.saveStoreState(filePath, this);
|
|
90
90
|
}
|
|
91
91
|
When("Store browser session {string}", storeBrowserSession);
|
|
@@ -95,7 +95,7 @@ When("Store browser session {string}", storeBrowserSession);
|
|
|
95
95
|
* @param {string} filePath the file path or empty
|
|
96
96
|
* @protect
|
|
97
97
|
*/
|
|
98
|
-
async function resetBrowserSession(filePath) {
|
|
98
|
+
export async function resetBrowserSession(filePath) {
|
|
99
99
|
await context.web.restoreSaveState(filePath, this);
|
|
100
100
|
}
|
|
101
101
|
When("Reset browser session {string}", resetBrowserSession);
|
|
@@ -107,7 +107,7 @@ When("Reset browser session {string}", resetBrowserSession);
|
|
|
107
107
|
* @param {string} textToVerify the target text to verify
|
|
108
108
|
* @protect
|
|
109
109
|
*/
|
|
110
|
-
async function verifyTextRelatedToText(textAnchor, climb, textToVerify) {
|
|
110
|
+
export async function verifyTextRelatedToText(textAnchor, climb, textToVerify) {
|
|
111
111
|
await context.web.verifyTextRelatedToText(textAnchor, climb, textToVerify, null, this);
|
|
112
112
|
}
|
|
113
113
|
Then(
|
|
@@ -120,7 +120,7 @@ Then(
|
|
|
120
120
|
* @requestName the name of the bruno request file
|
|
121
121
|
* @protect
|
|
122
122
|
*/
|
|
123
|
-
async function runBrunoRequest(requestName) {
|
|
123
|
+
export async function runBrunoRequest(requestName) {
|
|
124
124
|
await executeBrunoRequest(requestName, {}, context, this);
|
|
125
125
|
}
|
|
126
126
|
When("Bruno - {string}", runBrunoRequest);
|
|
@@ -131,7 +131,7 @@ When("bruno - {string}", runBrunoRequest);
|
|
|
131
131
|
* @param {string} fileName the downloaded file to verify
|
|
132
132
|
* @protect
|
|
133
133
|
*/
|
|
134
|
-
async function verify_the_downloaded_file_exists(fileName) {
|
|
134
|
+
export async function verify_the_downloaded_file_exists(fileName) {
|
|
135
135
|
const downloadFolder = path.join(context.reportFolder, "downloads");
|
|
136
136
|
const downloadFile = path.join(downloadFolder, fileName);
|
|
137
137
|
await verifyFileExists(downloadFile, {}, context, this);
|
|
@@ -148,7 +148,7 @@ When("Noop", async function () {});
|
|
|
148
148
|
* @param {string} url URL to be verified against current URL
|
|
149
149
|
* @protect
|
|
150
150
|
*/
|
|
151
|
-
async function verify_page_url(url) {
|
|
151
|
+
export async function verify_page_url(url) {
|
|
152
152
|
await context.web.verifyPagePath(url, {}, this);
|
|
153
153
|
}
|
|
154
154
|
Then("Verify the page url is {string}", verify_page_url);
|
|
@@ -158,7 +158,7 @@ Then("Verify the page url is {string}", verify_page_url);
|
|
|
158
158
|
* @param {string} title Title to be verified against current Title
|
|
159
159
|
* @protect
|
|
160
160
|
*/
|
|
161
|
-
async function verify_page_title(title) {
|
|
161
|
+
export async function verify_page_title(title) {
|
|
162
162
|
await context.web.verifyPageTitle(title, {}, this);
|
|
163
163
|
}
|
|
164
164
|
Then("Verify the page title is {string}", verify_page_title);
|
|
@@ -170,7 +170,7 @@ Then("Verify the page title is {string}", verify_page_title);
|
|
|
170
170
|
* @param {world} - Optional world context
|
|
171
171
|
* @returns Promise that resolves after the specified duration
|
|
172
172
|
*/
|
|
173
|
-
async function sleep(duration) {
|
|
173
|
+
export async function sleep(duration) {
|
|
174
174
|
await context.web.sleep(duration, {}, this);
|
|
175
175
|
}
|
|
176
176
|
Then("Sleep for {string} ms", { timeout: -1 }, sleep);
|
|
@@ -476,7 +476,7 @@ export function getCucumberStep({ step }) {
|
|
|
476
476
|
|
|
477
477
|
function makeStepTextUnique(step, stepsDefinitions) {
|
|
478
478
|
// const utilsFilePath = path.join("features", "step_definitions", "utils.mjs");
|
|
479
|
-
let stepText = step.text;
|
|
479
|
+
let stepText = step.renamedText ? step.renamedText : step.text;
|
|
480
480
|
let stepIndex = 1;
|
|
481
481
|
// console.log("makeStepTextUnique", step.text);
|
|
482
482
|
let stepDef = stepsDefinitions.findMatchingStep(stepText);
|
|
@@ -532,7 +532,16 @@ export async function saveRecording({ step, cucumberStep, codePage, projectDir,
|
|
|
532
532
|
const isUtilStep = makeStepTextUnique(step, stepsDefinitions);
|
|
533
533
|
|
|
534
534
|
if (isUtilStep) {
|
|
535
|
-
|
|
535
|
+
if (!step.renamedText) {
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
const { functionName } = stepsDefinitions.findMatchingStep(step.renamedText);
|
|
539
|
+
step.renamedText = functionName;
|
|
540
|
+
const newImportLine = `import { ${functionName} } from "./utils.mjs";\n`;
|
|
541
|
+
|
|
542
|
+
if (!codePage.fileContent.includes(newImportLine)) {
|
|
543
|
+
codePage.fileContent = newImportLine + codePage.fileContent;
|
|
544
|
+
}
|
|
536
545
|
}
|
|
537
546
|
}
|
|
538
547
|
|
|
@@ -568,7 +577,7 @@ export async function saveRecording({ step, cucumberStep, codePage, projectDir,
|
|
|
568
577
|
|
|
569
578
|
const userData = {}; // TODO: get user data
|
|
570
579
|
|
|
571
|
-
let methodName = toMethodName(step.text);
|
|
580
|
+
let methodName = step.renamedText ? step.renamedText : toMethodName(step.text);
|
|
572
581
|
if (step.isApiStep) {
|
|
573
582
|
const {
|
|
574
583
|
url,
|
|
@@ -631,7 +640,10 @@ export async function saveRecording({ step, cucumberStep, codePage, projectDir,
|
|
|
631
640
|
}
|
|
632
641
|
codePage = generateCodeResult.page;
|
|
633
642
|
methodName = generateCodeResult.methodName;
|
|
634
|
-
|
|
643
|
+
|
|
644
|
+
if (!step.renamedText) {
|
|
645
|
+
codePage.insertElements(generateCodeResult.elements);
|
|
646
|
+
}
|
|
635
647
|
|
|
636
648
|
const description = cucumberStep.text;
|
|
637
649
|
let path = null;
|
|
@@ -644,15 +656,17 @@ export async function saveRecording({ step, cucumberStep, codePage, projectDir,
|
|
|
644
656
|
protect = true;
|
|
645
657
|
}
|
|
646
658
|
}
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
659
|
+
if (!step.renamedText) {
|
|
660
|
+
const infraResult = codePage.addInfraCommand(
|
|
661
|
+
methodName,
|
|
662
|
+
description,
|
|
663
|
+
cucumberStep.getVariablesList(),
|
|
664
|
+
generateCodeResult.codeLines,
|
|
665
|
+
protect,
|
|
666
|
+
"recorder",
|
|
667
|
+
path
|
|
668
|
+
);
|
|
669
|
+
}
|
|
656
670
|
const keyword = (cucumberStep.keywordAlias ?? cucumberStep.keyword).trim();
|
|
657
671
|
const stepResult = codePage.addCucumberStep(
|
|
658
672
|
keyword,
|