Skip to content

Commit 61abc36

Browse files
committed
fix color matching on functional test
1 parent 813c281 commit 61abc36

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

test/functional/page_objects/visualize_chart_page.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import { Position } from '@elastic/charts';
10-
import Color from 'color';
10+
import chroma from 'chroma-js';
1111

1212
import { FtrService } from '../ftr_provider_context';
1313

@@ -181,17 +181,17 @@ export class VisualizeChartPageObject extends FtrService {
181181
return items.some(({ color: c }) => c === color);
182182
}
183183

184-
public async doesSelectedLegendColorExistForPie(color: string) {
184+
public async doesSelectedLegendColorExistForPie(matchingColor: string) {
185185
if (await this.isNewLibraryChart(pieChartSelector)) {
186+
const hexMatchingColor = chroma(matchingColor).hex().toUpperCase();
186187
const slices =
187188
(await this.getEsChartDebugState(pieChartSelector))?.partition?.[0]?.partitions ?? [];
188-
return slices.some(({ color: c }) => {
189-
const rgbColor = new Color(color).rgb().toString();
190-
return c === rgbColor;
189+
return slices.some(({ color }) => {
190+
return hexMatchingColor === chroma(color).hex().toUpperCase();
191191
});
192192
}
193193

194-
return await this.testSubjects.exists(`legendSelectedColor-${color}`);
194+
return await this.testSubjects.exists(`legendSelectedColor-${matchingColor}`);
195195
}
196196

197197
public async expectError() {

0 commit comments

Comments
 (0)