Skip to content

Commit

Permalink
Fix replace control tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Heenawter committed Jun 12, 2023
1 parent a982e6f commit 15f3495
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export const RangeSliderControl: FC = () => {
}, [debouncedOnChange, displayedValue]);

useEffect(() => {
// console.log('value changed');
setDisplayedValue(value ?? ['', '']);
}, [value]);

Expand Down
27 changes: 22 additions & 5 deletions test/functional/page_objects/dashboard_page_controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,28 @@ export class DashboardPageControls extends FtrService {
}

public async verifyControlType(controlId: string, expectedType: string) {
const controlButton = await this.find.byXPath(
`//div[@id='controlFrame--${controlId}']//button`
);
const testSubj = await controlButton.getAttribute('data-test-subj');
expect(testSubj).to.equal(`${expectedType}-${controlId}`);
let controlButton;
switch (expectedType) {
case OPTIONS_LIST_CONTROL: {
controlButton = await this.find.byXPath(`//div[@id='controlFrame--${controlId}']//button`);
break;
}
case RANGE_SLIDER_CONTROL: {
controlButton = await this.find.byXPath(
`//div[@id='controlFrame--${controlId}']//div[contains(@class, 'rangeSliderAnchor__button')]`
);
break;
}
default: {
this.log.error('An invalid control type was provided.');
break;
}
}

if (controlButton) {
const testSubj = await controlButton.getAttribute('data-test-subj');
expect(testSubj).to.equal(`${expectedType}-${controlId}`);
}
}

// Options list functions
Expand Down

0 comments on commit 15f3495

Please sign in to comment.