From 01f54f7a69e5a7d0682a31781f4f024436e43c06 Mon Sep 17 00:00:00 2001 From: hamed musallam Date: Mon, 11 Nov 2024 13:02:59 +0100 Subject: [PATCH] test: copy/past should work for Firefox and Chrome --- .../MoleculesPanel/MoleculePanelHeader.tsx | 1 + test-e2e/panels/structures.test.ts | 18 +++++++----------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/component/panels/MoleculesPanel/MoleculePanelHeader.tsx b/src/component/panels/MoleculesPanel/MoleculePanelHeader.tsx index 212fb1cd0..e1a85a8ed 100644 --- a/src/component/panels/MoleculesPanel/MoleculePanelHeader.tsx +++ b/src/component/panels/MoleculesPanel/MoleculePanelHeader.tsx @@ -239,6 +239,7 @@ export default function MoleculePanelHeader({ disabled={!hasMolecules} tooltip="Export As" icon={} + id="molecule-export-as" /> { nmrium.getToolbarLocatorByTitle('Float molecule', { active: true }), ).toBeVisible(); }); - if (browserName === 'chromium') { + if (browserName !== 'webkit') { await test.step('Check copy as molfile V3 or V2 and paste', async () => { await clickExportMenuOption(nmrium, 'text=Copy as molfile V3'); - - // Paste the molecule (not working on Firefox). await nmrium.clickToolByTitle('Paste molfile'); await clickExportMenuOption(nmrium, 'text=Copy as molfile V2'); - - // Paste the molecule (not working on Firefox). await nmrium.clickToolByTitle('Paste molfile'); await expect( @@ -464,7 +460,7 @@ test('molecules 1H spectrum', async ({ page, browserName }) => { await expect(nmrium.page.locator('#molSVG')).toBeHidden(); // Check selected molecule. - if (browserName === 'chromium') { + if (browserName !== 'webkit') { await expect( nmrium.page.locator('_react=MoleculePanel >> text=1 / 3'), ).toBeVisible(); @@ -485,7 +481,7 @@ test('molecules 1H spectrum', async ({ page, browserName }) => { await nmrium.page.click('_react=Arrow[direction="right"]'); // Check the second molecule. - if (browserName === 'chromium') { + if (browserName !== 'webkit') { await expect( nmrium.page.locator('_react=MoleculePanel >> text=2 / 3'), ).toBeVisible(); @@ -504,7 +500,7 @@ test('molecules 1H spectrum', async ({ page, browserName }) => { await nmrium.clickToolByTitle('Delete molecule'); // Check selected molecule. - if (browserName === 'chromium') { + if (browserName !== 'webkit') { await expect( nmrium.page.locator('_react=MoleculePanel >> text=1 / 2'), ).toBeVisible(); @@ -523,7 +519,7 @@ test('molecules 1H spectrum', async ({ page, browserName }) => { await test.step('Empty panel', async () => { // Check selected molecule. - if (browserName === 'chromium') { + if (browserName !== 'webkit') { await expect( nmrium.page.locator('_react=MoleculePanel >> text=1 / 2'), ).toBeVisible(); @@ -537,7 +533,7 @@ test('molecules 1H spectrum', async ({ page, browserName }) => { // Delete molecule. await nmrium.clickToolByTitle('Delete molecule'); - if (browserName === 'chromium') { + if (browserName !== 'webkit') { // Delete molecule. await nmrium.clickToolByTitle('Delete molecule'); } @@ -659,7 +655,7 @@ test('check callbacks count on changing structures', async ({ page }) => { async function clickExportMenuOption(nmrium: NmriumPage, selector: string) { await nmrium.page.click( - '_react=MoleculePanelHeader >> _react=ToolbarItem[tooltip="export as" i]', + '_react=MoleculePanelHeader >> button[id="molecule-export-as"]', ); await nmrium.page.click(selector); }