Skip to content

Commit

Permalink
Autotests: #3400 - Toolbar (#3403)
Browse files Browse the repository at this point in the history
* - added 5 tests to 'toolbar-ui';
- added expected snapshots;

* - deleted 'delay'

* - added 'waitForPageInit'

* - updated snapshots
  • Loading branch information
Zhirnoff committed Oct 6, 2023
1 parent b22adf3 commit 80e891e
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import {
openDropdown,
selectDropdownTool,
takeLeftToolbarScreenshot,
waitForPageInit,
} from '@utils';

test.describe('Left toolbar UI tests', () => {
test.beforeEach(async ({ page }) => {
await page.goto('');
await waitForPageInit(page);
});

test('left toolbar ui verification', async ({ page }) => {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
84 changes: 81 additions & 3 deletions ketcher-autotests/tests/User-Interface/Toolbar/toolbar-ui.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ import {
FunctionalGroups,
clickInTheMiddleOfTheScreen,
selectFunctionalGroups,
DELAY_IN_SECONDS,
delay,
resetCurrentTool,
selectLeftPanelButton,
LeftPanelButton,
waitForPageInit,
takeRightToolbarScreenshot,
drawBenzeneRing,
selectDropdownTool,
clickOnAtom,
waitForRender,
selectAtomInToolbar,
AtomButton,
} from '@utils';

test.describe('Open Ketcher', () => {
Expand All @@ -33,7 +38,6 @@ test.describe('Open Ketcher', () => {
Description: Help button tooltip verification
*/
await page.getByTitle('Help (?)').first().hover();
await delay(DELAY_IN_SECONDS.THREE);
await takeTopToolbarScreenshot(page);
await takeEditorScreenshot(page);
});
Expand Down Expand Up @@ -89,4 +93,78 @@ test.describe('Open Ketcher', () => {
await page.setViewportSize({ width: 560, height: 380 });
await expect(page).toHaveScreenshot();
});

test('The scroll row button of the right toolbar works correctly when Resolution is set to less than 600x600', async ({
page,
browser,
}) => {
/*
Test case: EPMLSOPKET - 4732
Description: After clicking on the down row button on the right toolbar to scroll -> the tools should be scrolled to down
*/
await browser.newContext({ deviceScaleFactor: 1.25 });
await waitForPageInit(page);
await page.setViewportSize({ width: 500, height: 500 });
await page
.getByTestId('right-toolbar')
.getByRole('button', { name: '▼' })
.click();
await takeRightToolbarScreenshot(page);
});

test('Keyboard shortcut not change current tool if cursor is over an atom', async ({
page,
}) => {
/*
Test case: EPMLSOPKET - 5257
Description:
Iodine tool is applied
Single bond tool kept selected and applied on further mouse clicks
*/
const anyAtom = 2;
const secondAtom = 4;
await drawBenzeneRing(page);
await selectDropdownTool(page, 'bonds', 'bond-single');
await clickOnAtom(page, 'C', anyAtom);
await waitForRender(page, async () => {
await page.keyboard.press('n');
});
await clickOnAtom(page, 'C', secondAtom);
});

test('Highlight currently selected tool with mouse cursor and toolbox icons', async ({
page,
}) => {
/*
Test case: EPMLSOPKET - 5258
Description:
Atom tool icon 'F' is highlighted in the right-hand panel
*/
await selectAtomInToolbar(AtomButton.Fluorine, page);
await takeRightToolbarScreenshot(page);
});

test('Check top toolbar icons', async ({ page }) => {
/*
Test case: EPMLSOPKET - 15545
Description:
Top toolbar according to mockup design.
*/
await takeTopToolbarScreenshot(page);
});

test('[Shift+Tab] Switches Selection Mode', async ({ page }) => {
/**
* Test case: EPMLSOPKET - 18057
* Description:
* Shortcut should switch modes of the selection tool (lasso, rectangle, structure selection)
*/

const repeats = 2;

for (let i = 0; i < repeats; i++) {
await page.keyboard.press('Shift+Tab');
await takeLeftToolbarScreenshot(page);
}
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 80e891e

Please sign in to comment.