@bigbinary/neeto-playwright-commons 1.19.10 → 1.19.12

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/index.cjs.js CHANGED
@@ -191757,8 +191757,9 @@ const LIST_MODIFIER_TAGS = {
191757
191757
  class EditorPage {
191758
191758
  constructor(page, neetoPlaywrightUtilities, editorWrapper) {
191759
191759
  this.wordsUsedInEditor = [];
191760
- this.linkUrl = faker.faker.internet.url();
191761
191760
  this.filePath = "../../../e2e/assets/images/BigBinary.png";
191761
+ this.videoPath = "../../../e2e/assets/files/sample.mp4";
191762
+ this.linkUrl = faker.faker.internet.url();
191762
191763
  this.imageUrl = "https://picsum.photos/200/300";
191763
191764
  this.videoUrl = "https://youtu.be/jNQXAC9IVRw";
191764
191765
  this.cannedResponseSuccessMessage = "";
@@ -191907,7 +191908,7 @@ class EditorPage {
191907
191908
  await fileUploader.setFiles(imagePath);
191908
191909
  await test$1.expect(this.imageWrapper).toBeVisible({ timeout: 15000 });
191909
191910
  await this.imageWrapper.getByTestId(COMMON_SELECTORS.dropdownIcon).click();
191910
- await this.imageUploadDeleteButton.click();
191911
+ await this.uploadDeleteButton.click();
191911
191912
  await test$1.expect(this.imageWrapper).toBeHidden({
191912
191913
  timeout: 15000,
191913
191914
  });
@@ -191927,7 +191928,7 @@ class EditorPage {
191927
191928
  await this.imageWrapper
191928
191929
  .getByTestId(COMMON_SELECTORS.dropdownIcon)
191929
191930
  .click();
191930
- await this.imageUploadDeleteButton.click();
191931
+ await this.uploadDeleteButton.click();
191931
191932
  await test$1.expect(this.imageWrapper).toBeHidden({
191932
191933
  timeout: 15000,
191933
191934
  });
@@ -191964,7 +191965,7 @@ class EditorPage {
191964
191965
  await this.videoWrapperSelector
191965
191966
  .getByTestId(COMMON_SELECTORS.dropdownIcon)
191966
191967
  .click();
191967
- await this.imageUploadDeleteButton.click();
191968
+ await this.uploadDeleteButton.click();
191968
191969
  await test$1.expect(this.videoWrapperSelector).toBeHidden({
191969
191970
  timeout: 15000,
191970
191971
  });
@@ -191987,6 +191988,68 @@ class EditorPage {
191987
191988
  await this.page.keyboard.press("Escape");
191988
191989
  return [{ key: "emoji", value: emoji }];
191989
191990
  };
191991
+ this.verifyUndoSelector = async (isButtonInMoreMenu) => {
191992
+ isButtonInMoreMenu && (await this.moreMenuSelector.click());
191993
+ const randomText = await this.fillRandomText();
191994
+ await test$1.expect(this.contentField.getByText(randomText, { exact: true })).toBeVisible();
191995
+ await this.undoSelector.click();
191996
+ await test$1.expect(this.contentField.getByText(randomText, { exact: true })).toBeHidden();
191997
+ return [{ key: "undo", value: randomText }];
191998
+ };
191999
+ this.verifyRedoSelector = async (isButtonInMoreMenu) => {
192000
+ isButtonInMoreMenu && (await this.moreMenuSelector.click());
192001
+ const randomText = await this.fillRandomText();
192002
+ await test$1.expect(this.contentField.getByText(randomText, { exact: true })).toBeVisible();
192003
+ await this.undoSelector.click();
192004
+ await test$1.expect(this.contentField.getByText(randomText, { exact: true })).toBeHidden();
192005
+ await this.redoSelector.click();
192006
+ await test$1.expect(this.contentField.getByText(randomText, { exact: true })).toBeVisible();
192007
+ return [{ key: "redo", value: randomText }];
192008
+ };
192009
+ this.verifyTableSelector = async (isButtonInMoreMenu) => {
192010
+ isButtonInMoreMenu && (await this.moreMenuSelector.click());
192011
+ await this.tableOption.click();
192012
+ await this.page
192013
+ .getByTestId(NEETO_EDITOR_SELECTORS.tableCreateButton)
192014
+ .click();
192015
+ const table = this.page.getByRole("table");
192016
+ await test$1.expect(table).toBeVisible();
192017
+ const rows = table.getByRole("row");
192018
+ await test$1.expect(rows).toHaveCount(3);
192019
+ for (let i = 0; i < 3; i++) {
192020
+ // The index is important here as it determines which row to interact with
192021
+ // eslint-disable-next-line playwright/no-nth-methods
192022
+ const row = rows.nth(i);
192023
+ const cells = row.getByRole("cell");
192024
+ await test$1.expect(cells).toHaveCount(3);
192025
+ }
192026
+ return [{ key: "table" }];
192027
+ };
192028
+ this.verifyVideoUploadOption = async ({ filePath, isButtonInMoreMenu, shouldRemoveVideo, }) => {
192029
+ isButtonInMoreMenu && (await this.moreMenuSelector.click());
192030
+ await this.videoUploadOption.click();
192031
+ const fileUploaderPromise = this.page.waitForEvent("filechooser");
192032
+ await this.page
192033
+ .getByTestId(NEETO_EDITOR_SELECTORS.imageUploadButton)
192034
+ .click();
192035
+ const fileUploader = await fileUploaderPromise;
192036
+ const imagePath = Path__namespace.join(__dirname, filePath);
192037
+ await fileUploader.setFiles(imagePath);
192038
+ await test$1.expect(this.page.getByRole("figure")).toBeVisible({
192039
+ timeout: 20000,
192040
+ });
192041
+ if (shouldRemoveVideo) {
192042
+ await this.page
192043
+ .getByRole("figure")
192044
+ .getByTestId(COMMON_SELECTORS.dropdownIcon)
192045
+ .click();
192046
+ await this.uploadDeleteButton.click();
192047
+ await test$1.expect(this.imageWrapper).toBeHidden({
192048
+ timeout: 15000,
192049
+ });
192050
+ }
192051
+ return [{ key: "video-upload", value: this.videoPath }];
192052
+ };
191990
192053
  this.verifyDynamicVariables = async (dynamicVariables) => {
191991
192054
  for (const { key, value } of dynamicVariables) {
191992
192055
  await this.dynamicVariablesButton.click();
@@ -192019,14 +192082,22 @@ class EditorPage {
192019
192082
  }),
192020
192083
  "canned-responses": isButtonInMoreMenu => this.verifyCannedResponseOption(isButtonInMoreMenu),
192021
192084
  "video-embed": isButtonInMoreMenu => this.verifyVideoEmbedOption(this.videoUrl, isButtonInMoreMenu),
192085
+ undo: isButtonInMoreMenu => this.verifyUndoSelector(isButtonInMoreMenu),
192086
+ redo: isButtonInMoreMenu => this.verifyRedoSelector(isButtonInMoreMenu),
192087
+ table: isButtonInMoreMenu => this.verifyTableSelector(isButtonInMoreMenu),
192088
+ "video-upload": isButtonInMoreMenu => this.verifyVideoUploadOption({
192089
+ filePath: this.videoPath,
192090
+ isButtonInMoreMenu,
192091
+ }),
192022
192092
  };
192023
- this.verifyDescriptionEditor = async ({ dynamicVariables, linkUrl, filePath, imageUrl, videoUrl, cannedResponseSuccessMessage, } = {}) => {
192093
+ this.verifyDescriptionEditor = async ({ dynamicVariables, linkUrl, videoPath, filePath, imageUrl, videoUrl, cannedResponseSuccessMessage, } = {}) => {
192024
192094
  const fixedMenuButtons = await this.fixedMenuOptions();
192025
192095
  let moreMenuButtons = [];
192026
192096
  (await this.moreMenuSelector.isVisible()) &&
192027
192097
  (moreMenuButtons = await this.moreMenuOptions());
192028
192098
  this.linkUrl = linkUrl || this.linkUrl;
192029
192099
  this.filePath = filePath || this.filePath;
192100
+ this.videoPath = videoPath || this.videoPath;
192030
192101
  this.imageUrl = imageUrl || this.imageUrl;
192031
192102
  this.videoUrl = videoUrl || this.videoUrl;
192032
192103
  this.cannedResponseSuccessMessage = cannedResponseSuccessMessage;
@@ -192076,7 +192147,7 @@ class EditorPage {
192076
192147
  this.attachmentPreview = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.attachmentPreview);
192077
192148
  this.editorAttachmentsButton = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.editorAttachmentsButton);
192078
192149
  this.imageWrapper = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.imageWrapper);
192079
- this.imageUploadDeleteButton = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.imageUploadDeleteButton);
192150
+ this.uploadDeleteButton = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.imageUploadDeleteButton);
192080
192151
  this.imageUploadOption = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.imageUploadOption);
192081
192152
  this.cannedResponseOption = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.cannedResponseOption);
192082
192153
  this.videoEmbedOption = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.videoEmbedOption);
@@ -192088,6 +192159,10 @@ class EditorPage {
192088
192159
  .getByTestId(COMMON_SELECTORS.dropdownIcon);
192089
192160
  this.contentField = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.contentField);
192090
192161
  this.dynamicVariablesButton = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.dynamicVariablesButton);
