@uuv/playwright 1.3.2 → 1.4.0

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/README.md CHANGED
@@ -1,5 +1,4 @@
1
1
 
2
-
3
2
  # @uuv/runner-playwright
4
3
  <p align="center">
5
4
  <a href="https://e2e-test-quest.github.io/uuv/">
@@ -8,9 +7,6 @@
8
7
  </picture>
9
8
  </a>
10
9
  </p>
11
- <p align="center">
12
- <a href="https://e2e-test-quest.github.io/uuv/"><img src="https://img.shields.io/badge/documentation-black?&style=for-the-badge&logo=github&logoColor=white" alt="documentation"/></a>
13
- </p>
14
10
 
15
11
  <h3 align="center">
16
12
  Test as final user
@@ -35,7 +31,41 @@ Make test writing fast, understandable by any human understanding English or Fre
35
31
  </a><br />
36
32
  </p>
37
33
 
38
- ## What is @uuv/playwright ?
34
+ ## Benefits
35
+ - If used correctly, integrates accessibility from the development stage
36
+ - A living documentation is possible because we propose an unified language for developers and non-developers with a rich dictionary of ready-to-use sentences
37
+ - A wizard that facilitates the writing of tests by suggesting the most accessible sentences
38
+ - Integrates several runtime engines: Cypress / Playwright
39
+ - User-friendly and standardized execution report
40
+ ### <u>Comparison</u>
41
+ | Criteria | Cypress | Playwright | Testing library | UUV |
42
+ |:-: |:-: |:-: |:-: |:-: |
43
+ | User centrism | :x: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
44
+ | Native accessibility | :x: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
45
+ | Easy setup configuration for BDD test | :warning: | :warning: | :heavy_minus_sign: | :heavy_check_mark: |
46
+ | Understandable by everyone <br> (included non dev) | :x: | :x: | :x: | :heavy_check_mark: |
47
+
48
+ ### <u>Syntax example</u>
49
+ With this dom example :
50
+ ```html
51
+ <body>
52
+ <h1>Result<h1>
53
+ </body>
54
+ ```
55
+ we see that the sentence proposed by **UUV is the most understandable** of all
56
+ | Library | Syntax |
57
+ |:--|:--|
58
+ | Cypress | cy.get('result').should('exist') |
59
+ | Playwright| await expect(page.getByTitle('Result')).toHaveCount(1) |
60
+ | Testing library | expect(screen.getByTitle(/Result/i)).toBeTruthy() |
61
+ | UUV | Then I should see a title named "Result"|
62
+
63
+
64
+ ## Documentation
65
+ <a href="https://e2e-test-quest.github.io/uuv/"><img src="https://img.shields.io/badge/documentation-black?&style=for-the-badge&logo=github&logoColor=white" alt="documentation"/></a>
66
+
67
+ ## What is @uuv/playwright?
68
+
39
69
 
40
70
  <p align="center">
41
71
 
