Skip to content

Commit

Permalink
#3531 – fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nitvex committed Dec 4, 2023
1 parent da42b41 commit a3e74d9
Show file tree
Hide file tree
Showing 9 changed files with 748 additions and 118 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
import { Page, test, expect } from '@playwright/test';
import {
Bases,
DropDown,
Phosphates,
Sugars,
addMonomerToCenterOfCanvas,
Expand Down Expand Up @@ -44,11 +43,11 @@ async function drawThreeMonomers(page: Page) {
const y = 350;
const x1 = 650;
const y1 = 150;
await selectMonomer(DropDown.SugarsDropDown, Sugars.ThreeA6, page);
await selectMonomer(page, Sugars.ThreeA6);
await clickInTheMiddleOfTheScreen(page);
await selectMonomer(DropDown.BasesDropDown, Bases.NBebnzylAdenine, page);
await selectMonomer(page, Bases.NBebnzylAdenine);
await page.mouse.click(x, y);
await selectMonomer(DropDown.PhosphatesDropDown, Phosphates.Phosphate, page);
await selectMonomer(page, Phosphates.Phosphate);
await page.mouse.click(x1, y1);
}

Expand Down Expand Up @@ -78,9 +77,9 @@ async function drawBasePhosphate(page: Page) {
const base1 = bases.nth(0);
const phosphates = await page.getByText('P').locator('..');
const phosphate1 = phosphates.nth(0);
await selectMonomer(DropDown.BasesDropDown, Bases.NBebnzylAdenine, page);
await selectMonomer(page, Bases.NBebnzylAdenine);
await clickInTheMiddleOfTheScreen(page);
await selectMonomer(DropDown.PhosphatesDropDown, Phosphates.Phosphate, page);
await selectMonomer(page, Phosphates.Phosphate);
await page.mouse.click(x, y);
await selectSingleBondTool(page);
await base1.hover();
Expand All @@ -98,9 +97,9 @@ async function drawSugarPhosphate(page: Page) {
const sugar1 = sugars.nth(0);
const phosphates = await page.getByText('P').locator('..');
const phosphate1 = phosphates.nth(0);
await selectMonomer(DropDown.SugarsDropDown, Sugars.ThreeA6, page);
await selectMonomer(page, Sugars.ThreeA6);
await clickInTheMiddleOfTheScreen(page);
await selectMonomer(DropDown.PhosphatesDropDown, Phosphates.Phosphate, page);
await selectMonomer(page, Phosphates.Phosphate);
await page.mouse.click(x, y);
await selectSingleBondTool(page);
await sugar1.hover();
Expand All @@ -116,9 +115,9 @@ async function drawSugarBase(page: Page) {
const sugar1 = sugars.nth(0);
const bases = await page.getByText('baA').locator('..');
const base1 = bases.nth(0);
await selectMonomer(DropDown.SugarsDropDown, Sugars.ThreeA6, page);
await selectMonomer(page, Sugars.ThreeA6);
await clickInTheMiddleOfTheScreen(page);
await selectMonomer(DropDown.BasesDropDown, Bases.NBebnzylAdenine, page);
await selectMonomer(page, Bases.NBebnzylAdenine);
await page.mouse.click(x, y);
await selectSingleBondTool(page);
await sugar1.hover();
Expand Down Expand Up @@ -216,11 +215,7 @@ test.describe('RNA Library', () => {
Description: The selected sugar monomer should be added to the canvas
in the form of a square with rounded edges and in the corresponding color.
*/
await addMonomerToCenterOfCanvas(
DropDown.SugarsDropDown,
Sugars.TwelveddR,
page,
);
await addMonomerToCenterOfCanvas(page, Sugars.TwelveddR);
await takeEditorScreenshot(page);
});

Expand All @@ -230,11 +225,7 @@ test.describe('RNA Library', () => {
Description: The selected base monomer should be added to the canvas
in the form of a rhombus and in the corresponding color.
*/
await addMonomerToCenterOfCanvas(
DropDown.BasesDropDown,
Bases.Adenine,
page,
);
await addMonomerToCenterOfCanvas(page, Bases.Adenine);
await takeEditorScreenshot(page);
});

Expand All @@ -244,11 +235,7 @@ test.describe('RNA Library', () => {
Description: The selected phosphate monomer should be added to the canvas
in the form of a circle and in the corresponding color.
*/
await addMonomerToCenterOfCanvas(
DropDown.PhosphatesDropDown,
Phosphates.Test6Ph,
page,
);
await addMonomerToCenterOfCanvas(page, Phosphates.Test6Ph);
await takeEditorScreenshot(page);
});

Expand All @@ -259,11 +246,7 @@ test.describe('RNA Library', () => {
in the form of a square with rounded edges and in the corresponding color.
When hover over monomer window with preview appears.
*/
await addMonomerToCenterOfCanvas(
DropDown.SugarsDropDown,
Sugars.TwelveddR,
page,
);
await addMonomerToCenterOfCanvas(page, Sugars.TwelveddR);
await page.getByText('12ddR').locator('..').first().hover();
await takeEditorScreenshot(page);
});
Expand All @@ -275,11 +258,7 @@ test.describe('RNA Library', () => {
in the form of a rhombus and in the corresponding color.
When hover over monomer window with preview appears.
*/
await addMonomerToCenterOfCanvas(
DropDown.BasesDropDown,
Bases.TClampOMe,
page,
);
await addMonomerToCenterOfCanvas(page, Bases.TClampOMe);
await page.getByText('clA').locator('..').first().hover();
await takeEditorScreenshot(page);
});
Expand All @@ -291,11 +270,7 @@ test.describe('RNA Library', () => {
in the form of a circle and in the corresponding color.
When hover over monomer window with preview appears.
*/
await addMonomerToCenterOfCanvas(
DropDown.PhosphatesDropDown,
Phosphates.Test6Ph,
page,
);
await addMonomerToCenterOfCanvas(page, Phosphates.Test6Ph);
await page.getByText('Test-6-Ph').locator('..').first().hover();
await takeEditorScreenshot(page);
});
Expand All @@ -306,9 +281,9 @@ test.describe('RNA Library', () => {
Description: Custom presets added to Presets section.
*/
await expandRnaBuilder(page);
await selectMonomer(DropDown.SugarsDropDown, Sugars.TwelveddR, page);
await selectMonomer(DropDown.BasesDropDown, Bases.Adenine, page);
await selectMonomer(DropDown.PhosphatesDropDown, Phosphates.Test6Ph, page);
await selectMonomer(page, Sugars.TwelveddR);
await selectMonomer(page, Bases.Adenine);
await selectMonomer(page, Phosphates.Test6Ph);
await page.getByTestId('add-to-presets-btn').click();
await page.getByTestId('12ddR(A)Test-6-Ph_A_12ddR_Test-6-Ph').click();
await takePresetsScreenshot(page);
Expand All @@ -320,13 +295,9 @@ test.describe('RNA Library', () => {
Description: Custom presets added to Canvas.
*/
await expandRnaBuilder(page);
await selectMonomer(DropDown.SugarsDropDown, Sugars.ThreeA6, page);
await selectMonomer(DropDown.BasesDropDown, Bases.NBebnzylAdenine, page);
await selectMonomer(
DropDown.PhosphatesDropDown,
Phosphates.Boranophosphate,
page,
);
await selectMonomer(page, Sugars.ThreeA6);
await selectMonomer(page, Bases.NBebnzylAdenine);
await selectMonomer(page, Phosphates.Boranophosphate);
await page.getByTestId('add-to-presets-btn').click();
await page.getByTestId('3A6(baA)bP_baA_3A6_bP').click();
await clickInTheMiddleOfTheScreen(page);
Expand All @@ -342,8 +313,8 @@ test.describe('RNA Library', () => {
Description: Custom presets added to Presets section.
*/
await expandRnaBuilder(page);
await selectMonomer(DropDown.SugarsDropDown, Sugars.TwelveddR, page);
await selectMonomer(DropDown.BasesDropDown, Bases.Adenine, page);
await selectMonomer(page, Sugars.TwelveddR);
await selectMonomer(page, Bases.Adenine);
await page.getByTestId('add-to-presets-btn').click();
await page.getByTestId('12ddR(A)_A_12ddR_.').click();
await clickInTheMiddleOfTheScreen(page);
Expand All @@ -358,12 +329,8 @@ test.describe('RNA Library', () => {
Description: Custom presets added to Presets section.
*/
await expandRnaBuilder(page);
await selectMonomer(DropDown.SugarsDropDown, Sugars.TwelveddR, page);
await selectMonomer(
DropDown.PhosphatesDropDown,
Phosphates.Boranophosphate,
page,
);
await selectMonomer(page, Sugars.TwelveddR);
await selectMonomer(page, Phosphates.Boranophosphate);
await page.getByTestId('add-to-presets-btn').click();
await page.getByTestId('12ddR()bP_._12ddR_bP').click();
await takePresetsScreenshot(page);
Expand All @@ -377,12 +344,8 @@ test.describe('RNA Library', () => {
Description: Custom presets added to Presets section.
*/
await expandRnaBuilder(page);
await selectMonomer(DropDown.BasesDropDown, Bases.Adenine, page);
await selectMonomer(
DropDown.PhosphatesDropDown,
Phosphates.Boranophosphate,
page,
);
await selectMonomer(page, Bases.Adenine);
await selectMonomer(page, Phosphates.Boranophosphate);
await page.getByTestId('add-to-presets-btn').click();
await page.getByTestId('(A)bP_A_._bP').click();
await takePresetsScreenshot(page);
Expand All @@ -394,9 +357,9 @@ test.describe('RNA Library', () => {
Description: Custom presets added to Presets section and can be edited.
*/
await expandRnaBuilder(page);
await selectMonomer(DropDown.SugarsDropDown, Sugars.TwelveddR, page);
await selectMonomer(DropDown.BasesDropDown, Bases.Adenine, page);
await selectMonomer(DropDown.PhosphatesDropDown, Phosphates.Test6Ph, page);
await selectMonomer(page, Sugars.TwelveddR);
await selectMonomer(page, Bases.Adenine);
await selectMonomer(page, Phosphates.Test6Ph);
await page.getByTestId('add-to-presets-btn').click();
await page.getByTestId('12ddR(A)Test-6-Ph_A_12ddR_Test-6-Ph').click({
button: 'right',
Expand All @@ -418,9 +381,9 @@ test.describe('RNA Library', () => {
Description: Custom presets added to Presets section then can be duplicated and edited.
*/
await expandRnaBuilder(page);
await selectMonomer(DropDown.SugarsDropDown, Sugars.TwelveddR, page);
await selectMonomer(DropDown.BasesDropDown, Bases.Adenine, page);
await selectMonomer(DropDown.PhosphatesDropDown, Phosphates.Test6Ph, page);
await selectMonomer(page, Sugars.TwelveddR);
await selectMonomer(page, Bases.Adenine);
await selectMonomer(page, Phosphates.Test6Ph);
await page.getByTestId('add-to-presets-btn').click();
await page.getByTestId('12ddR(A)Test-6-Ph_A_12ddR_Test-6-Ph').click({
button: 'right',
Expand All @@ -444,14 +407,14 @@ test.describe('RNA Library', () => {
Test working incorrect because we have bug: https://github.com/epam/ketcher/issues/3561
*/
await expandRnaBuilder(page);
await selectMonomer(DropDown.SugarsDropDown, Sugars.TwelveddR, page);
await selectMonomer(DropDown.BasesDropDown, Bases.Adenine, page);
await selectMonomer(DropDown.PhosphatesDropDown, Phosphates.Test6Ph, page);
await selectMonomer(page, Sugars.TwelveddR);
await selectMonomer(page, Bases.Adenine);
await selectMonomer(page, Phosphates.Test6Ph);
await page.getByTestId('add-to-presets-btn').click();
await page.getByTestId('12ddR(A)Test-6-Ph_A_12ddR_Test-6-Ph').click({
button: 'right',
});
await page.getByTestId('deletepreset').locator('div').click();
await page.getByTestId('deletepreset').click();
await page.getByRole('button', { name: 'Delete' }).click();
await takePresetsScreenshot(page);
});
Expand All @@ -462,13 +425,9 @@ test.describe('RNA Library', () => {
Description: Custom presets added to Presets section and can be renamed.
*/
await expandRnaBuilder(page);
await selectMonomer(DropDown.SugarsDropDown, Sugars.TwentyFiveR, page);
await selectMonomer(DropDown.BasesDropDown, Bases.NBebnzylAdenine, page);
await selectMonomer(
DropDown.PhosphatesDropDown,
Phosphates.Boranophosphate,
page,
);
await selectMonomer(page, Sugars.TwentyFiveR);
await selectMonomer(page, Bases.NBebnzylAdenine);
await selectMonomer(page, Phosphates.Boranophosphate);
await page.getByTestId('add-to-presets-btn').click();
await page.getByTestId('25R(baA)bP_baA_25R_bP').click({
button: 'right',
Expand Down Expand Up @@ -545,8 +504,8 @@ test.describe('RNA Library', () => {
Description: Sugar-Base Combination added to Canvas.
*/
await expandRnaBuilder(page);
await selectMonomer(DropDown.SugarsDropDown, Sugars.ThreeA6, page);
await selectMonomer(DropDown.BasesDropDown, Bases.NBebnzylAdenine, page);
await selectMonomer(page, Sugars.ThreeA6);
await selectMonomer(page, Bases.NBebnzylAdenine);
await page.getByTestId('add-to-presets-btn').click();
await page.getByTestId('3A6(baA)_baA_3A6_.').click();
await clickInTheMiddleOfTheScreen(page);
Expand All @@ -560,12 +519,8 @@ test.describe('RNA Library', () => {
Description: Sugar-Phosphate Combination added to Canvas.
*/
await expandRnaBuilder(page);
await selectMonomer(DropDown.SugarsDropDown, Sugars.ThreeA6, page);
await selectMonomer(
DropDown.PhosphatesDropDown,
Phosphates.Boranophosphate,
page,
);
await selectMonomer(page, Sugars.ThreeA6);
await selectMonomer(page, Phosphates.Boranophosphate);
await page.getByTestId('add-to-presets-btn').click();
await page.getByTestId('3A6()bP_._3A6_bP').click();
await clickInTheMiddleOfTheScreen(page);
Expand All @@ -579,12 +534,8 @@ test.describe('RNA Library', () => {
Description: Base-Phosphate Combination not added to Canvas.
*/
await expandRnaBuilder(page);
await selectMonomer(DropDown.BasesDropDown, Bases.NBebnzylAdenine, page);
await selectMonomer(
DropDown.PhosphatesDropDown,
Phosphates.Boranophosphate,
page,
);
await selectMonomer(page, Bases.NBebnzylAdenine);
await selectMonomer(page, Phosphates.Boranophosphate);
await page.getByTestId('add-to-presets-btn').click();
await page.getByTestId('(baA)bP_baA_._bP').click();
await moveMouseToTheMiddleOfTheScreen(page);
Expand Down Expand Up @@ -776,11 +727,7 @@ test.describe('RNA Library', () => {
Description: Bond does not remain on the canvas and returns to original position.
Test working incorrect now because we have bug https://github.com/epam/ketcher/issues/3539
*/
await addMonomerToCenterOfCanvas(
DropDown.SugarsDropDown,
Sugars.TwentyFiveR,
page,
);
await addMonomerToCenterOfCanvas(page, Sugars.TwentyFiveR);
await selectSingleBondTool(page);
await page.getByText('25R').locator('..').first().click();
await pressEscapeWhenPullBond(page);
Expand Down
Loading

0 comments on commit a3e74d9

Please sign in to comment.