Skip to content

Commit

Permalink
#3019 - Make a test more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
nanoblit committed Aug 31, 2023
1 parent e290053 commit 705c3c4
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down Expand Up @@ -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);
});
});

0 comments on commit 705c3c4

Please sign in to comment.