@zohodesk/testinglibrary 0.1.8-stb-bdd-v26 → 0.1.9
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/.babelrc +21 -18
- package/.eslintrc.js +31 -31
- package/.prettierrc +5 -5
- package/README.md +17 -17
- package/bin/cli.js +2 -2
- package/build/bdd-framework/cli/commands/env.js +42 -0
- package/build/bdd-framework/cli/commands/export.js +47 -0
- package/build/bdd-framework/cli/commands/test.js +64 -0
- package/build/bdd-framework/cli/index.js +11 -0
- package/build/bdd-framework/cli/options.js +19 -0
- package/build/bdd-framework/cli/worker.js +13 -0
- package/build/bdd-framework/config/configDir.js +35 -0
- package/build/bdd-framework/config/enrichReporterData.js +23 -0
- package/build/bdd-framework/config/env.js +50 -0
- package/build/bdd-framework/config/index.js +94 -0
- package/build/bdd-framework/config/lang.js +14 -0
- package/build/bdd-framework/cucumber/buildStepDefinition.js +43 -0
- package/build/bdd-framework/cucumber/createTestStep.js +43 -0
- package/build/bdd-framework/cucumber/formatter/EventDataCollector.js +126 -0
- package/build/bdd-framework/cucumber/formatter/GherkinDocumentParser.js +72 -0
- package/build/bdd-framework/cucumber/formatter/PickleParser.js +25 -0
- package/build/bdd-framework/cucumber/formatter/durationHelpers.js +13 -0
- package/build/bdd-framework/cucumber/formatter/getColorFns.js +57 -0
- package/build/bdd-framework/cucumber/formatter/index.js +16 -0
- package/build/bdd-framework/cucumber/formatter/locationHelpers.js +16 -0
- package/build/bdd-framework/cucumber/loadConfig.js +17 -0
- package/build/bdd-framework/cucumber/loadFeatures.js +70 -0
- package/build/bdd-framework/cucumber/loadSnippetBuilder.js +20 -0
- package/build/bdd-framework/cucumber/loadSteps.js +47 -0
- package/build/bdd-framework/cucumber/resolveFeaturePaths.js +62 -0
- package/build/bdd-framework/cucumber/stepArguments.js +21 -0
- package/build/bdd-framework/cucumber/types.js +5 -0
- package/build/bdd-framework/cucumber/valueChecker.js +23 -0
- package/build/bdd-framework/decorators.js +18 -0
- package/build/bdd-framework/gen/fixtures.js +48 -0
- package/build/bdd-framework/gen/formatter.js +123 -0
- package/build/bdd-framework/gen/i18n.js +39 -0
- package/build/bdd-framework/gen/index.js +185 -0
- package/build/bdd-framework/gen/testFile.js +465 -0
- package/build/bdd-framework/gen/testMeta.js +60 -0
- package/build/bdd-framework/gen/testNode.js +60 -0
- package/build/bdd-framework/gen/testPoms.js +133 -0
- package/build/bdd-framework/hooks/scenario.js +130 -0
- package/build/bdd-framework/hooks/worker.js +89 -0
- package/build/bdd-framework/index.js +52 -0
- package/build/bdd-framework/playwright/fixtureParameterNames.js +93 -0
- package/build/bdd-framework/playwright/getLocationInFile.js +79 -0
- package/build/bdd-framework/playwright/loadConfig.js +42 -0
- package/build/bdd-framework/playwright/loadUtils.js +33 -0
- package/build/bdd-framework/playwright/testTypeImpl.js +61 -0
- package/build/bdd-framework/playwright/transform.js +88 -0
- package/build/bdd-framework/playwright/types.js +5 -0
- package/build/bdd-framework/playwright/utils.js +34 -0
- package/build/bdd-framework/reporter/cucumber/base.js +57 -0
- package/build/bdd-framework/reporter/cucumber/custom.js +73 -0
- package/build/bdd-framework/reporter/cucumber/helper.js +12 -0
- package/build/bdd-framework/reporter/cucumber/html.js +35 -0
- package/build/bdd-framework/reporter/cucumber/index.js +74 -0
- package/build/bdd-framework/reporter/cucumber/json.js +312 -0
- package/build/bdd-framework/reporter/cucumber/junit.js +205 -0
- package/build/bdd-framework/reporter/cucumber/message.js +20 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/AttachmentMapper.js +64 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Builder.js +196 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocument.js +43 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocumentClone.js +52 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/GherkinDocuments.js +105 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Hook.js +70 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Meta.js +45 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Pickles.js +27 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/Projects.js +38 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCase.js +128 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCaseRun.js +126 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestCaseRunHooks.js +102 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestStepAttachments.js +50 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/TestStepRun.js +88 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/index.js +30 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/pwUtils.js +51 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/timing.js +35 -0
- package/build/bdd-framework/reporter/cucumber/messagesBuilder/types.js +5 -0
- package/build/bdd-framework/run/StepInvoker.js +68 -0
- package/build/bdd-framework/run/bddDataAttachment.js +46 -0
- package/build/bdd-framework/run/bddFixtures.js +191 -0
- package/build/bdd-framework/run/bddWorld.js +79 -0
- package/build/bdd-framework/run/bddWorldInternal.js +15 -0
- package/build/bdd-framework/snippets/index.js +132 -0
- package/build/bdd-framework/snippets/snippetSyntax.js +43 -0
- package/build/bdd-framework/snippets/snippetSyntaxDecorators.js +26 -0
- package/build/bdd-framework/snippets/snippetSyntaxTs.js +18 -0
- package/build/bdd-framework/stepDefinitions/createBdd.js +66 -0
- package/build/bdd-framework/stepDefinitions/decorators/class.js +68 -0
- package/build/bdd-framework/stepDefinitions/decorators/steps.js +99 -0
- package/build/bdd-framework/stepDefinitions/defineStep.js +62 -0
- package/build/bdd-framework/stepDefinitions/stepConfig.js +24 -0
- package/build/bdd-framework/utils/AutofillMap.js +20 -0
- package/build/bdd-framework/utils/exit.js +62 -0
- package/build/bdd-framework/utils/index.js +93 -0
- package/build/bdd-framework/utils/jsStringWrap.js +44 -0
- package/build/bdd-framework/utils/logger.js +30 -0
- package/build/bdd-framework/utils/stripAnsiEscapes.js +20 -0
- package/build/core/playwright/builtInFixtures/addTags.js +1 -1
- package/build/core/playwright/builtInFixtures/context.js +18 -1
- package/build/core/playwright/builtInFixtures/i18N.js +33 -0
- package/build/core/playwright/builtInFixtures/index.js +19 -7
- package/build/core/playwright/builtInFixtures/page.js +69 -39
- package/build/core/playwright/builtInFixtures/unauthenticatedPage.js +18 -0
- package/build/core/playwright/clear-caches.js +19 -8
- package/build/core/playwright/codegen.js +4 -4
- package/build/core/playwright/constants/browserTypes.js +12 -0
- package/build/core/playwright/custom-commands.js +1 -1
- package/build/core/playwright/env-initializer.js +10 -6
- package/build/core/playwright/helpers/auth/accountLogin.js +18 -0
- package/build/core/playwright/helpers/auth/checkAuthCookies.js +47 -0
- package/build/core/playwright/helpers/auth/getUrlOrigin.js +13 -0
- package/build/core/playwright/helpers/auth/getUsers.js +72 -0
- package/build/core/playwright/helpers/auth/index.js +58 -0
- package/build/core/playwright/helpers/auth/loginSteps.js +36 -0
- package/build/core/playwright/helpers/configFileNameProvider.js +17 -0
- package/build/core/playwright/helpers/getUserFixtures.js +23 -0
- package/build/core/playwright/helpers/mergeObjects.js +13 -0
- package/build/core/playwright/helpers/parseUserArgs.js +11 -0
- package/build/core/playwright/index.js +69 -15
- package/build/core/playwright/readConfigFile.js +50 -39
- package/build/core/playwright/report-generator.js +7 -7
- package/build/core/playwright/setup/config-creator.js +15 -16
- package/build/core/playwright/setup/config-utils.js +60 -26
- package/build/core/playwright/setup/custom-reporter.js +3 -2
- package/build/core/playwright/tag-processor.js +12 -23
- package/build/core/playwright/test-runner.js +49 -63
- package/build/core/playwright/types.js +43 -0
- package/build/decorators.d.ts +1 -1
- package/build/decorators.js +16 -2
- package/build/index.d.ts +79 -12
- package/build/index.js +51 -9
- package/build/lib/cli.js +12 -3
- package/build/lib/post-install.js +18 -10
- package/build/parser/sample.feature +34 -34
- package/build/parser/sample.spec.js +18 -18
- package/build/setup-folder-structure/helper.js +3 -0
- package/build/setup-folder-structure/reportEnhancement/addonScript.html +24 -24
- package/build/setup-folder-structure/samples/auth-setup-sample.js +72 -72
- package/build/setup-folder-structure/samples/authUsers-sample.json +8 -8
- package/build/setup-folder-structure/samples/env-config-sample.json +20 -20
- package/build/setup-folder-structure/samples/git-ignore.sample.js +36 -36
- package/build/setup-folder-structure/samples/uat-config-sample.js +44 -44
- package/build/utils/cliArgsToObject.js +30 -26
- package/build/utils/fileUtils.js +4 -19
- package/build/utils/getFilePath.js +1 -2
- package/build/utils/rootPath.js +16 -9
- package/changelog.md +144 -131
- package/jest.config.js +63 -63
- package/npm-shrinkwrap.json +6475 -5994
- package/package.json +57 -56
- package/playwright.config.js +112 -112
- package/build/bdd-poc/config/pathConfig.js +0 -22
- package/build/bdd-poc/core-runner/exportMethods.js +0 -22
- package/build/bdd-poc/core-runner/main.js +0 -15
- package/build/bdd-poc/core-runner/stepDefinitions.js +0 -157
- package/build/bdd-poc/core-runner/stepRunner.js +0 -25
- package/build/bdd-poc/errors/throwError.js +0 -23
- package/build/bdd-poc/index.js +0 -26
- package/build/bdd-poc/test/cucumber/featureFileParer.js +0 -84
- package/build/bdd-poc/test/cucumber/parserCucumber.js +0 -15
- package/build/bdd-poc/test/stepGenerate/extractTestInputs.js +0 -65
- package/build/bdd-poc/test/stepGenerate/parserSteps.js +0 -81
- package/build/bdd-poc/test/stepGenerate/stepFileGenerate.js +0 -40
- package/build/bdd-poc/test/stepGenerate/stepsnippets.js +0 -61
- package/build/bdd-poc/test/tagsHandle.js +0 -70
- package/build/bdd-poc/test/testData.js +0 -125
- package/build/bdd-poc/test/testStructure.js +0 -92
- package/build/bdd-poc/utils/stringManipulation.js +0 -26
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object|null} viewportConfig
|
|
3
|
+
* @property {number} width - width of the viewport
|
|
4
|
+
* @property {number} height - height of the viewport
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {Object|null} viewportConfig
|
|
8
|
+
* @property {number} width - width of the viewport
|
|
9
|
+
* @property {number} height - height of the viewport
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @typedef {Object|null} testSetupConfig
|
|
14
|
+
* @property {any} page - Function that will be called while setting up page fixtures
|
|
15
|
+
* @property {any} context - Function that will be called while setting up context fixtures
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Represents the user configuration object.
|
|
20
|
+
* @typedef {Object} UserConfig
|
|
21
|
+
* @property {string} uatDirectory - Directory in which uat configuration is places.
|
|
22
|
+
* @property {string} headless - Headless Browsers mode.
|
|
23
|
+
* @property {number} trace - trace for test cases.
|
|
24
|
+
* @property {boolean} video - video for test cases,
|
|
25
|
+
* @property {boolean} debug - debug mode
|
|
26
|
+
* @property {string} mode: mode in which the test cases needs to run
|
|
27
|
+
* @property {boolean} isAuthMode - Auth Mode. config whether authentication step needed before running test cases
|
|
28
|
+
* @property {string} authFilePath - File Path where the cookies stored
|
|
29
|
+
* @property {any} browsers: List of browsers
|
|
30
|
+
* @property {string} openReportOn: default Option value (never, on-failure and always)
|
|
31
|
+
* @property {any} reportPath : directory where report is generate
|
|
32
|
+
* @property {boolean} bddMode: Feature files needs to be processed
|
|
33
|
+
* @property {number} expectTimeout: time in milliseconds which the expect condition should fail
|
|
34
|
+
* @property {number} testTimeout: time in milliseconds which the test should fail
|
|
35
|
+
* @property {Object} additionalPages: custom pages configuration
|
|
36
|
+
* @property {string} featureFilesFolder: folder name under which feature-files will be placed. Default is feature-files
|
|
37
|
+
* @property {string} stepDefinitionsFolder: folder name under which step implementations will be placed. Default is steps
|
|
38
|
+
* @property {viewportConfig} viewport: viewport configuration for the browser. Default is { width: 1280, height: 720 }
|
|
39
|
+
* @property {string} testIdAttribute: Change the default data-testid attribute. configure what attribute to search while calling getByTestId
|
|
40
|
+
* @property {Array} editionOrder: Order in the form of larger editions in the back. Edition with the most privelages should be last
|
|
41
|
+
* @property {testSetupConfig} testSetup: Specify page and context functions that will be called while intilaizing fixtures.
|
|
42
|
+
*/
|
|
43
|
+
"use strict";
|
package/build/decorators.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export * from './bdd-framework/decorators';
|
package/build/decorators.js
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _decorators = require("./bdd-framework/decorators");
|
|
7
|
+
Object.keys(_decorators).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _decorators[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _decorators[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
package/build/index.d.ts
CHANGED
|
@@ -1,12 +1,79 @@
|
|
|
1
|
-
import { expect, test
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { expect, test, accountLogin,
|
|
2
|
+
getListOfUsers,
|
|
3
|
+
getPrimaryUser,
|
|
4
|
+
getUserForSelectedEditionAndProfile,
|
|
5
|
+
isCI,
|
|
6
|
+
loadCookiesIfPresent,
|
|
7
|
+
performLoginSteps,
|
|
8
|
+
verifyIfCookieFileExists } from './core/playwright/index';
|
|
9
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
10
|
+
import {
|
|
11
|
+
PlaywrightTestArgs,
|
|
12
|
+
PlaywrightTestOptions,
|
|
13
|
+
PlaywrightWorkerArgs,
|
|
14
|
+
PlaywrightWorkerOptions,
|
|
15
|
+
TestType,
|
|
16
|
+
Page
|
|
17
|
+
} from '@playwright/test';
|
|
18
|
+
import { DefineStepPattern } from '@cucumber/cucumber/lib/support_code_library_builder/types';
|
|
19
|
+
|
|
20
|
+
export type KeyValue = { [key: string]: any };
|
|
21
|
+
|
|
22
|
+
export type BuiltInFixturesWorker = PlaywrightWorkerArgs &
|
|
23
|
+
PlaywrightWorkerOptions;
|
|
24
|
+
export type BuiltInFixtures = PlaywrightTestArgs &
|
|
25
|
+
PlaywrightTestOptions &
|
|
26
|
+
BuiltInFixturesWorker;
|
|
27
|
+
|
|
28
|
+
export type FixturesArg<T extends KeyValue = {}, W extends KeyValue = {}> = T &
|
|
29
|
+
W &
|
|
30
|
+
BuiltInFixtures;
|
|
31
|
+
|
|
32
|
+
export declare let hasCustomTest: boolean;
|
|
33
|
+
|
|
34
|
+
export declare function createBdd<
|
|
35
|
+
T extends KeyValue = BuiltInFixtures,
|
|
36
|
+
W extends KeyValue = BuiltInFixturesWorker,
|
|
37
|
+
World
|
|
38
|
+
>(
|
|
39
|
+
customTest?: TestType<T, W> | null,
|
|
40
|
+
_CustomWorld?: new (...args: any[]) => World
|
|
41
|
+
): {
|
|
42
|
+
Given: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
|
|
43
|
+
When: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
|
|
44
|
+
Then: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
|
|
45
|
+
And: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
|
|
46
|
+
But: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
|
|
47
|
+
Step: (pattern: DefineStepPattern, fn: StepFunction<T, W>) => void;
|
|
48
|
+
Before: any;
|
|
49
|
+
After: any;
|
|
50
|
+
BeforeAll: any;
|
|
51
|
+
AfterAll: any;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
type StepFunctionFixturesArg<
|
|
55
|
+
T extends KeyValue,
|
|
56
|
+
W extends KeyValue
|
|
57
|
+
> = FixturesArg<T, W>;
|
|
58
|
+
type StepFunction<T extends KeyValue, W extends KeyValue> = (
|
|
59
|
+
fixtures: StepFunctionFixturesArg<T, W>,
|
|
60
|
+
...args: any[]
|
|
61
|
+
) => unknown;
|
|
62
|
+
|
|
63
|
+
const { Given, Then, When, Step, And, But } = createBdd();
|
|
64
|
+
|
|
65
|
+
type UserConfig = import('./core/playwright/readConfigFile').UserConfig;
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
UserConfig,
|
|
69
|
+
Given, Then, When, Step, And, But, expect, test,
|
|
70
|
+
createBdd, Page, accountLogin,
|
|
71
|
+
getListOfUsers,
|
|
72
|
+
getPrimaryUser,
|
|
73
|
+
getUserForSelectedEditionAndProfile,
|
|
74
|
+
isCI,
|
|
75
|
+
loadCookiesIfPresent,
|
|
76
|
+
performLoginSteps,
|
|
77
|
+
verifyIfCookieFileExists };
|
|
78
|
+
|
|
79
|
+
export * from '@playwright/test/types/test';
|
package/build/index.js
CHANGED
|
@@ -4,16 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.When = exports.Then = exports.Step = exports.Given = exports.But = exports.And = void 0;
|
|
7
|
-
Object.defineProperty(exports, "
|
|
7
|
+
Object.defineProperty(exports, "accountLogin", {
|
|
8
8
|
enumerable: true,
|
|
9
9
|
get: function () {
|
|
10
|
-
return
|
|
10
|
+
return _index.accountLogin;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
Object.defineProperty(exports, "
|
|
13
|
+
Object.defineProperty(exports, "createBdd", {
|
|
14
14
|
enumerable: true,
|
|
15
15
|
get: function () {
|
|
16
|
-
return
|
|
16
|
+
return _index.createBdd;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "expect", {
|
|
@@ -22,24 +22,66 @@ Object.defineProperty(exports, "expect", {
|
|
|
22
22
|
return _index.expect;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
+
Object.defineProperty(exports, "getListOfUsers", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _index.getListOfUsers;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "getPrimaryUser", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () {
|
|
34
|
+
return _index.getPrimaryUser;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "getUserForSelectedEditionAndProfile", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () {
|
|
40
|
+
return _index.getUserForSelectedEditionAndProfile;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "isCI", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _index.isCI;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(exports, "loadCookiesIfPresent", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function () {
|
|
52
|
+
return _index.loadCookiesIfPresent;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, "performLoginSteps", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () {
|
|
58
|
+
return _index.performLoginSteps;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
25
61
|
Object.defineProperty(exports, "test", {
|
|
26
62
|
enumerable: true,
|
|
27
63
|
get: function () {
|
|
28
64
|
return _index.test;
|
|
29
65
|
}
|
|
30
66
|
});
|
|
67
|
+
Object.defineProperty(exports, "verifyIfCookieFileExists", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () {
|
|
70
|
+
return _index.verifyIfCookieFileExists;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
31
73
|
var _index = require("./core/playwright/index");
|
|
32
|
-
var _bddPoc = require("./bdd-poc");
|
|
33
74
|
// import { fireEvent, render } from '@testing-library/react';
|
|
75
|
+
|
|
34
76
|
const {
|
|
35
77
|
Given,
|
|
36
78
|
Then,
|
|
37
79
|
When,
|
|
38
|
-
|
|
39
|
-
} = (0,
|
|
40
|
-
exports.
|
|
80
|
+
Step
|
|
81
|
+
} = (0, _index.createBdd)();
|
|
82
|
+
exports.Step = Step;
|
|
41
83
|
exports.When = When;
|
|
42
84
|
exports.Then = Then;
|
|
43
85
|
exports.Given = Given;
|
|
44
|
-
const
|
|
86
|
+
const And = exports.And = Then;
|
|
45
87
|
const But = exports.But = Then;
|
package/build/lib/cli.js
CHANGED
|
@@ -9,12 +9,10 @@ var _setupProject = _interopRequireDefault(require("../setup-folder-structure/se
|
|
|
9
9
|
var _parser = require("../parser/parser");
|
|
10
10
|
var _clearCaches = _interopRequireDefault(require("../core/playwright/clear-caches"));
|
|
11
11
|
var _helper = _interopRequireDefault(require("../setup-folder-structure/helper"));
|
|
12
|
+
var _parseUserArgs = _interopRequireDefault(require("../core/playwright/helpers/parseUserArgs"));
|
|
12
13
|
// import createJestRunner from '../core/jest/runner/jest-runner';
|
|
13
14
|
|
|
14
15
|
const [,, option, ...otherOptions] = process.argv;
|
|
15
|
-
// const args = process.argv.slice(3);
|
|
16
|
-
// const appPath = process.cwd();
|
|
17
|
-
|
|
18
16
|
switch (option) {
|
|
19
17
|
case 'test':
|
|
20
18
|
{
|
|
@@ -23,6 +21,17 @@ switch (option) {
|
|
|
23
21
|
//createJestRunner();
|
|
24
22
|
break;
|
|
25
23
|
}
|
|
24
|
+
case 're-run-failed':
|
|
25
|
+
{
|
|
26
|
+
_logger.Logger.log(_logger.Logger.SUCCESS_TYPE, 'Running Failed Tests..');
|
|
27
|
+
let {
|
|
28
|
+
filePath
|
|
29
|
+
} = (0, _parseUserArgs.default)();
|
|
30
|
+
process.env.isRerunFailedCases = true;
|
|
31
|
+
process.env.filePath = filePath;
|
|
32
|
+
(0, _testRunner.default)();
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
26
35
|
case 'report':
|
|
27
36
|
{
|
|
28
37
|
// console.log('\x1b[36mGenerating Reports...\x1b[0m');
|
|
@@ -5,13 +5,21 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
5
5
|
var _child_process = require("child_process");
|
|
6
6
|
var _logger = require("../utils/logger");
|
|
7
7
|
var _rootPath = require("../utils/rootPath");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
// We are skipping the download of browsers when NODE_ENV is set to production or flag SKIP_BROWSER_DOWNLOAD is set to true
|
|
9
|
+
|
|
10
|
+
let isSkipDownloadingBrowsers = Boolean(process.env.SKIP_BROWSER_DOWNLOAD);
|
|
11
|
+
let isProductionMode = process.env.NODE_ENV === 'production';
|
|
12
|
+
if (isSkipDownloadingBrowsers || isProductionMode) {
|
|
13
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Skipping browsers download in production mode');
|
|
14
|
+
} else {
|
|
15
|
+
const playwrightPath = _path.default.resolve((0, _rootPath.getExecutableBinaryPath)('playwright'));
|
|
16
|
+
const command = playwrightPath;
|
|
17
|
+
const args = ['install'];
|
|
18
|
+
_logger.Logger.log(_logger.Logger.INFO_TYPE, `Downloading browsers for running tests`);
|
|
19
|
+
const childProcess = (0, _child_process.spawn)(command, args, {
|
|
20
|
+
stdio: 'inherit'
|
|
21
|
+
});
|
|
22
|
+
childProcess.on('error', error => {
|
|
23
|
+
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, error);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
Feature: Home Page
|
|
2
|
-
|
|
3
|
-
Scenario: Home Page Default content
|
|
4
|
-
Given user is on "<App>" home page
|
|
5
|
-
Then user gets a "<App>" bootcamp section
|
|
6
|
-
And username is also displayed on right corner
|
|
7
|
-
|
|
8
|
-
Examples:
|
|
9
|
-
| App |
|
|
10
|
-
| GitHub |
|
|
11
|
-
|
|
12
|
-
Scenario: GitHub Bootcamp Section
|
|
13
|
-
Given user is on "<Site>" home page
|
|
14
|
-
When user focuses on "<Site>" Bootcamp Section
|
|
15
|
-
Then user gets an option to setup git
|
|
16
|
-
And user gets an option to create repository
|
|
17
|
-
And user gets an option to Fork Repository
|
|
18
|
-
And user gets an option to work together
|
|
19
|
-
|
|
20
|
-
Examples:
|
|
21
|
-
| Site |
|
|
22
|
-
| GitHub |
|
|
23
|
-
|
|
24
|
-
Scenario: Top Banner content
|
|
25
|
-
Given user is on "<Product>" home page
|
|
26
|
-
When user focuses on Top Banner
|
|
27
|
-
Then user gets an option of home page
|
|
28
|
-
And user gets an option to search
|
|
29
|
-
And user gets settings options
|
|
30
|
-
And user gets an option to logout
|
|
31
|
-
|
|
32
|
-
Examples:
|
|
33
|
-
| Product |
|
|
34
|
-
| GitHub |
|
|
1
|
+
Feature: Home Page
|
|
2
|
+
|
|
3
|
+
Scenario: Home Page Default content
|
|
4
|
+
Given user is on "<App>" home page
|
|
5
|
+
Then user gets a "<App>" bootcamp section
|
|
6
|
+
And username is also displayed on right corner
|
|
7
|
+
|
|
8
|
+
Examples:
|
|
9
|
+
| App |
|
|
10
|
+
| GitHub |
|
|
11
|
+
|
|
12
|
+
Scenario: GitHub Bootcamp Section
|
|
13
|
+
Given user is on "<Site>" home page
|
|
14
|
+
When user focuses on "<Site>" Bootcamp Section
|
|
15
|
+
Then user gets an option to setup git
|
|
16
|
+
And user gets an option to create repository
|
|
17
|
+
And user gets an option to Fork Repository
|
|
18
|
+
And user gets an option to work together
|
|
19
|
+
|
|
20
|
+
Examples:
|
|
21
|
+
| Site |
|
|
22
|
+
| GitHub |
|
|
23
|
+
|
|
24
|
+
Scenario: Top Banner content
|
|
25
|
+
Given user is on "<Product>" home page
|
|
26
|
+
When user focuses on Top Banner
|
|
27
|
+
Then user gets an option of home page
|
|
28
|
+
And user gets an option to search
|
|
29
|
+
And user gets settings options
|
|
30
|
+
And user gets an option to logout
|
|
31
|
+
|
|
32
|
+
Examples:
|
|
33
|
+
| Product |
|
|
34
|
+
| GitHub |
|
|
@@ -2,34 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
var _testinglibrary = require("@zohodesk/testinglibrary");
|
|
4
4
|
_testinglibrary.test.describe('Home Page', () => {
|
|
5
|
-
/*
|
|
6
|
-
** Given user is on "<App>" home page
|
|
7
|
-
** Then user gets a "<App>" bootcamp section
|
|
8
|
-
** And username is also displayed on right corner
|
|
5
|
+
/*
|
|
6
|
+
** Given user is on "<App>" home page
|
|
7
|
+
** Then user gets a "<App>" bootcamp section
|
|
8
|
+
** And username is also displayed on right corner
|
|
9
9
|
*/
|
|
10
10
|
(0, _testinglibrary.test)('Home Page Default content', () => {
|
|
11
11
|
// Your implementation here
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
/*
|
|
15
|
-
** Given user is on "<Site>" home page
|
|
16
|
-
** When user focuses on "<Site>" Bootcamp Section
|
|
17
|
-
** Then user gets an option to setup git
|
|
18
|
-
** And user gets an option to create repository
|
|
19
|
-
** And user gets an option to Fork Repository
|
|
20
|
-
** And user gets an option to work together
|
|
14
|
+
/*
|
|
15
|
+
** Given user is on "<Site>" home page
|
|
16
|
+
** When user focuses on "<Site>" Bootcamp Section
|
|
17
|
+
** Then user gets an option to setup git
|
|
18
|
+
** And user gets an option to create repository
|
|
19
|
+
** And user gets an option to Fork Repository
|
|
20
|
+
** And user gets an option to work together
|
|
21
21
|
*/
|
|
22
22
|
(0, _testinglibrary.test)('GitHub Bootcamp Section', () => {
|
|
23
23
|
// Your implementation here
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
/*
|
|
27
|
-
** Given user is on "<Product>" home page
|
|
28
|
-
** When user focuses on Top Banner
|
|
29
|
-
** Then user gets an option of home page
|
|
30
|
-
** And user gets an option to search
|
|
31
|
-
** And user gets settings options
|
|
32
|
-
** And user gets an option to logout
|
|
26
|
+
/*
|
|
27
|
+
** Given user is on "<Product>" home page
|
|
28
|
+
** When user focuses on Top Banner
|
|
29
|
+
** Then user gets an option of home page
|
|
30
|
+
** And user gets an option to search
|
|
31
|
+
** And user gets settings options
|
|
32
|
+
** And user gets an option to logout
|
|
33
33
|
*/
|
|
34
34
|
(0, _testinglibrary.test)('Top Banner content', () => {
|
|
35
35
|
// Your implementation here
|
|
@@ -24,11 +24,14 @@ function helpercmd() {
|
|
|
24
24
|
_commander.program.command('test').description('This command is used to execute tests');
|
|
25
25
|
_commander.program.command('init').description('This command will initialize Project');
|
|
26
26
|
_commander.program.command('report').description('This command is used to generate a report summarizing the results of executed tests.');
|
|
27
|
+
_commander.program.command('re-run-failed').description('This command will re-run the failed test cases based on test summary');
|
|
27
28
|
_commander.program.command('codegen').description('This command is used to assist developer to write test case');
|
|
28
29
|
_commander.program.option('--headed', 'Run tests with a headed browser.');
|
|
29
30
|
_commander.program.option('--debug', 'This command is used to initiate a debugging session');
|
|
30
31
|
_commander.program.option('--tags', 'Run specific test case with mentioned tags (Usage: -- --tags="@live")');
|
|
31
32
|
_commander.program.option('--workers', 'Specify number of workers to run the test case parallely (Usage: -- --workers=2)');
|
|
33
|
+
_commander.program.option('--edition', 'Specify edition to run the test cases (Usage: -- --edition="standard". This will run the test cases with either no edition mentioned or edition standard)');
|
|
34
|
+
_commander.program.option('--browsers', 'Specify the browsers on which the test case should run (Usage: -- --browsers="chrome,firefox,safari")');
|
|
32
35
|
_commander.program.parse(process.argv);
|
|
33
36
|
}
|
|
34
37
|
var _default = exports.default = helpercmd;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
function sortEdition(event) {
|
|
3
|
-
var currentURL = window.location.href;
|
|
4
|
-
const endPointCount = window.location.href.indexOf('#');
|
|
5
|
-
if (!(endPointCount == -1)) {
|
|
6
|
-
window.history.pushState({}, '', currentURL.slice(0, endPointCount));
|
|
7
|
-
currentURL = currentURL.slice(0, endPointCount);
|
|
8
|
-
}
|
|
9
|
-
console.log(currentURL);
|
|
10
|
-
window.open(`${currentURL}#?q=@edition_${event.target.value}`, '_self');
|
|
11
|
-
}
|
|
12
|
-
</script>
|
|
13
|
-
<div class="mainContainer" style="margin-left: 20px; display: flex;">
|
|
14
|
-
<div class="selectEditionContainer" style="padding: 20px;">
|
|
15
|
-
<select class="selectEdition" style="padding: 5px; width: 100px; border-radius: 6px; border: 1px solid var(--color-border-default);" onchange="sortEdition(event)">
|
|
16
|
-
<option value="EnterPrise">EnterPrise</option>
|
|
17
|
-
<option value="Professional">Professional</option>
|
|
18
|
-
<option value="Express">Express</option>
|
|
19
|
-
<option value="Standard">Standard</option>
|
|
20
|
-
<option value="Free">Free</option>
|
|
21
|
-
</select>
|
|
22
|
-
</div>
|
|
23
|
-
</div>
|
|
24
|
-
|
|
1
|
+
<script>
|
|
2
|
+
function sortEdition(event) {
|
|
3
|
+
var currentURL = window.location.href;
|
|
4
|
+
const endPointCount = window.location.href.indexOf('#');
|
|
5
|
+
if (!(endPointCount == -1)) {
|
|
6
|
+
window.history.pushState({}, '', currentURL.slice(0, endPointCount));
|
|
7
|
+
currentURL = currentURL.slice(0, endPointCount);
|
|
8
|
+
}
|
|
9
|
+
console.log(currentURL);
|
|
10
|
+
window.open(`${currentURL}#?q=@edition_${event.target.value}`, '_self');
|
|
11
|
+
}
|
|
12
|
+
</script>
|
|
13
|
+
<div class="mainContainer" style="margin-left: 20px; display: flex;">
|
|
14
|
+
<div class="selectEditionContainer" style="padding: 20px;">
|
|
15
|
+
<select class="selectEdition" style="padding: 5px; width: 100px; border-radius: 6px; border: 1px solid var(--color-border-default);" onchange="sortEdition(event)">
|
|
16
|
+
<option value="EnterPrise">EnterPrise</option>
|
|
17
|
+
<option value="Professional">Professional</option>
|
|
18
|
+
<option value="Express">Express</option>
|
|
19
|
+
<option value="Standard">Standard</option>
|
|
20
|
+
<option value="Free">Free</option>
|
|
21
|
+
</select>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
25
|
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
import { test as setup, expect } from '@zohodesk/testinglibrary';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
5
|
-
|
|
6
|
-
const userdata = require('./authUsers.json');
|
|
7
|
-
|
|
8
|
-
const authDirectory = path.resolve(process.cwd(), 'uat', 'playwright', '.auth');
|
|
9
|
-
|
|
10
|
-
const authContent = { "cookies": [] };
|
|
11
|
-
|
|
12
|
-
const LOGIN_ERR_MESSAGE = 'Need go be logged in';
|
|
13
|
-
// const AUTH_ERR_MESSAGE = `Founded Path - ${path.resolve(process.cwd(),'uat','playwright','.auth')} \n Find if file is Properly Created. Cookies Cannot Be Read .. `
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function convertCookiesToParse(cookies, authFilePath) {
|
|
17
|
-
try {
|
|
18
|
-
return JSON.parse(cookies)
|
|
19
|
-
} catch (err) {
|
|
20
|
-
throw new Error(` Error while parsing cookies ${err} \n${path.resolve(process.cwd(), authFilePath)} File is Empty`)
|
|
21
|
-
// process.exit()
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (!existsSync(authDirectory)) {
|
|
26
|
-
console.log('Creating auth directory for the first time setup...');
|
|
27
|
-
mkdirSync(authDirectory, { recursive: true });
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
userdata.forEach((data) => {
|
|
31
|
-
const authFile = path.resolve(path.join(authDirectory, `${data.filename}`));
|
|
32
|
-
if (!existsSync(authFile)) {
|
|
33
|
-
console.log('creating auth file..');
|
|
34
|
-
writeFileSync(authFile, JSON.stringify(authContent, null, 2))
|
|
35
|
-
}
|
|
36
|
-
setup(data.description, async ({ page }) => {
|
|
37
|
-
|
|
38
|
-
try {
|
|
39
|
-
const cookies = readFileSync(authFile);
|
|
40
|
-
const parsedCookies = convertCookiesToParse(cookies, authFile);
|
|
41
|
-
await page.context().addCookies(parsedCookies.cookies === undefined ? [] : parsedCookies.cookies)
|
|
42
|
-
await page.goto(page.getBaseUrl());
|
|
43
|
-
await page.waitForLoadState();
|
|
44
|
-
if (await page.url().includes(process.env.domain)) {
|
|
45
|
-
await page.waitForSelector(data.locator);
|
|
46
|
-
} else {
|
|
47
|
-
throw new Error(LOGIN_ERR_MESSAGE);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
} catch (err) {
|
|
52
|
-
if (err.message === LOGIN_ERR_MESSAGE) {
|
|
53
|
-
|
|
54
|
-
await expect(page.locator('.load-bg')).toBeHidden();
|
|
55
|
-
await page.locator('#login_id').type(data.useremail);
|
|
56
|
-
await page.locator('#nextbtn').click();
|
|
57
|
-
await page.locator('#password').type(data.password);
|
|
58
|
-
await page.locator('#nextbtn').click();
|
|
59
|
-
|
|
60
|
-
await page.waitForLoadState("networkidle");
|
|
61
|
-
|
|
62
|
-
await page.waitForSelector(data.locator)
|
|
63
|
-
|
|
64
|
-
await page.context().storageState({ path: authFile });
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
})
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import { test as setup, expect } from '@zohodesk/testinglibrary';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
5
|
+
|
|
6
|
+
const userdata = require('./authUsers.json');
|
|
7
|
+
|
|
8
|
+
const authDirectory = path.resolve(process.cwd(), 'uat', 'playwright', '.auth');
|
|
9
|
+
|
|
10
|
+
const authContent = { "cookies": [] };
|
|
11
|
+
|
|
12
|
+
const LOGIN_ERR_MESSAGE = 'Need go be logged in';
|
|
13
|
+
// const AUTH_ERR_MESSAGE = `Founded Path - ${path.resolve(process.cwd(),'uat','playwright','.auth')} \n Find if file is Properly Created. Cookies Cannot Be Read .. `
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
function convertCookiesToParse(cookies, authFilePath) {
|
|
17
|
+
try {
|
|
18
|
+
return JSON.parse(cookies)
|
|
19
|
+
} catch (err) {
|
|
20
|
+
throw new Error(` Error while parsing cookies ${err} \n${path.resolve(process.cwd(), authFilePath)} File is Empty`)
|
|
21
|
+
// process.exit()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (!existsSync(authDirectory)) {
|
|
26
|
+
console.log('Creating auth directory for the first time setup...');
|
|
27
|
+
mkdirSync(authDirectory, { recursive: true });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
userdata.forEach((data) => {
|
|
31
|
+
const authFile = path.resolve(path.join(authDirectory, `${data.filename}`));
|
|
32
|
+
if (!existsSync(authFile)) {
|
|
33
|
+
console.log('creating auth file..');
|
|
34
|
+
writeFileSync(authFile, JSON.stringify(authContent, null, 2))
|
|
35
|
+
}
|
|
36
|
+
setup(data.description, async ({ page }) => {
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
const cookies = readFileSync(authFile);
|
|
40
|
+
const parsedCookies = convertCookiesToParse(cookies, authFile);
|
|
41
|
+
await page.context().addCookies(parsedCookies.cookies === undefined ? [] : parsedCookies.cookies)
|
|
42
|
+
await page.goto(page.getBaseUrl());
|
|
43
|
+
await page.waitForLoadState();
|
|
44
|
+
if (await page.url().includes(process.env.domain)) {
|
|
45
|
+
await page.waitForSelector(data.locator);
|
|
46
|
+
} else {
|
|
47
|
+
throw new Error(LOGIN_ERR_MESSAGE);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
} catch (err) {
|
|
52
|
+
if (err.message === LOGIN_ERR_MESSAGE) {
|
|
53
|
+
|
|
54
|
+
await expect(page.locator('.load-bg')).toBeHidden();
|
|
55
|
+
await page.locator('#login_id').type(data.useremail);
|
|
56
|
+
await page.locator('#nextbtn').click();
|
|
57
|
+
await page.locator('#password').type(data.password);
|
|
58
|
+
await page.locator('#nextbtn').click();
|
|
59
|
+
|
|
60
|
+
await page.waitForLoadState("networkidle");
|
|
61
|
+
|
|
62
|
+
await page.waitForSelector(data.locator)
|
|
63
|
+
|
|
64
|
+
await page.context().storageState({ path: authFile });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
})
|