Skip to content
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

Port embed test to playwright #4440

Merged
merged 20 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions e2e/client/playwright/authoring.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,3 @@ test('can apply "populate abstract" macro', async ({page}) => {
page.locator(s('authoring', 'authoring-field=abstract')).getByRole('textbox'),
).toHaveText('test sport story body');
});

test('can embed if url is valid', async ({page}) => {
await restoreDatabaseSnapshot();

const monitoring = new Monitoring(page);

await page.goto('/#/workspace/monitoring');

await monitoring.selectDesk('Sports');

await page.locator(
s('monitoring-group=Sports / Working Stage', 'article-item=test sports story'),
).dblclick();

await expect(
page.locator(s('authoring', 'authoring-field=body_html')).getByRole('textbox'),
).toHaveText('test sport story body');

await page.locator(s('Embed')).getByRole('button').click();

await page.getByPlaceholder('Enter URL or code to embed').type('https://google.com');

await page.locator(s('embed-controls', 'submit')).click();
await expect(page.getByText('https://google.com')).toBeDefined();
});
28 changes: 28 additions & 0 deletions e2e/client/playwright/editor3.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import {test, expect} from '@playwright/test';
import {Monitoring} from './page-object-models/monitoring';
import {restoreDatabaseSnapshot, s} from './utils';

test('can add embeds', async ({page}) => {
await restoreDatabaseSnapshot();

const monitoring = new Monitoring(page);

await page.goto('/#/workspace/monitoring');

await monitoring.selectDesk('Sports');

await page.locator(
s('monitoring-group=Sports / Working Stage', 'article-item=test sports story'),
).dblclick();

await expect(
page.locator(s('authoring', 'authoring-field=body_html')).getByRole('textbox'),
).toHaveText('test sport story body');

await page.getByRole('button', {name: 'Embed'}).click();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use a more specific selector


await page.getByPlaceholder('Enter URL or code to embed').type('https://sourcefabric.org');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use a more specific selector


await page.locator(s('embed-controls', 'submit')).click();
await expect(page.getByText('https://sourcefabric.org')).toBeDefined();
tomaskikutis marked this conversation as resolved.
Show resolved Hide resolved
});
3 changes: 2 additions & 1 deletion scripts/core/editor3/components/toolbar/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ interface IProps {
export const IconButton: React.FunctionComponent<IProps> = ({onClick, iconName, tooltip, uiTheme}) => (
<div
data-flow={'down'}
data-test-id={tooltip}
data-test-id="icon-button"
data-test-value={tooltip}
tomaskikutis marked this conversation as resolved.
Show resolved Hide resolved
data-sd-tooltip={tooltip}
className="Editor3-styleButton"
style={uiTheme == null ? undefined : {color: uiTheme.textColor}}
Expand Down