@bigbinary/neeto-playwright-commons 4.12.0 → 4.12.1

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.
Files changed (3) hide show
  1. package/index.d.ts +3 -1
  2. package/index.js +33 -14
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -4192,7 +4192,7 @@ declare class EditorPage {
4192
4192
  private verifyFontSizeV2;
4193
4193
  private verifyTextModifiers;
4194
4194
  private verifyTextDeskModifier;
4195
- private openHighlighterContainer;
4195
+ private pickHighlightColor;
4196
4196
  private focusText;
4197
4197
  private highlightText;
4198
4198
  private verifyTextHighlighter;
@@ -4208,6 +4208,7 @@ declare class EditorPage {
4208
4208
  private verifyTableSelector;
4209
4209
  private verifyVideoUploadOption;
4210
4210
  private verifyTodoListSelector;
4211
+ private openDynamicVariablesMenu;
4211
4212
  verifyDynamicVariables: (dynamicVariables: KeyValuePair[]) => Promise<void>;
4212
4213
  private verifyTextColor;
4213
4214
  private verifyCalloutSelector;
@@ -8173,6 +8174,7 @@ declare const NEETO_EDITOR_SELECTORS: {
8173
8174
  highlightBg: (bgColorIndex: number) => string;
8174
8175
  neetoEditorHighlightTextColor: (textColorIndex: number) => string;
8175
8176
  neetoEditorHighlightBgColor: (bgColorIndex: number) => string;
8177
+ highlightTextColorGrid: string;
8176
8178
  todoList: string;
8177
8179
  selectedText: string;
8178
8180
  commandListItem: (index: number) => string;
package/index.js CHANGED
@@ -2491,6 +2491,7 @@ const NEETO_EDITOR_SELECTORS = {
2491
2491
  highlightBg: (bgColorIndex) => `--neeto-editor-highlight-bg-${bgColorIndex}`,
2492
2492
  neetoEditorHighlightTextColor: (textColorIndex) => `neeto-editor-highlight-text-color-dot-${textColorIndex}`,
2493
2493
  neetoEditorHighlightBgColor: (bgColorIndex) => `neeto-editor-highlight-background-color-dot-${bgColorIndex}`,
2494
+ highlightTextColorGrid: "neeto-editor-highlight-text-color-grid",
2494
2495
  todoList: "[data-type='todoList']",
2495
2496
  selectedText: ".selected-text",
2496
2497
  commandListItem: (index) => `neeto-editor-command-list-item-${index}`,
@@ -6797,9 +6798,19 @@ class EditorPage {
6797
6798
  await this.clickToolbarOption(textModifierSelector, isButtonInMoreMenu);
6798
6799
  return [{ key: modifierKey, value: randomText }];
6799
6800
  };
6800
- openHighlighterContainer = (isButtonInMoreMenu) => expect(async () => {
6801
- await this.clickToolbarOption(this.toolbarOption(NEETO_TEXT_MODIFIER_SELECTORS["highlight"]), isButtonInMoreMenu);
6802
- await expect(this.page.getByTestId(COMMON_SELECTORS.customDropdownContainer())).toBeVisible({ timeout: 5_000 });
6801
+ // A pick closes the palette on newer editors, and its state can still read
6802
+ // "open" for a few ms afterwards, so the dot is clicked inside the retry: a
6803
+ // palette that closes under the click is reopened and the dot clicked again.
6804
+ pickHighlightColor = (colorPalette, colorDot, isButtonInMoreMenu) => expect(async () => {
6805
+ const isPaletteOpen = (await colorPalette.isVisible()) &&
6806
+ (await colorPalette.getAttribute("data-state", { timeout: 1_000 })) !==
6807
+ "closed";
6808
+ if (!isPaletteOpen) {
6809
+ await expect(colorPalette).toBeHidden({ timeout: 5_000 });
6810
+ await this.clickToolbarOption(this.toolbarOption(NEETO_TEXT_MODIFIER_SELECTORS["highlight"]), isButtonInMoreMenu);
6811
+ await expect(colorPalette).toBeVisible({ timeout: 5_000 });
6812
+ }
6813
+ await colorDot.click({ timeout: 2_000 });
6803
6814
  }).toPass({ timeout: 30_000 });
6804
6815
  focusText = (textLocator) => expect(async () => {
6805
6816
  await textLocator.click();
@@ -6810,15 +6821,13 @@ class EditorPage {
6810
6821
  }).toPass({ timeout: 20_000 });
6811
6822
  highlightText = async (isButtonInMoreMenu, colorIndex) => {
6812
6823
  const randomText = await this.fillRandomText();
6813
- await this.openHighlighterContainer(isButtonInMoreMenu);
6814
- const colorPallete = this.page.getByTestId(COMMON_SELECTORS.customDropdownContainer());
6815
- await colorPallete
6816
- .getByTestId(NEETO_EDITOR_SELECTORS.neetoEditorHighlightTextColor(colorIndex))
6817
- .click();
6818
- await this.openHighlighterContainer(isButtonInMoreMenu);
6819
- await colorPallete
6820
- .getByTestId(NEETO_EDITOR_SELECTORS.neetoEditorHighlightBgColor(colorIndex))
6821
- .click();
6824
+ const colorPallete = this.page
6825
+ .getByTestId(COMMON_SELECTORS.customDropdownContainer())
6826
+ .filter({
6827
+ has: this.page.getByTestId(NEETO_EDITOR_SELECTORS.highlightTextColorGrid),
6828
+ });
6829
+ await this.pickHighlightColor(colorPallete, colorPallete.getByTestId(NEETO_EDITOR_SELECTORS.neetoEditorHighlightTextColor(colorIndex)), isButtonInMoreMenu);
6830
+ await this.pickHighlightColor(colorPallete, colorPallete.getByTestId(NEETO_EDITOR_SELECTORS.neetoEditorHighlightBgColor(colorIndex)), isButtonInMoreMenu);
6822
6831
  const highlightedText = this.contentField.getByText(randomText);
6823
6832
  await this.focusText(highlightedText);
6824
6833
  const textStyle = await highlightedText.getAttribute("style");
@@ -7020,10 +7029,20 @@ class EditorPage {
7020
7029
  await this.moveCursorAtBottom();
7021
7030
  return [{ key: "todoList", value: randomText }];
7022
7031
  };
7032
+ openDynamicVariablesMenu = (variablesMenu) => expect(async () => {
7033
+ const isMenuOpen = (await variablesMenu.isVisible()) &&
7034
+ (await variablesMenu.getAttribute("data-state", { timeout: 1_000 })) !==
7035
+ "closed";
7036
+ if (isMenuOpen)
7037
+ return;
7038
+ await expect(variablesMenu).toBeHidden({ timeout: 5_000 });
7039
+ await this.dynamicVariablesButton.click();
7040
+ await expect(variablesMenu).toBeVisible({ timeout: 5_000 });
7041
+ }).toPass({ timeout: 30_000 });
7023
7042
  verifyDynamicVariables = async (dynamicVariables) => {
7043
+ const variablesMenu = this.page.getByTestId(COMMON_SELECTORS.dropdownContainer);
7024
7044
  for (const { key, value } of dynamicVariables) {
7025
- await this.dynamicVariablesButton.click();
7026
- await expect(this.page.getByTestId(COMMON_SELECTORS.dropdownContainer)).toBeVisible();
7045
+ await this.openDynamicVariablesMenu(variablesMenu);
7027
7046
  await this.page
7028
7047
  .getByTestId(NEETO_EDITOR_SELECTORS.dynamicVariableList(key))
7029
7048
  .getByTestId(NEETO_EDITOR_SELECTORS.dynamicVariableSelector(value))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-playwright-commons",
3
- "version": "4.12.0",
3
+ "version": "4.12.1",
4
4
  "description": "A package encapsulating common playwright code across neeto projects.",
5
5
  "repository": "git@github.com:bigbinary/neeto-playwright-commons.git",
6
6
  "license": "apache-2.0",