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

Fix authoring-react tests #4754

Open
wants to merge 5 commits into
base: fix-e2e-tests-for-authoring-react
Choose a base branch
from

Conversation

dzonidoo
Copy link
Collaborator

await page.locator(s('authoring', 'field-slugline')).fill('story 2.1');
await page.locator(s('authoring-topbar', 'save')).click();
await expect(page.locator(s('authoring', 'field-slugline'))).toHaveValue('story 2.1');
await sleep(2000);
Copy link
Member

Choose a reason for hiding this comment

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

Do not use sleep in tests themselves. There is that hack where we do need sleep, but put it to a helper.

@@ -3657,6 +3659,8 @@ declare module 'superdesk-api' {
* (it will be rendered in different DOM locations depending if field is in header or content section)
*/
miniToolbar?: JSX.Element;
sectionClassNames?: IAuthoringSectionClassNames;
fieldId?: IAuthoringField['id'];
Copy link
Member

Choose a reason for hiding this comment

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

You shouldn't be adding properties to interfaces that are only used for testing. In this case, field ID is available in authoring-section-field.tsx - and is being used to add a data-test-id. This change should not be needed.

@@ -3657,6 +3659,8 @@ declare module 'superdesk-api' {
* (it will be rendered in different DOM locations depending if field is in header or content section)
*/
miniToolbar?: JSX.Element;
sectionClassNames?: IAuthoringSectionClassNames;
Copy link
Member

Choose a reason for hiding this comment

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

I was refactoring code and removed sectionClassNames completelly. You should not be adding it back.

@@ -78,55 +78,57 @@ export function getFieldContainer(options: IGetFieldContainerOptions) {

class HeaderLayout extends React.PureComponent<IEditorComponentContainerProps> {
render() {
const {miniToolbar} = this.props;
const {miniToolbar, sectionClassNames} = this.props;
Copy link
Member

Choose a reason for hiding this comment

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

revert changes that are adding sectionClassNames back (I removed it on purpose in develop)

@@ -40,7 +41,13 @@ test('correcting with unsaved changes', async ({page}) => {
s('monitoring-group=Sports desk output', 'article-item=test sports story'),
).dblclick({timeout: 10000}); // need to wait until published item appears in output

await page.locator(s('authoring', 'authoring-topbar')).getByLabel('Correct').click();
/*
* test-pr-TODO:
Copy link
Member

Choose a reason for hiding this comment

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

is this the one where you couldn't figure out how to solve this?


// button - cancel
await page.locator(s('unsaved-changes-dialog')).getByRole('button', {name: 'cancel'}).click();
await sleep(2000);
Copy link
Member

Choose a reason for hiding this comment

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

replace sleep statements with waiting for some element to appear/disappear

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants