-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#2370 - erase tool for macromolecules editor #3217
Conversation
2a0faec
to
b42346a
Compare
await page.getByText('Tza').click(); | ||
|
||
// Create 4 peptides on canvas | ||
await page.mouse.click(300, 300); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should avoid using magic numbers
await page.getByText('Tza').click(); | ||
|
||
// Create 4 peptides on canvas | ||
await page.mouse.click(300, 300); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should avoid using magic numbers
await page.getByText('Tza').click(); | ||
|
||
// Create 4 peptides on canvas | ||
await page.mouse.click(300, 300); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should avoid using magic numbers
a440132
to
5e452d1
Compare
await bondTwoMonomers(page, peptide3, peptide4); | ||
|
||
await page.screenshot({ | ||
path: 'tests/Macromolecule-editor/screenshots/erase-tool.png', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose to use a function takeEditorScreenshot
. It automatically creates screenshot of canvas area and generates the screenshot name. (may be it requires some modification for Macromolecules)
Description: Rectangle Selection Tool | ||
*/ | ||
|
||
await turnOnMacromoleculesEditor(page); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is, most likely, supposed to be used in beforeEach
block as the tests are always for MacroMolecules
await page.mouse.click(500, 200); | ||
|
||
// Get 4 peptides locators | ||
const peptides = await page.getByText('Tza').locator('..'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i propose to create a separate function for making some structure and reuse it across tests. Then it will be simpler to replace it, once we have import from file feature
} | ||
|
||
export async function selectRectangleSelectionTool(page: Page) { | ||
const bondToolButton = page.locator(`button[title*="select-rectangle"]`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My proposal is to avoid using locators by title and use page.getByTestId
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All tools buttons are done in that way. Let's keep it in one style for now.
import { expect, Page } from '@playwright/test'; | ||
|
||
export async function turnOnMacromoleculesEditor(page: Page) { | ||
await expect(page.getByTestId('PolymerToggler')).toBeVisible(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose to maintain common style and use kebab-case for ids
@@ -51,6 +49,20 @@ export class CoreEditor { | |||
this.events.selectMonomer.add((monomer) => this.onSelectMonomer(monomer)); | |||
this.events.selectPreset.add((preset) => this.onSelectRNAPreset(preset)); | |||
this.events.selectTool.add((tool) => this.onSelectTool(tool)); | |||
const renderersEvents: ToolEventHandlerName[] = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move it to separate file. Most likely, we will have a lot of different events.
5e452d1
to
6bb4129
Compare
6bb4129
to
2d9f84e
Compare
- added an ability to add peptides on canvas and move by drag n drop
2d9f84e
to
0716c44
Compare
#2360 - "Select" tool - added select and erase tools - implemented DrawingEntitiesManager and RenderersManager which controls entities parameters changes and render - added rootDir to tsconfig of core package
0716c44
to
19b56df
Compare
Closes #2370
Closes #2360
How the feature works? / How did you fix the issue?
(Screenshots, videos, or GIFs, if applicable)
Check list
#1234 – issue name