Skip to content

Commit

Permalink
#3819 fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
StarlaStarla committed Feb 28, 2024
1 parent a4acb0a commit 18e6b4a
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { test } from '@playwright/test';
import {
takeEditorScreenshot,
waitForPageInit,
openFileAndAddToCanvas,
selectSequenceLayoutModeTool,
zoomWithMouseWheel,
scrollDown,
selectRectangleArea,
} from '@utils';
import { turnOnMacromoleculesEditor } from '@utils/macromolecules';

test.describe('Sequence Mode', () => {
test.beforeEach(async ({ page }) => {
await waitForPageInit(page);
await turnOnMacromoleculesEditor(page);
const ZOOM_OUT_VALUE = 400;
const SCROLL_DOWN_VALUE = 250;

await openFileAndAddToCanvas('KET/monomers-chains.ket', page);
await selectSequenceLayoutModeTool(page);
await zoomWithMouseWheel(page, ZOOM_OUT_VALUE);
await scrollDown(page, SCROLL_DOWN_VALUE);
});

test('Select letters with rectangular selection tool', async ({ page }) => {
// Coordinates for rectangle selection
const startX = 100;
const startY = 100;
const endX = 500;
const endY = 500;

await selectRectangleArea(page, startX, startY, endX, endY);
await takeEditorScreenshot(page);
});

test('Select letters with Shift+Lclick', async ({ page }) => {
await page.keyboard.down('Shift');
await page.getByText('G').first().click();
await page.getByText('T').first().click();
await page.keyboard.up('Shift');
await takeEditorScreenshot(page);
});

test('Select entire chain with Ctrl+Lclick', async ({ page }) => {
await page.keyboard.down('Control');
await page.getByText('G').first().click();
await page.keyboard.up('Control');
await takeEditorScreenshot(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.
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,21 @@ class SelectRectangle implements BaseTool {
let modelChanges: Command;
if (renderer instanceof BaseRenderer && !event.shiftKey && !event.ctrlKey) {
this.moveStarted = true;
const drawingEntities = [renderer.drawingEntity].concat(
this.editor.drawingEntitiesManager.getExtraEntitiesForSequenceViewClick(
renderer.drawingEntity,
false,
),
);
if (
renderer.drawingEntity.selected &&
!(this.editor.mode instanceof SequenceMode)
) {
return;
}
let drawingEntities = [renderer.drawingEntity];
if (this.editor.mode instanceof SequenceMode) {
drawingEntities = [renderer.drawingEntity].concat(
this.editor.drawingEntitiesManager.getExtraEntitiesForSequenceViewClick(
renderer.drawingEntity,
false,
),
);
}
modelChanges =
this.editor.drawingEntitiesManager.selectDrawingEntities(
drawingEntities,
Expand All @@ -124,11 +133,14 @@ class SelectRectangle implements BaseTool {
if (renderer.drawingEntity.selected) {
return;
}
const drawingEntities = [renderer.drawingEntity].concat(
this.editor.drawingEntitiesManager.getExtraEntitiesForSequenceViewClick(
renderer.drawingEntity,
),
);
let drawingEntities = [renderer.drawingEntity];
if (this.editor.mode instanceof SequenceMode) {
drawingEntities = [renderer.drawingEntity].concat(
this.editor.drawingEntitiesManager.getExtraEntitiesForSequenceViewClick(
renderer.drawingEntity,
),
);
}
modelChanges =
this.editor.drawingEntitiesManager.addDrawingEntitiesToSelection(
drawingEntities,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BaseRenderer } from 'application/render/renderers/internal';
import { D3SvgElementSelection } from 'application/render/types';
import { Vec2 } from 'domain/entities';
import { Vec2 } from 'domain/entities/vec2';

export class BaseSequenceRenderer extends BaseRenderer {
protected appendHover(
Expand Down

0 comments on commit 18e6b4a

Please sign in to comment.