Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DaryaLari committed Dec 19, 2024
1 parent 585a0a4 commit e585717
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/shared/constants/qa/control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ export const DialogGroupControlQa = {
applyButtonCheckbox: 'apply-button-checkbox',
resetButtonCheckbox: 'reset-button-checkbox',
updateControlOnChangeCheckbox: 'update-controls-button-checkbox',
placementButton: 'selectors-placement-button',
extendedSettingsButton: 'extended-settings-button',
placementControlList: 'selectors-placement-control-list',
placementApplyButton: 'selectors-placement-apply-button',
extendedSettingsApplyButton: 'selectors-extended-settings-apply-button',
controlMenu: 'control-menu',
removeControlButton: 'remove-control-button',
copyControlButton: 'copy-control-button',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ const DialogExtendedSettings = ({
textButtonCancel={i18n('button_cancel')}
textButtonApply={i18n('button_save')}
propsButtonCancel={{view: 'flat'}}
propsButtonApply={{qa: DialogGroupControlQa.placementApplyButton}}
propsButtonApply={{qa: DialogGroupControlQa.extendedSettingsApplyButton}}
onClickButtonApply={handleApplyClick}
onClickButtonCancel={onClose}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export const GroupControlSidebar: React.FC<{
className={b('extended-settings-button')}
width="max"
onClick={handleExtendedSettingsClick}
qa={DialogGroupControlQa.placementButton}
qa={DialogGroupControlQa.extendedSettingsButton}
>
<Icon data={Gear} height={16} width={16} />
{i18n('button_extended-settings')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ datalensTest.describe('Dashboards - Base actions with group selectors', () => {
await dashboardPage.enterEditMode();
await dashboardPage.clickFirstControlSettingsButton();
await dashboardPage.controlActions.waitForDialog();
await page.locator(slct(DialogGroupControlQa.placementButton)).click();
await page.locator(slct(DialogGroupControlQa.extendedSettingsButton)).click();

// the controls of placement prevent you from clicking on the middle of item, so
// moveXRation is 3 (x position of click is width of item / 3)
Expand All @@ -144,7 +144,7 @@ datalensTest.describe('Dashboards - Base actions with group selectors', () => {
moveXRation: 3,
});

await page.locator(slct(DialogGroupControlQa.placementApplyButton)).click();
await page.locator(slct(DialogGroupControlQa.extendedSettingsApplyButton)).click();

await page.locator(slct(ControlQA.dialogControlApplyBtn)).click();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ datalensTest.describe('Dashboards - Action buttons in group selectors', () => {
async ({page}: {page: Page}) => {
const dashboardPage = new DashboardPage({page});

await page.locator(slct(DialogGroupControlQa.extendedSettingsButton)).click();
await page.locator(slct(DialogGroupControlQa.applyButtonCheckbox)).click();
await page.locator(slct(DialogGroupControlQa.extendedSettingsApplyButton)).click();

await page.locator(slct(ControlQA.dialogControlApplyBtn)).click();
await dashboardPage.saveChanges();
Expand Down Expand Up @@ -99,7 +101,9 @@ datalensTest.describe('Dashboards - Action buttons in group selectors', () => {
async ({page}: {page: Page}) => {
const dashboardPage = new DashboardPage({page});

await page.locator(slct(DialogGroupControlQa.extendedSettingsButton)).click();
await page.locator(slct(DialogGroupControlQa.resetButtonCheckbox)).click();
await page.locator(slct(DialogGroupControlQa.extendedSettingsApplyButton)).click();

await page.locator(slct(ControlQA.dialogControlApplyBtn)).click();
await dashboardPage.saveChanges();
Expand Down Expand Up @@ -162,8 +166,10 @@ datalensTest.describe('Dashboards - Action buttons in group selectors', () => {
const dashboardPage = new DashboardPage({page});
let stateUpdatesCount = 0;

await page.locator(slct(DialogGroupControlQa.extendedSettingsButton)).click();
await page.locator(slct(DialogGroupControlQa.applyButtonCheckbox)).click();
await page.locator(slct(DialogGroupControlQa.resetButtonCheckbox)).click();
await page.locator(slct(DialogGroupControlQa.extendedSettingsApplyButton)).click();

await page.locator(slct(ControlQA.dialogControlApplyBtn)).click();
await dashboardPage.saveChanges();
Expand Down
1 change: 0 additions & 1 deletion tests/page-objects/common/abstract/RadioGroupElementPO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {ElementPO} from './ElementPO';

export class RadioGroupElementPO extends ElementPO {
async selectByName(name: string) {
await this.expectVisible();
await this.page.locator(`${this.getSelector()} input[value="${name}"]`).click();
}
}
3 changes: 3 additions & 0 deletions tests/page-objects/dashboard/ControlActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,16 @@ class ControlActions {
}

if (options && options.buttonApply) {
await this.page.locator(slct(DialogGroupControlQa.extendedSettingsButton)).click();
await this.page
.locator(`${slct(DialogGroupControlQa.applyButtonCheckbox)} input`)
.setChecked(true);

await this.page
.locator(`${slct(DialogGroupControlQa.updateControlOnChangeCheckbox)} input`)
.setChecked(Boolean(options?.updateControlOnChange));

await this.page.locator(slct(DialogGroupControlQa.extendedSettingsApplyButton)).click();
}

// adding a selector to the dashboard
Expand Down
2 changes: 2 additions & 0 deletions tests/page-objects/dashboard/DashboardPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -988,9 +988,11 @@ class DashboardPage extends BasePage {
async disableAutoupdateInFirstControl() {
await this.enterEditMode();
await this.clickFirstControlSettingsButton();
await this.page.locator(slct(DialogGroupControlQa.extendedSettingsButton)).click();
await this.page
.locator(`${slct(DialogGroupControlQa.updateControlOnChangeCheckbox)} input`)
.setChecked(false);
await this.page.locator(slct(DialogGroupControlQa.extendedSettingsApplyButton)).click();
await this.controlActions.applyControlSettings();
await this.saveChanges();
}
Expand Down

0 comments on commit e585717

Please sign in to comment.