192162
+ this.undoSelector = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.undoOption);
192163
+ this.redoSelector = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.redoOption);
192164
+ this.tableOption = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.tableOption);
192165
+ this.videoUploadOption = this.editorWrapper.getByTestId(NEETO_EDITOR_SELECTORS.videoUploadOption);
192091
192166
  }
192092
192167
  }
192093
192168
 
@@ -194899,10 +194974,15 @@ const playdashProductionConfig = {
194899
194974
  ciBuildId: process.env.NEETO_CI_JOB_ID,
194900
194975
  tags: process.env.TAG,
194901
194976
  };
194977
+ const playdashLighthouseConfig = {
194978
+ apiKey: process.env.PLAYDASH_LIGHTHOUSE_API_KEY,
194979
+ ciBuildId: process.env.NEETO_CI_JOB_ID,
194980
+ tags: process.env.TAG,
194981
+ };
194902
194982
  const isCI = [ENVIRONMENT.staging, ENVIRONMENT.review].includes((_b = process.env.TEST_ENV) !== null && _b !== void 0 ? _b : ENVIRONMENT.development) && !!process.env.NEETO_CI_JOB_ID;
194903
194983
  const definePlaywrightConfig = (overrides) => {
194904
- const { globalOverrides = {}, useOverrides = {}, useCustomProjects = false, projectOverrides = [], playdashStagingOverrides = {}, playdashProductionOverrides = {}, } = overrides;
194905
- const reporter = !ramda.isEmpty(playdashStagingOverrides)
194984
+ const { globalOverrides = {}, useOverrides = {}, useCustomProjects = false, projectOverrides = [], playdashStagingOverrides = {}, playdashProductionOverrides = {}, playdashLighthouseOverrides = {}, } = overrides;
194985
+ let reporter = !ramda.isEmpty(playdashStagingOverrides)
194906
194986
  ? [
194907
194987
  [
194908
194988
  "@bigbinary/neeto-playwright-reporter",
@@ -194921,6 +195001,17 @@ const definePlaywrightConfig = (overrides) => {
194921
195001
  },
194922
195002
  ],
194923
195003
  ];
195004
+ if (process.env.IS_LIGHTHOUSE_REPORT) {
195005
+ reporter = [
195006
+ [
195007
+ "@bigbinary/neeto-playwright-reporter",
195008
+ {
195009
+ ...playdashLighthouseConfig,
195010
+ ...playdashLighthouseOverrides,
195011
+ },
195012
+ ],
195013
+ ];
195014
+ }
194924
195015
  return test$1.defineConfig({
194925
195016
  testDir: "./e2e/tests",
194926
195017
  fullyParallel: true,