@umbraco/playwright-testhelpers 16.0.17 → 16.0.19

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.
@@ -0,0 +1,9 @@
1
+ export declare class ConsoleErrorHelper {
2
+ writeConsoleErrorToFile(error: any): void;
3
+ updateConsoleErrorTextToJson(errorMessage: string, testTitle: string, testLocation: string): {
4
+ testTitle: string;
5
+ testLocation: string;
6
+ errorText: string;
7
+ errorCount: number;
8
+ };
9
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConsoleErrorHelper = void 0;
4
+ const fs = require("fs");
5
+ class ConsoleErrorHelper {
6
+ writeConsoleErrorToFile(error) {
7
+ const filePath = process.env.CONSOLE_ERRORS_PATH;
8
+ if (filePath) {
9
+ try {
10
+ const jsonString = fs.readFileSync(filePath, 'utf-8');
11
+ const data = JSON.parse(jsonString);
12
+ // Checks if the error already exists in the file for the specific test, and if it does. We increment the error count instead of adding it again.
13
+ const duplicateError = data.consoleErrors.find(item => (item.testTitle === error.testTitle) && (item.errorText === error.errorText));
14
+ if (duplicateError) {
15
+ duplicateError.errorCount++;
16
+ data.consoleErrors[data.consoleErrors.indexOf(duplicateError[0])] = duplicateError;
17
+ }
18
+ else {
19
+ data.consoleErrors.push(error);
20
+ }
21
+ const updatedJsonString = JSON.stringify(data, null, 2);
22
+ fs.writeFileSync(filePath, updatedJsonString, 'utf-8');
23
+ }
24
+ catch (error) {
25
+ console.error('Error updating console error:', error);
26
+ }
27
+ }
28
+ }
29
+ updateConsoleErrorTextToJson(errorMessage, testTitle, testLocation) {
30
+ return {
31
+ testTitle: testTitle,
32
+ testLocation: testLocation,
33
+ errorText: errorMessage,
34
+ errorCount: 1,
35
+ };
36
+ }
37
+ }
38
+ exports.ConsoleErrorHelper = ConsoleErrorHelper;
39
+ //# sourceMappingURL=ConsoleErrorHelper.js.map
@@ -0,0 +1 @@
1
+ {"version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oB;QACxF,OAAO;YACL,SAAS,EAAE,SAAS;YACpB,YAAY,EAAE,YAAY;YAC1B,SAAS,EAAE,YAAY;YACvB,UAAU,EAAE,CAAC;SACd,CAAC;IACJ,CAAC;CACF;AAlCD,gDAkCC","sourcesContent":["import * as fs from \"fs\";\n\nexport class ConsoleErrorHelper {\n\n writeConsoleErrorToFile(error) {\n const filePath = process.env.CONSOLE_ERRORS_PATH;\n if (filePath) {\n try {\n const jsonString = fs.readFileSync(filePath, 'utf-8');\n const data = JSON.parse(jsonString);\n\n // Checks if the error already exists in the file for the specific test, and if it does. We increment the error count instead of adding it again.\n const duplicateError = data.consoleErrors.find(item => (item.testTitle === error.testTitle) && (item.errorText === error.errorText));\n if (duplicateError) {\n duplicateError.errorCount++;\n data.consoleErrors[data.consoleErrors.indexOf(duplicateError[0])] = duplicateError;\n } else {\n data.consoleErrors.push(error);\n }\n\n const updatedJsonString = JSON.stringify(data, null, 2);\n fs.writeFileSync(filePath, updatedJsonString, 'utf-8');\n } catch (error) {\n console.error('Error updating console error:', error);\n }\n }\n }\n\n updateConsoleErrorTextToJson(errorMessage: string, testTitle: string, testLocation: string) {\n return {\n testTitle: testTitle,\n testLocation: testLocation,\n errorText: errorMessage,\n errorCount: 1,\n };\n }\n}"]}
@@ -350,6 +350,7 @@ class ContentUiHelper extends UiBaseLocators_1.UiBaseLocators {
350
350
  async clickSaveAndPublishButton() {
351
351
  await (0, test_1.expect)(this.saveAndPublishBtn).toBeVisible();
352
352
  await this.saveAndPublishBtn.click();
353
+ await this.page.waitForTimeout(500);
353
354
  }
354
355
  async isSuccessStateVisibleForSaveAndPublishButton(isVisible = true) {
355
356
  const saveAndPublishBtn = this.workspaceAction.filter({ has: this.saveAndPublishBtn });
@@ -389,6 +390,7 @@ class ContentUiHelper extends UiBaseLocators_1.UiBaseLocators {
389
390
  async clickSaveButtonForContent() {
390
391
  await (0, test_1.expect)(this.saveContentBtn).toBeVisible();
391
392
  await this.saveContentBtn.click();
393
+ await this.page.waitForTimeout(500);
392
394
  }
393
395
  async enterTextstring(text) {
394
396
  await (0, test_1.expect)(this.textstringTxt).toBeVisible();