@grafana/plugin-e2e 3.4.6 → 3.4.7-canary.2527.23044749262.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/dist/index.d.ts CHANGED
@@ -1435,7 +1435,15 @@ declare global {
1435
1435
  timeout?: number;
1436
1436
  }): Promise<R>;
1437
1437
  /**
1438
- * Asserts that a color picker has expected color selected
1438
+ * Asserts that a color picker displays the expected color value.
1439
+ *
1440
+ * Grafana normalizes all color values to lowercase hex (e.g. `#ff5733`),
1441
+ * so always pass lowercase hex as the expected value.
1442
+ *
1443
+ * @example
1444
+ * ```ts
1445
+ * await expect(panel.fieldByLabel('Line color').colorPicker()).toHaveColor('#ff5733');
1446
+ * ```
1439
1447
  */
1440
1448
  toHaveColor(colorPicker: ColorPicker, rgbOrHex: string, options?: {
1441
1449
  timeout?: number;
@@ -5,7 +5,14 @@ var utils = require('./utils.js');
5
5
 
6
6
  async function toHaveColor(colorPicker, rgbOrHex, options) {
7
7
  try {
8
- await test.expect(colorPicker.locator().getByRole("textbox")).toHaveValue(rgbOrHex, options);
8
+ const textbox = colorPicker.locator().getByRole("textbox");
9
+ const hasTextbox = await textbox.count() > 0;
10
+ if (hasTextbox) {
11
+ await test.expect(textbox).toHaveValue(rgbOrHex, options);
12
+ } else {
13
+ const colorValue = colorPicker.locator().locator("div:has(button) + span");
14
+ await test.expect(colorValue).toHaveText(rgbOrHex, options);
15
+ }
9
16
  return {
10
17
  pass: true,
11
18
  expected: rgbOrHex,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/plugin-e2e",
3
- "version": "3.4.6",
3
+ "version": "3.4.7-canary.2527.23044749262.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -54,5 +54,5 @@
54
54
  "uuid": "^13.0.0",
55
55
  "yaml": "^2.3.4"
56
56
  },
57
- "gitHead": "1e2757b2406d381b1ed8bbebce39ae47b3cdfd67"
57
+ "gitHead": "cb1db383dba6f463eacc9d27f12d7a4472827d36"
58
58
  }