Skip to content

Commit

Permalink
test: copy/past should work for Firefox and Chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
hamed-musallam committed Nov 11, 2024
1 parent 4e846d1 commit 01f54f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ export default function MoleculePanelHeader({
disabled={!hasMolecules}
tooltip="Export As"
icon={<FaFileExport />}
id="molecule-export-as"
/>

<Toolbar.Item
Expand Down
18 changes: 7 additions & 11 deletions test-e2e/panels/structures.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,15 +421,11 @@ test('molecules 1H spectrum', async ({ page, browserName }) => {
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(
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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');
}
Expand Down Expand Up @@ -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);
}

0 comments on commit 01f54f7

Please sign in to comment.