From 705c3c43922cabbac092e3e3e3ec0ceaed7f4055 Mon Sep 17 00:00:00 2001 From: nanoblit Date: Thu, 31 Aug 2023 09:35:51 +0200 Subject: [PATCH] #3019 - Make a test more readable --- .../Template-Library/template-library.spec.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ketcher-autotests/tests/Templates/Template-Library/template-library.spec.ts b/ketcher-autotests/tests/Templates/Template-Library/template-library.spec.ts index 496e14f573..bd78ce1eaa 100644 --- a/ketcher-autotests/tests/Templates/Template-Library/template-library.spec.ts +++ b/ketcher-autotests/tests/Templates/Template-Library/template-library.spec.ts @@ -18,10 +18,16 @@ async function setDisplayStereoFlagsSettingToOn(page: Page) { await pressButton(page, 'Apply'); } -async function switchIgnoreChiralFlagSetting(page: Page) { +async function setIgnoreChiralFlagSetting(page: Page, newSetting: boolean) { await selectTopPanelButton(TopPanelButton.Settings, page); await page.getByText('Stereochemistry', { exact: true }).click(); - await page.getByText('Ignore the chiral flag').click(); + + const checkLocator = page.getByText('Ignore the chiral flag'); + const isChecked = await checkLocator.isChecked(); + if (isChecked !== newSetting) { + await checkLocator.click(); + } + await pressButton(page, 'Apply'); } @@ -57,12 +63,10 @@ test.describe('Templates - Template Library', () => { await setDisplayStereoFlagsSettingToOn(page); - // Enable the setting - await switchIgnoreChiralFlagSetting(page); + await setIgnoreChiralFlagSetting(page, true); await placePhenylalanineMustard(page, x - offsetX, y); - // Disable the setting - await switchIgnoreChiralFlagSetting(page); + await setIgnoreChiralFlagSetting(page, false); await placePhenylalanineMustard(page, x + offsetX, y); }); });