-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
44 additions
and
8 deletions.
There are no files selected for viewing
52 changes: 44 additions & 8 deletions
52
ketcher-autotests/tests/Templates/Template-Library/template-library.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,63 @@ | ||
import { test } from '@playwright/test'; | ||
import { Page, test } from '@playwright/test'; | ||
import { | ||
getCoordinatesOfTheMiddleOfTheScreen, | ||
pressButton, | ||
resetCurrentTool, | ||
selectTopPanelButton, | ||
STRUCTURE_LIBRARY_BUTTON_NAME, | ||
takeEditorScreenshot, | ||
TopPanelButton, | ||
} from '@utils'; | ||
|
||
async function setDisplayStereoFlagsSettingToOn(page: Page) { | ||
await selectTopPanelButton(TopPanelButton.Settings, page); | ||
await page.getByText('Stereochemistry', { exact: true }).click(); | ||
await pressButton(page, 'IUPAC style'); | ||
await page.getByRole('option', { name: 'On' }).click(); | ||
await pressButton(page, 'Apply'); | ||
} | ||
|
||
async function switchIgnoreChiralFlagSetting(page: Page) { | ||
await selectTopPanelButton(TopPanelButton.Settings, page); | ||
await page.getByText('Stereochemistry', { exact: true }).click(); | ||
await page.getByText('Ignore the chiral flag').click(); | ||
await pressButton(page, 'Apply'); | ||
} | ||
|
||
async function placePhenylalanineMustard(page: Page, x: number, y: number) { | ||
await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME); | ||
const phenylalanineLocator = page.locator( | ||
`div[title*="Phenylalanine mustard"] > div`, | ||
); | ||
if ((await phenylalanineLocator.count()) === 0) { | ||
await page.getByText('Aromatics').click(); | ||
} | ||
await phenylalanineLocator.first().click(); | ||
await page.mouse.click(x, y); | ||
} | ||
|
||
test.describe('Templates - Template Library', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto(''); | ||
}); | ||
|
||
test.afterEach(async ({ page }) => { | ||
await resetCurrentTool(page); | ||
await takeEditorScreenshot(page); | ||
}); | ||
|
||
test.only('Template with chiral flag 0 with ignoreChiralFlag enabled/disabled', async ({ | ||
test('Template with chiral flag 0 with ignoreChiralFlag enabled/disabled', async ({ | ||
page, | ||
}) => { | ||
await selectTopPanelButton(TopPanelButton.Settings, page); | ||
await page.getByText('Stereochemistry', { exact: true }).click(); | ||
await page.getByLabel('Ignore the chiral flag').click(); | ||
// await pressButton(page, 'Labels Only'); | ||
// await page.getByRole('option', { name: color }).click(); | ||
// await pressButton(page, 'Apply'); | ||
const offsetX = 200; | ||
const { x, y } = await getCoordinatesOfTheMiddleOfTheScreen(page); | ||
|
||
await setDisplayStereoFlagsSettingToOn(page); | ||
|
||
await switchIgnoreChiralFlagSetting(page); | ||
await placePhenylalanineMustard(page, x - offsetX, y); | ||
|
||
await switchIgnoreChiralFlagSetting(page); | ||
await placePhenylalanineMustard(page, x + offsetX, y); | ||
}); | ||
}); |
Binary file added
BIN
+29.9 KB
...-with-chiral-flag-0-with-ignoreChiralFlag-enabled-disabled-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.