-
Notifications
You must be signed in to change notification settings - Fork 87
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
base: fix-e2e-tests-for-authoring-react
Are you sure you want to change the base?
Fix authoring-react tests #4754
Conversation
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); |
There was a problem hiding this comment.
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.
scripts/core/superdesk-api.d.ts
Outdated
@@ -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']; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
SDESK-7430
link: superdesk/superdesk-ui-framework#913