@@ -43,20 +73,76 @@ The `@uuv` library (User centric Usecases Validator) is an ecosystem that simpli
43
73
  We can use the playwright engine to run test or cypress with [@uuv/cypress](https://www.npmjs.com/package/@uuv/cypress)
44
74
  </p>
45
75
 
46
- ## Installing
47
76
 
48
- <a href="https://e2e-test-quest.github.io/uuv/docs/getting-started/installation#playwright"><img src="https://img.shields.io/badge/Install%20Playwright%20doc-red?&style=for-the-badge&logo=github&logoColor=white" alt="documentation for install uuv playwright"/></a>
77
+ ## Installation
78
+
49
79
 
80
+ ```bash
81
+ npm install --save-dev @uuv/playwright
82
+ ```
83
+ or
84
+ ```bash
85
+ yarn add -D @uuv/playwright
86
+ ```
87
+ ## Configuration (optional)
50
88
  <a href="https://e2e-test-quest.github.io/uuv/docs/getting-started/configuration"><img src="https://img.shields.io/badge/Configure%20Playwright%20doc-red?&style=for-the-badge&logo=github&logoColor=white" alt="documentation for configure uuv playwright"/></a>
51
89
 
90
+ ## Usage
91
+ ### Write test
92
+ To write your first test, create the file `uuv/e2e/first-test.feature` in the project root with the following content :
93
+ ```gherkin
94
+ Feature: Hello World
95
+
96
+ Scenario: Search - Successful case
97
+ When I visit path "/"
98
+ Then I should see an element with role "heading" and name "My app title"
99
+ ```
100
+
101
+ For more details, please go to the documentation:
52
102
  <a href="https://e2e-test-quest.github.io/uuv/docs/test/first-test"><img src="https://img.shields.io/badge/Write%20test%20doc-red?&style=for-the-badge&logo=github&logoColor=white" alt="documentation for write test"/></a>
53
103
 
104
+ ### Run test
105
+
106
+ #### browser mode
107
+ ```bash
108
+ npx uuv open
109
+ ```
110
+ or
111
+ ```bash
112
+ yarn uuv open
113
+ ```
114
+
115
+ #### headless mode
116
+ ##### without args
117
+ ```bash
118
+ npx uuv e2e
119
+ ```
120
+ or
121
+ ```bash
122
+ yarn uuv e2e
123
+ ```
124
+ ##### with args
125
+ ```bash
126
+ npx uuv e2e --browser=edge --env="{'TAGS':'@mobile'}" --generateHtmlReport
127
+ ```
128
+ or
129
+ ```bash
130
+ yarn uuv e2e --browser=edge --env="{'TAGS':'@mobile'}" --generateHtmlReport
131
+ ```
132
+
133
+ For more details, please go to the documentation:
54
134
  <a href="https://e2e-test-quest.github.io/uuv/docs/test/running-test"><img src="https://img.shields.io/badge/Run%20test%20doc-red?&style=for-the-badge&logo=github&logoColor=white" alt="documentation for run test"/></a>
55
135
 
56
136
  ## License
57
137
 
58
- [<a href="https://www.npmjs.com/package/@uuv/playwright">
59
- <img src="https://img.shields.io/badge/license-Apache%202.0-blue" alt="npm"/>
138
+ [<a href="https://github.com/e2e-test-quest/uuv/blob/main/LICENSE">
139
+ <img src="https://img.shields.io/badge/license-Apache%202.0-blue" alt="apache license"/>
60
140
  </a>](https://www.apache.org/licenses/LICENSE-2.0)
61
141
 
62
- This project is licensed under the terms of the [Apache 2.0 license](https://www.apache.org/licenses/LICENSE-2.0).
142
+ This project is licensed under the terms of the [Apache 2.0 license](https://github.com/e2e-test-quest/uuv/blob/main/LICENSE).
143
+
144
+ ## Authors
145
+
146
+ - [@luifr10](https://github.com/luifr10)
147
+ - [@stanlee974](https://github.com/stanlee974)
148
+
package/bin/uuv CHANGED
File without changes
@@ -40,7 +40,6 @@ async function bddGen(tempDir) {
40
40
  }
41
41
  });
42
42
  fs_1.default.writeFileSync(`${tempDir}/${exports.UUVPlaywrightCucumberMapFile}`, JSON.stringify(content, null, 4), { encoding: "utf8" });
43
- console.log("bddgen executed");
44
43
  }
45
44
  catch (err) {
46
45
  console.error(chalk_1.default.red("Something went wrong..."));
@@ -87,7 +86,7 @@ function translateFeatures(tempDir, configDir) {
87
86
  "*******************************/\n\n" +
88
87
  data;
89
88
  fs_1.default.writeFileSync(generatedFile, data);
90
- console.log(`[WRITE] ${generatedFile} written successfully`);
89
+ console.log(chalk_1.default.gray(`[WRITE] ${generatedFile} written successfully`));
91
90
  });
92
91
  }
93
92
  function runPlaywright(mode, configDir, generateHtmlReport = false) {
@@ -100,16 +99,22 @@ function runPlaywright(mode, configDir, generateHtmlReport = false) {
100
99
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
101
100
  // @ts-ignore
102
101
  process.env.CONFIG_DIR = configDir;
103
- console.log(`Running: npx playwright test --project=chromium -c ${configFile} ${mode === "open" ? "--ui" : ""}`);
104
- (0, child_process_1.execSync)(`npx playwright test --project=chromium -c ${configFile} ${mode === "open" ? "--ui" : ""}`, { stdio: "inherit" });
102
+ const command = `npx playwright test --project=chromium -c ${configFile} ${mode === "open" ? "--ui" : ""}`;
103
+ console.log(chalk_1.default.gray(`Running ${command}`));
104
+ (0, child_process_1.execSync)(command, { stdio: "inherit" });
105
105
  }
106
106
  catch (err) {
107
107
  process.exit(-1);
108
108
  }
109
109
  }
110
- async function run(mode, tempDir = "uuv/.features-gen/e2e", configDir = "uuv", generateHtmlReport = false) {
110
+ async function executePreprocessor(tempDir, configDir) {
111
+ console.log("running preprocessor...");
111
112
  await bddGen(tempDir);
112
113
  translateFeatures(tempDir, configDir);
114
+ console.log("preprocessor executed");
115
+ }
116
+ async function run(mode, tempDir = "uuv/.features-gen/e2e", configDir = "uuv", generateHtmlReport = false) {
117
+ await executePreprocessor(tempDir, configDir);
113
118
  runPlaywright(mode, configDir, generateHtmlReport);
114
119
  }
115
120
  exports.run = run;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { FullConfig, FullResult, Suite, TestCase, TestResult } from "@playwright/test/reporter";
3
2
  import { Envelope } from "@cucumber/messages";
4
3
  import { TestStep } from "@playwright/test/types/testReporter";
@@ -6,10 +5,6 @@ export declare enum GeneratedReportType {
6
5
  CONSOLE = "console",
7
6
  HTML = "html"
8
7
  }
9
- interface TestError {
10
- scenario: string;
11
- error: string | Buffer;
12
- }
13
8
  declare class UuvPlaywrightReporterHelper {
14
9
  private UUVPlaywrightCucumberMap;
15
10
  testDir: string;
@@ -21,6 +16,7 @@ declare class UuvPlaywrightReporterHelper {
21
16
  private testStepLocationAndTestStepIdMap;
22
17
  private consoleReportMap;
23
18
  private errors;
19
+ private currentFeatureFile;
24
20
  createTestRunStartedEnvelope(config: FullConfig, suite: Suite, startTimestamp: {
25
21
  seconds: number;
26
22
  nanos: number;
@@ -40,6 +36,8 @@ declare class UuvPlaywrightReporterHelper {
40
36
  }): void;
41
37
  private getTestStepKey;
42
38
  createTestCaseFinishedEnvelope(test: TestCase, result: TestResult, featureFile: string, endTimestamp: any): void;
39
+ private addResultErrors;
40
+ private createTestCaseErrorAttachmentsEnvelope;
43
41
  private initConsoleReportIfNotExists;
44
42
  private updateConsoleReport;
45
43
  createTestRunFinishedEnvelope(result: FullResult): void;
@@ -50,7 +48,7 @@ declare class UuvPlaywrightReporterHelper {
50
48
  };
51
49
  getOriginalFeatureFile(generateFile: string): string | undefined;
52
50
  getCurrentRunningScenario(test: TestCase, featureFile: string): string;
53
- addError(newError: TestError): void;
51
+ private addError;
54
52
  private getStatus;
55
53
  private createEnvelope;
56
54
  private createCucumberNdJsonFile;
@@ -65,5 +63,9 @@ declare class UuvPlaywrightReporterHelper {
65
63
  private generateHtmlReport;
66
64
  private createdDirIfNeeded;
67
65
  private displayConsoleReport;
66
+ logTestBegin(testCase: TestCase, featureFile: string): void;
67
+ logTestEnd(testCase: TestCase, result: TestResult): void;
68
+ private getResultIcon;
69
+ private getTestCaseTitle;
68
70
  }
69
71
  export default UuvPlaywrightReporterHelper;
@@ -11,7 +11,7 @@ const fs_1 = __importDefault(require("fs"));
11
11
  const runner_playwright_1 = require("../lib/runner-playwright");
12
12
  const multiple_cucumber_html_reporter_1 = __importDefault(require("multiple-cucumber-html-reporter"));
13
13
  const cucumber_json_report_formatter_1 = require("cucumber-json-report-formatter");
14
- const uuid_1 = require("uuid");
14
+ const nanoid_1 = require("nanoid");
15
15
  const chalk_1 = __importDefault(require("chalk"));
16
16
  const chalk_table_1 = __importDefault(require("chalk-table"));
17
17
  const NANOS_IN_SECOND = 1000000000;
@@ -48,6 +48,7 @@ class UuvPlaywrightReporterHelper {
48
48
  testStepLocationAndTestStepIdMap = new Map();
49
49
  consoleReportMap = new Map();
50
50
  errors = [];
51
+ currentFeatureFile;
51
52
  createTestRunStartedEnvelope(config, suite, startTimestamp) {
52
53
  this.testDir = config.projects[0].testDir;
53
54
  this.loadUUVPlaywrightCucumberMap();
@@ -71,7 +72,7 @@ class UuvPlaywrightReporterHelper {
71
72
  });
72
73
  let newCurrentQuery = currentQuery.update(newTestCaseEnvelope);
73
74
  this.envelopes.push(newTestCaseEnvelope);
74
- const testCaseStartedId = (0, uuid_1.v4)();
75
+ const testCaseStartedId = (0, nanoid_1.nanoid)();
75
76
  const newTestCaseStartedEnvelope = this.createEnvelope({
76
77
  testCaseStarted: {
77
78
  id: testCaseStartedId,
@@ -121,7 +122,7 @@ class UuvPlaywrightReporterHelper {
121
122
  .find(pickle => pickle.id === pickleId)
122
123
  ?.steps
123
124
  .filter((value, index) => index >= (newIndexStep - 1))
124
- .forEach((pickleStep, index) => {
125
+ .forEach((pickleStep) => {
125
126
  const newTestStepStartedEnvelope = this.createEnvelope({
126
127
  testStepStarted: {
127
128
  testStepId: pickleStep.id,
@@ -164,7 +165,9 @@ class UuvPlaywrightReporterHelper {
164
165
  duration: {
165
166
  seconds: result.duration / 1000,
166
167
  nanos: result.duration * NANOS_IN_MILLISSECOND
167
- }
168
+ },
169
+ // eslint-disable-next-line no-control-regex
170
+ message: step.error?.message?.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, "")
168
171
  },
169
172
  timestamp: startTimestamp
170
173
  }
@@ -182,9 +185,10 @@ class UuvPlaywrightReporterHelper {
182
185
  if (result.status === "skipped" || result.status === "failed") {
183
186
  this.createTestStepSkippedEnvelope(test, featureFile, endTimestamp);
184
187
  }
188
+ const testCaseStartedId = this.testCasesAndTestCasesStartedIdMap.get(test.id);
185
189
  const newTestCaseFinishedEnvelope = this.createEnvelope({
186
190
  testCaseFinished: {
187
- testCaseStartedId: this.testCasesAndTestCasesStartedIdMap.get(test.id),
191
+ testCaseStartedId: testCaseStartedId,
188
192
  attempt: result.retry,
189
193
  timestamp: endTimestamp
190
194
  }
@@ -192,8 +196,39 @@ class UuvPlaywrightReporterHelper {
192
196
  currentQuery.update(newTestCaseFinishedEnvelope);
193
197
  this.envelopes.push(newTestCaseFinishedEnvelope);
194
198
  this.updateConsoleReport(featureFile, result);
199
+ this.addResultErrors(result, test, featureFile);
200
+ this.createTestCaseErrorAttachmentsEnvelope(testCaseStartedId, result);
195
201
  }
196
202
  }
203
+ addResultErrors(result, test, featureFile) {
204
+ result.errors.forEach(error => {
205
+ const scenario = this.getCurrentRunningScenario(test, featureFile);
206
+ this.addError({
207
+ scenario: scenario,
208
+ error: error.message
209
+ });
210
+ });
211
+ }
212
+ createTestCaseErrorAttachmentsEnvelope(testCaseStartedId, result) {
213
+ result.attachments.forEach(attachment => {
214
+ if (attachment.path && attachment.path.endsWith("test-failed-1.png")) {
215
+ const attachmentBody = fs_1.default.readFileSync(attachment.path, { encoding: "base64" });
216
+ const failedStep = result.steps.find(step => step.error);
217
+ if (failedStep?.location) {
218
+ const testCaseAttachmentEnvelope = this.createEnvelope({
219
+ attachment: {
220
+ testCaseStartedId: testCaseStartedId,
221
+ testStepId: this.testStepLocationAndTestStepIdMap.get(this.getTestStepKey(failedStep.location)),
222
+ body: attachmentBody,
223
+ contentEncoding: messages_1.AttachmentContentEncoding.BASE64,
224
+ mediaType: attachment.contentType
225
+ }
226
+ });
227
+ this.envelopes.push(testCaseAttachmentEnvelope);
228
+ }
229
+ }
230
+ });
231
+ }
197
232
  initConsoleReportIfNotExists(featureFile) {
198
233
  if (!this.consoleReportMap.get(featureFile)) {
199
234
  this.consoleReportMap.set(featureFile, new ReportOfFeature());
@@ -307,7 +342,7 @@ class UuvPlaywrightReporterHelper {
307
342
  });
308
343
  }
309
344
  createStepDefinitionEnvelope() {
310
- const stepDefinitionId = (0, uuid_1.v4)();
345
+ const stepDefinitionId = (0, nanoid_1.nanoid)();
311
346
  this.envelopes.push(this.createEnvelope({
312
347
  stepDefinition: {
313
348
  id: stepDefinitionId,
@@ -341,7 +376,7 @@ class UuvPlaywrightReporterHelper {
341
376
  async generateHtmlReport() {
342
377
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
343
378
  // @ts-ignore
344
- const reportDir = `${process.env.CONFIG_DIR}/reports`;
379
+ const reportDir = `${process.env.CONFIG_DIR}/reports/e2e`;
345
380
  const outputMessageFile = `${reportDir}/cucumber-messages.ndjson`;
346
381
  const reportDirHtml = `${reportDir}/html`;
347
382
  const reportDirJson = `${reportDir}/json`;
@@ -368,7 +403,7 @@ class UuvPlaywrightReporterHelper {
368
403
  { field: "file", name: "File" },
369
404
  { field: "passed", name: chalk_1.default.green("Passed") },
370
405
  { field: "skipped", name: chalk_1.default.yellow("Skipped") },
371
- { field: "failed", name: chalk_1.default.red("Failed") }
406
+ { field: "failed", name: chalk_1.default.redBright("Failed") }
372
407
  ]
373
408
  };
374
409
  let index = 1;
@@ -378,7 +413,7 @@ class UuvPlaywrightReporterHelper {
378
413
  file: key,
379
414
  passed: chalk_1.default.green(value.passed),
380
415
  skipped: chalk_1.default.yellow(value.skipped),
381
- failed: chalk_1.default.red(value.failed)
416
+ failed: value.failed ? chalk_1.default.redBright(value.failed) : chalk_1.default.red(value.failed)
382
417
  });
383
418
  index++;
384
419
  });
@@ -396,5 +431,21 @@ class UuvPlaywrightReporterHelper {
396
431
  console.log((0, chalk_table_1.default)(chalkTableOptions, consoleReport));
397
432
  console.log("\n\n");
398
433
  }
434
+ logTestBegin(testCase, featureFile) {
435
+ if (this.currentFeatureFile !== featureFile) {
436
+ console.info(chalk_1.default.blueBright(` Feature: ${featureFile}`));
437
+ this.currentFeatureFile = featureFile;
438
+ }
439
+ }
440
+ logTestEnd(testCase, result) {
441
+ console.info(` ${this.getResultIcon(testCase)} ${this.getTestCaseTitle(testCase, result)}`);
442
+ }
443
+ getResultIcon(testCase) {
444
+ return !testCase.ok() ? chalk_1.default.redBright("\u166D") : chalk_1.default.green("\u2713");
445
+ }
446
+ getTestCaseTitle(testCase, result) {
447
+ const message = `${testCase.title} (${result.duration}ms)`;
448
+ return !testCase.ok() ? chalk_1.default.redBright(message) : chalk_1.default.gray(message);
449
+ }
399
450
  }
400
451
  exports.default = UuvPlaywrightReporterHelper;
@@ -1,12 +1,9 @@
1
- /// <reference types="node" />
2
1
  import { FullConfig, FullResult, Reporter, Suite, TestCase, TestResult } from "@playwright/test/reporter";
3
2
  import { TestError, TestStep } from "@playwright/test/types/testReporter";
4
3
  declare class UuvPlawrightReporter implements Reporter {
5
4
  private helper;
6
- private reporterStaticConsoleLogger;
7
5
  onBegin(config: FullConfig, suite: Suite): void;
8
6
  onError?(error: TestError): void;
9
- onStdErr?(chunk: string | Buffer, test: void | TestCase, result: void | TestResult): void;
10
7
  onTestBegin(test: TestCase, result: TestResult): void;
11
8
  onStepBegin(test: TestCase, result: TestResult, step: TestStep): void;
12
9
  onStepEnd(test: TestCase, result: TestResult, step: TestStep): void;
@@ -5,40 +5,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const uuv_playwright_reporter_helper_1 = __importDefault(require("./uuv-playwright-reporter-helper"));
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
- const draftlog_1 = __importDefault(require("draftlog"));
9
8
  class UuvPlawrightReporter {
10
9
  helper = new uuv_playwright_reporter_helper_1.default();
11
- reporterStaticConsoleLogger;
12
10
  onBegin(config, suite) {
13
11
  const startTimestamp = this.helper.getTimestamp();
14
12
  // console.log(`Starting the run with ${suite.allTests().length} tests`);
15
13
  this.helper.createTestRunStartedEnvelope(config, suite, startTimestamp);
16
- (0, draftlog_1.default)(console).addLineListener(process.stdin);
17
- console.log(chalk_1.default.yellow(`Starting the run with ${suite.allTests().length} tests`));
18
- this.reporterStaticConsoleLogger = console.draft(chalk_1.default.yellow("!!! Fasten seat belt !!!"));
14
+ console.info(chalk_1.default.yellow(`Starting the run with ${suite.allTests().length} tests`));
19
15
  }
20
16
  onError(error) {
21
17
  console.dir(chalk_1.default.red(error));
22
18
  }
23
- onStdErr(chunk, test, result) {
24
- let scenario = "unknown";
25
- if (test?.id !== undefined) {
26
- const featureFile = this.helper.getOriginalFeatureFile(test.location.file);
27
- if (featureFile) {
28
- scenario = this.helper.getCurrentRunningScenario(test, featureFile);
29
- }
30
- }
31
- this.helper.addError({
32
- scenario: scenario,
33
- error: chunk
34
- });
35
- }
36
19
  onTestBegin(test, result) {
37
20
  const startTimestamp = this.helper.getTimestamp(result.startTime);
38
21
  // console.log(`Starting test ${test.title} - ${test.parent.location?.file}`);
39
22
  const featureFile = this.helper.getOriginalFeatureFile(test.location.file);
40
23
  if (featureFile) {
41
- this.reporterStaticConsoleLogger(chalk_1.default.blueBright(`Running > ${this.helper.getCurrentRunningScenario(test, featureFile)}`));
24
+ this.helper.logTestBegin(test, featureFile);
42
25
  this.helper.createTestCaseStartedEnvelope(test, result, featureFile, startTimestamp);
43
26
  }
44
27
  }
@@ -64,12 +47,13 @@ class UuvPlawrightReporter {
64
47
  const featureFile = this.helper.getOriginalFeatureFile(test.location.file);
65
48
  if (featureFile) {
66
49
  this.helper.createTestCaseFinishedEnvelope(test, result, featureFile, endTimestamp);
50
+ this.helper.logTestEnd(test, result);
67
51
  }
68
52
  }
69
53
  async onEnd(result) {
70
54
  // console.debug(`Finished the run: ${result.status}`);
71
55
  this.helper.createTestRunFinishedEnvelope(result);
72
- console.log(chalk_1.default.yellow("End of the tests execution"));
56
+ console.log(chalk_1.default.yellow("End of the tests execution\n"));
73
57
  await this.helper.generateReport(
74
58
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
75
59
  // @ts-ignore
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uuv/playwright",
3
- "version": "1.3.2",
3
+ "version": "1.4.0",
4
4
  "type": "commonjs",
5
5
  "author": "Louis Fredice NJAKO MOLOM (https://github.com/luifr10) & Stanley SERVICAL (https://github.com/stanlee974)",
6
6
  "description": "A solution to run E2E tests written in cucumber(BDD) with playwright.",
@@ -36,22 +36,21 @@
36
36
  "test:open": "ts-node test.ts open",
37
37
  "test:alone:run": "npx playwright test",
38
38
  "test:format": "ts-node format-cucumber-report.ts",
39
- "test": "npm run test:run",
40
- "lint": "eslint -c .eslintrc.json"
39
+ "test": "npm run test:run"
41
40
  },
42
41
  "dependencies": {
43
42
  "@cucumber/cucumber": "9.1.2",
44
43
  "@playwright/test": "1.33.0",
45
- "@uuv/runner-commons": "1.3.2",
44
+ "@uuv/runner-commons": "1.4.0",
46
45
  "axe-core": "4.7.0",
47
46
  "axe-playwright": "1.2.3",
48
47
  "chalk": "4.1.2",
49
48
  "chalk-table": "^1.0.2",
50
49
  "cucumber-json-report-formatter": "0.1.4",
51
- "draftlog": "1.0.13",
52
50
  "figlet": "1.6.0",
53
51
  "minimist": "1.2.8",
54
52
  "multiple-cucumber-html-reporter": "3.3.0",
53
+ "nanoid": "3.1.22",
55
54
  "ts-node": "10.9.1",
56
55
  "typescript": "4.9.5"
57
56
  },
@@ -6,11 +6,13 @@ export default defineConfig({
6
6
  fullyParallel: true,
7
7
  forbidOnly: !!process.env.CI,
8
8
  retries: process.env.CI ? 2 : 0,
9
- workers: process.env.CI ? 1 : undefined,
9
+ outputDir: "reports/playwright",
10
+ workers: 1,
10
11
  reporter: "@uuv/playwright/uuv-playwright-reporter",
11
12
  use: {
12
13
  baseURL: "http://localhost:4200",
13
14
  trace: "on-first-retry",
15
+ screenshot: "only-on-failure"
14
16
  },
15
17
 
16
18
  projects: [
package/CHANGELOG.md DELETED
@@ -1,34 +0,0 @@
1
- ## [1.3.2](https://github.com/e2e-test-quest/uuv/compare/runner-playwright-v1.3.1...runner-playwright-v1.3.2) (2023-05-11)
2
-
3
-
4
- ### Bug Fixes
5
-
6
- * **runner-playwright:** add lint script [#8](https://github.com/e2e-test-quest/uuv/issues/8) ([0cd7451](https://github.com/e2e-test-quest/uuv/commit/0cd7451a2bb73698e05aefc6c89be01c2ea41c96))
7
- * **runner-playwright:** update @cucumber/cucumber dep version, [#93](https://github.com/e2e-test-quest/uuv/issues/93) ([a891a70](https://github.com/e2e-test-quest/uuv/commit/a891a70daad1cb5d7d34f25097a31d89f92b92c6))
8
-
9
- ## [1.3.1](https://github.com/e2e-test-quest/uuv/compare/runner-playwright-v1.3.0...runner-playwright-v1.3.1) (2023-05-09)
10
-
11
-
12
- ### Bug Fixes
13
-
14
- * **runner-commons:** fix npm documentation, [#87](https://github.com/e2e-test-quest/uuv/issues/87) ([ba7394c](https://github.com/e2e-test-quest/uuv/commit/ba7394cd755e350fd5a5964aed26435e5979e77d))
15
- * **runner-commons:** modify keyword for npmjs, [#87](https://github.com/e2e-test-quest/uuv/issues/87) ([392c4d0](https://github.com/e2e-test-quest/uuv/commit/392c4d0337179dae2c2a96c26dc2cc32e0ad87b3))
16
- * **runner-playwright:** add `npx playwright install` into postinstall, [#87](https://github.com/e2e-test-quest/uuv/issues/87) ([035f6aa](https://github.com/e2e-test-quest/uuv/commit/035f6aabb7d654eb45b789e73d63f118b628f9af))
17
- * **runner-playwright:** fix npm documentation, [#87](https://github.com/e2e-test-quest/uuv/issues/87) ([716de44](https://github.com/e2e-test-quest/uuv/commit/716de44456c50dcc4f52c3ed49f8fe48bf2f15b0))
18
- * **runner-playwright:** modify doc for npmjs, [#87](https://github.com/e2e-test-quest/uuv/issues/87) ([593e4ef](https://github.com/e2e-test-quest/uuv/commit/593e4ef3d14df27b3770f17bac9ba9ba7f326f4a))
19
-
20
- # Change Log
21
- All notable changes to this project will be documented in this file.
22
-
23
- The format is based on [Keep a Changelog](http://keepachangelog.com/)
24
- and this project adheres to [Semantic Versioning](http://semver.org/).
25
-
26
- ## [1.2.0-beta-20230424] - 2023-04-24
27
-
28
- ### Added
29
- - [#4](https://github.com/e2e-test-quest/uuv/issues/4)
30
- MINOR Amélioration du scoring npm
31
- - [#3](https://github.com/e2e-test-quest/uuv/issues/3)
32
- MAJOR Initialisation du pipeline
33
- - [#1](https://github.com/e2e-test-quest/uuv/issues/1)
34
- MAJOR Rajout de la licence Apache 2.0
package/CONTRIBUTING.md DELETED
@@ -1,81 +0,0 @@
1
- # Contributors guide
2
-
3
- **Want to contribute?**
4
- We try to make it easy, and all contributions, even the smaller ones, are more than welcome.
5
- This includes bug reports, fixes, documentation, examples...
6
- But first, read this page (including the small print at the end).
7
-
8
- Contributions are available on https://github.com/e2e-test-quest/uuv
9
-
10
- ## Legal
11
-
12
- All original contributions to _UUV_ are licensed under the
13
- [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0),
14
- version 2.0 or later.
15
-
16
- All contributions are subject to the [Developer Certificate of Origin](https://developercertificate.org/) (DCO).
17
- The DCO is a lightweight way for contributors to certify that they wrote or otherwise have the right to submit the code they are contributing to the project.
18
- The DCO text is also included verbatim in the [DCO.txt](DCO.txt) file in the root directory of the repository.
19
-
20
- Contributors **must** _sign-off_ that they adhere to these requirements by adding a `Signed-off-by` line to commit messages, as shown below:
21
-
22
- ```text
23
- This is the commit message
24
-
25
- Signed-off-by: Joe Dev <joe.dev@developer.example.org>
26
- ```
27
-
28
- Git has a handy [`-s` command line option](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---signoff) to append this automatically to your commit message:
29
-
30
- ```bash
31
- $ git commit -s -m 'This is the commit message'
32
- ```
33
-
34
- ## Reporting an issue
35
-
36
- This project uses GitLab issues to manage the issues.
37
-
38
- Before creating an issue:
39
-
40
- 1. upgrade your project to the latest released template version, and check whether your bug is still present,
41
- 2. have a look in the opened issues if your problem is already known/tracked, and possibly contribute to the thread with your own information.
42
-
43
- If none of the above was met, open an issue directly in GitLab, select the appropriate issue template and fill-in each section when applicable.
44
-
45
- ## Submitting a code change
46
-
47
- ### Git Setup
48
-
49
- Before contributing, make sure you have set up your Git authorship correctly:
50
-
51
- ```bash
52
- git config --global user.name "Your Full Name"
53
- git config --global user.email your.email@example.com
54
- ```
55
-
56
- ### Workflow
57
-
58
- All submissions, including submissions by project members, need to be reviewed before being merged.
59
-
60
- To contribute:
61
-
62
- 1. Create an issue describing the bug or enhancement you want to propose (select the right issue template).
63
- 2. Make sure the issue has been reviewed and agreed.
64
- 3. Create a Merge Request, from your **own** fork (see [forking workflow](https://docs.github.com/en/get-started/quickstart/fork-a-repo) documentation).
65
- Don't hesitate to mark your MR as `Draft` as long as you think it's not ready to be reviewed.
66
-
67
- ### Git Commit Conventions
68
-
69
- In addition to being signed-off according the [Developer Certificate of Origin](https://developercertificate.org/) (see above),
70
- Git commits in _UUV_ shall be:
71
-
72
- 1. **atomic** (1 commit `=` 1 and only 1 _thing_),
73
- 2. **semantic** (using [semantic-release commit message syntax](https://semantic-release.gitbook.io/semantic-release/#commit-message-format)).
74
- 3. **pattern**
75
- - **SCOPE** : one of (UUV, COMMONS, CYPRESS, PLAYWRIGHT, ASSISTANT, EXTENSION, DOCS)
76
- - ***TYPE*** : one of (FEAT, FIX, TECH, REFACTOR)
77
- - [**SCOPE**] [***TYPE***] #issue_identifier: commit message
78
- - Example :
79
- ```bash
80
- [CYPRESS] [FEAT] #51: upgrade library @badeball/cypress-cucumber-preprocessor version
81
- ```
package/dist/CHANGELOG.md DELETED
@@ -1,34 +0,0 @@
1
- ## [1.3.2](https://github.com/e2e-test-quest/uuv/compare/runner-playwright-v1.3.1...runner-playwright-v1.3.2) (2023-05-11)
2
-
3
-
4
- ### Bug Fixes
5
-
6
- * **runner-playwright:** add lint script [#8](https://github.com/e2e-test-quest/uuv/issues/8) ([0cd7451](https://github.com/e2e-test-quest/uuv/commit/0cd7451a2bb73698e05aefc6c89be01c2ea41c96))
7
- * **runner-playwright:** update @cucumber/cucumber dep version, [#93](https://github.com/e2e-test-quest/uuv/issues/93) ([a891a70](https://github.com/e2e-test-quest/uuv/commit/a891a70daad1cb5d7d34f25097a31d89f92b92c6))
8
-
9
- ## [1.3.1](https://github.com/e2e-test-quest/uuv/compare/runner-playwright-v1.3.0...runner-playwright-v1.3.1) (2023-05-09)
10
-
11
-
12
- ### Bug Fixes
13
-
14
- * **runner-commons:** fix npm documentation, [#87](https://github.com/e2e-test-quest/uuv/issues/87) ([ba7394c](https://github.com/e2e-test-quest/uuv/commit/ba7394cd755e350fd5a5964aed26435e5979e77d))
15
- * **runner-commons:** modify keyword for npmjs, [#87](https://github.com/e2e-test-quest/uuv/issues/87) ([392c4d0](https://github.com/e2e-test-quest/uuv/commit/392c4d0337179dae2c2a96c26dc2cc32e0ad87b3))
16
- * **runner-playwright:** add `npx playwright install` into postinstall, [#87](https://github.com/e2e-test-quest/uuv/issues/87) ([035f6aa](https://github.com/e2e-test-quest/uuv/commit/035f6aabb7d654eb45b789e73d63f118b628f9af))
17
- * **runner-playwright:** fix npm documentation, [#87](https://github.com/e2e-test-quest/uuv/issues/87) ([716de44](https://github.com/e2e-test-quest/uuv/commit/716de44456c50dcc4f52c3ed49f8fe48bf2f15b0))
18
- * **runner-playwright:** modify doc for npmjs, [#87](https://github.com/e2e-test-quest/uuv/issues/87) ([593e4ef](https://github.com/e2e-test-quest/uuv/commit/593e4ef3d14df27b3770f17bac9ba9ba7f326f4a))
19
-
20
- # Change Log
21
- All notable changes to this project will be documented in this file.
22
-
23
- The format is based on [Keep a Changelog](http://keepachangelog.com/)
24
- and this project adheres to [Semantic Versioning](http://semver.org/).
25
-
26
- ## [1.2.0-beta-20230424] - 2023-04-24
27
-
28
- ### Added
29
- - [#4](https://github.com/e2e-test-quest/uuv/issues/4)
30
- MINOR Amélioration du scoring npm
31
- - [#3](https://github.com/e2e-test-quest/uuv/issues/3)
32
- MAJOR Initialisation du pipeline
33
- - [#1](https://github.com/e2e-test-quest/uuv/issues/1)
34
- MAJOR Rajout de la licence Apache 2.0
@@ -1,81 +0,0 @@
1
- # Contributors guide
2
-
3
- **Want to contribute?**
4
- We try to make it easy, and all contributions, even the smaller ones, are more than welcome.
5
- This includes bug reports, fixes, documentation, examples...
6
- But first, read this page (including the small print at the end).
7
-
8
- Contributions are available on https://github.com/e2e-test-quest/uuv
9
-
10
- ## Legal
11
-
12
- All original contributions to _UUV_ are licensed under the
13
- [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0),
14
- version 2.0 or later.
15
-
16
- All contributions are subject to the [Developer Certificate of Origin](https://developercertificate.org/) (DCO).
17
- The DCO is a lightweight way for contributors to certify that they wrote or otherwise have the right to submit the code they are contributing to the project.
18
- The DCO text is also included verbatim in the [DCO.txt](DCO.txt) file in the root directory of the repository.
19
-
20
- Contributors **must** _sign-off_ that they adhere to these requirements by adding a `Signed-off-by` line to commit messages, as shown below:
21
-
22
- ```text
23
- This is the commit message
24
-
25
- Signed-off-by: Joe Dev <joe.dev@developer.example.org>
26
- ```
27
-
28
- Git has a handy [`-s` command line option](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---signoff) to append this automatically to your commit message:
29
-
30
- ```bash
31
- $ git commit -s -m 'This is the commit message'
32
- ```
33
-
34
- ## Reporting an issue
35
-
36
- This project uses GitLab issues to manage the issues.
37
-
38
- Before creating an issue:
39
-
40
- 1. upgrade your project to the latest released template version, and check whether your bug is still present,
41
- 2. have a look in the opened issues if your problem is already known/tracked, and possibly contribute to the thread with your own information.
42
-
43
- If none of the above was met, open an issue directly in GitLab, select the appropriate issue template and fill-in each section when applicable.
44
-
45
- ## Submitting a code change
46
-
47
- ### Git Setup
48
-
49
- Before contributing, make sure you have set up your Git authorship correctly:
50
-
51
- ```bash
52
- git config --global user.name "Your Full Name"
53
- git config --global user.email your.email@example.com
54
- ```
55
-
56
- ### Workflow
57
-
58
- All submissions, including submissions by project members, need to be reviewed before being merged.
59
-
60
- To contribute:
61
-
62
- 1. Create an issue describing the bug or enhancement you want to propose (select the right issue template).
63
- 2. Make sure the issue has been reviewed and agreed.
64
- 3. Create a Merge Request, from your **own** fork (see [forking workflow](https://docs.github.com/en/get-started/quickstart/fork-a-repo) documentation).
65
- Don't hesitate to mark your MR as `Draft` as long as you think it's not ready to be reviewed.
66
-
67
- ### Git Commit Conventions
68
-
69
- In addition to being signed-off according the [Developer Certificate of Origin](https://developercertificate.org/) (see above),
70
- Git commits in _UUV_ shall be:
71
-
72
- 1. **atomic** (1 commit `=` 1 and only 1 _thing_),
73
- 2. **semantic** (using [semantic-release commit message syntax](https://semantic-release.gitbook.io/semantic-release/#commit-message-format)).
74
- 3. **pattern**
75
- - **SCOPE** : one of (UUV, COMMONS, CYPRESS, PLAYWRIGHT, ASSISTANT, EXTENSION, DOCS)
76
- - ***TYPE*** : one of (FEAT, FIX, TECH, REFACTOR)
77
- - [**SCOPE**] [***TYPE***] #issue_identifier: commit message
78
- - Example :
79
- ```bash
80
- [CYPRESS] [FEAT] #51: upgrade library @badeball/cypress-cucumber-preprocessor version
81
- ```
package/dist/README.md DELETED
@@ -1,62 +0,0 @@
1
-
2
-
3
- # @uuv/runner-playwright
4
- <p align="center">
5
- <a href="https://e2e-test-quest.github.io/uuv/">
6
- <picture>
7
- <img alt="UUV Logo" src="https://e2e-test-quest.github.io/uuv/img/uuv.png">
8
- </picture>
9
- </a>
10
- </p>
11
- <p align="center">
12
- <a href="https://e2e-test-quest.github.io/uuv/"><img src="https://img.shields.io/badge/documentation-black?&style=for-the-badge&logo=github&logoColor=white" alt="documentation"/></a>
13
- </p>
14
-
15
- <h3 align="center">
16
- Test as final user
17
- </h3>
18
-
19
- <p align="center">
20
- Make test writing fast, understandable by any human understanding English or French.
21
- </p>
22
-
23
- <p align="center">
24
- <a href="https://www.npmjs.com/package/@uuv/playwright">
25
- <img src="https://img.shields.io/badge/available%20on%20npm-grey?logo=npm" alt="npm"/>
26
- </a>
27
- <a href="https://playwright.dev/">
28
- <img src="https://img.shields.io/badge/tested with-playwright-1dbb68?logo=playwright" alt="playwright"/>
29
- </a>
30
- <a href="https://testing-library.com/">
31
- <img src="https://img.shields.io/badge/tested%20with-testing%20library-ED3B3A?logo=testing-library" alt="testing-library"/>
32
- </a>
33
- <a href="https://cucumber.io/">
34
- <img src="https://img.shields.io/badge/tested%20with-cucumber-1dbb68?logo=cucumber" alt="cucumber"/>
35
- </a><br />
36
- </p>
37
-
38
- ## What is @uuv/playwright ?
39
-
40
- <p align="center">
41
-
42
- The `@uuv` library (User centric Usecases Validator) is an ecosystem that simplifies the writing of End to End tests in a BDD approach and a user-centric way.
43
- We can use the playwright engine to run test or cypress with [@uuv/cypress](https://www.npmjs.com/package/@uuv/cypress)
44
- </p>
45
-
46
- ## Installing
47
-
48
- <a href="https://e2e-test-quest.github.io/uuv/docs/getting-started/installation#playwright"><img src="https://img.shields.io/badge/Install%20Playwright%20doc-red?&style=for-the-badge&logo=github&logoColor=white" alt="documentation for install uuv playwright"/></a>
49
-
50
- <a href="https://e2e-test-quest.github.io/uuv/docs/getting-started/configuration"><img src="https://img.shields.io/badge/Configure%20Playwright%20doc-red?&style=for-the-badge&logo=github&logoColor=white" alt="documentation for configure uuv playwright"/></a>
51
-
52
- <a href="https://e2e-test-quest.github.io/uuv/docs/test/first-test"><img src="https://img.shields.io/badge/Write%20test%20doc-red?&style=for-the-badge&logo=github&logoColor=white" alt="documentation for write test"/></a>
53
-
54
- <a href="https://e2e-test-quest.github.io/uuv/docs/test/running-test"><img src="https://img.shields.io/badge/Run%20test%20doc-red?&style=for-the-badge&logo=github&logoColor=white" alt="documentation for run test"/></a>
55
-
56
- ## License
57
-
58
- [<a href="https://www.npmjs.com/package/@uuv/playwright">
59
- <img src="https://img.shields.io/badge/license-Apache%202.0-blue" alt="npm"/>
60
- </a>](https://www.apache.org/licenses/LICENSE-2.0)
61
-
62
- This project is licensed under the terms of the [Apache 2.0 license](https://www.apache.org/licenses/LICENSE-2.0).