-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Updating tests for migration to a new version of antd #3623
Updating tests for migration to a new version of antd #3623
Conversation
…into dkru/fix-tests-migrating-antd-origin
…o dkru/fix-tests-migrating-antd-origin
@bsekachev |
@@ -23,19 +23,15 @@ export default function withVisibilityHandling(WrappedComponent: typeof Popover, | |||
{...rest} | |||
trigger={visible ? 'click' : 'hover'} | |||
overlayClassName={overlayClassNames.join(' ').trim()} | |||
afterVisibleChange={(_visible: boolean) => { |
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.
We use afterVisibleChange
, but it is not a part of antd API, so it can be changed in the future.
What is more, as I found, afterVisibleChange does not guarantee that the popover does not have pointer-events: none
and it is triggered several times. .
So, maybe current implementation with (waitFor) is better.
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.
Returned.
tests/cypress/support/commands.js
Outdated
@@ -242,7 +242,11 @@ Cypress.Commands.add('openTaskJob', (taskName, jobID = 0, removeAnnotations = tr | |||
|
|||
Cypress.Commands.add('interactControlButton', (objectType) => { | |||
cy.get('body').focus(); | |||
cy.get(`.cvat-${objectType}-control`).trigger('mouseleave').trigger('mouseout').trigger('mouseover'); | |||
cy.get(`.cvat-${objectType}-control`).trigger('mouseleave').trigger('mouseout').trigger('mousemove').trigger('mouseover'); | |||
cy.get(`.cvat-${objectType}-control`).should('have.class', 'ant-popover-open'); |
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.
Can we avoid using ant-*
classes?
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 thought to use this as an additional check. But it works without it. Deleted it.
@@ -33,6 +41,9 @@ Cypress.Commands.add('opencvCreateShape', (opencvShapeParams) => { | |||
}); | |||
|
|||
Cypress.Commands.add('opncvCheckObjectParameters', (objectType) => { |
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.
Cypress.Commands.add('opncvCheckObjectParameters', (objectType) => { | |
Cypress.Commands.add('opencvCheckObjectParameters', (objectType) => { |
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.
Fixed.
Cypress.Commands.add('interactOpenCVControlButton', () => { | ||
cy.get('body').focus(); | ||
cy.get('.cvat-tools-control').trigger('mouseleave').trigger('mouseout').trigger('mousemove').trigger('mouseover'); | ||
cy.get('.cvat-tools-control').should('have.class', 'ant-popover-open'); | ||
cy.get('.cvat-opencv-control-popover-visible').should('exist'); | ||
cy.get('.cvat-opencv-control-popover-visible').should('be.visible'); | ||
cy.get('.cvat-opencv-control-popover-visible').should('have.attr', 'style').and('not.include', 'pointer-events'); | ||
}); | ||
|
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.
Why not to use cy.interactControlButton
?
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.
In this case, need to either heavily rework the command, or rename the classes. I think it's easier to create a separate command for this.
tests/cypress/support/commands.js
Outdated
cy.get(`.cvat-draw-${objectType.toLowerCase()}-popover-visible`).should('not.exist'); | ||
cy.get(`.cvat-draw-${objectType.toLowerCase()}-popover`).should('be.hidden'); | ||
cy.get(`.cvat-draw-${objectType.toLowerCase()}-popover`).should('have.attr', 'style').and('include', 'pointer-events: none'); |
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.
These actions are not expected to be in command with name checkObjectParameters
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.
Moved it to a separate command.
cy.get('.cvat-draw-cuboid-popover-visible').should('not.exist'); | ||
cy.get('.cvat-draw-cuboid-popover').should('be.hidden'); |
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 am not sure we should test that the popovers are closed now.
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.
Without this check, there is a high probability of getting error AssertionError: Timed out retrying after 25000ms: Expected to find element: `.*-popover-visible`, but never found it.
cy.get('.cvat-opencv-control-popover-visible').should('not.exist'); | ||
cy.get('.cvat-opencv-control-popover').should('be.hidden'); | ||
cy.get('.cvat-opencv-control-popover').should('have.attr', 'style').and('include', 'pointer-events: none'); |
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 am not sure we should test that the popovers are closed now.
At least check for pointer-events
seems to be extra.
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.
Without this check, there is a high probability of getting error AssertionError: Timed out retrying after 25000ms: Expected to find element: `.*-popover-visible`, but never found it.
Removed heck for pointer-events
.
…o dkru/fix-tests-migrating-antd-origin
17eef1b
to
821bce4
Compare
@dvkruchinin , could you please fix the conflict? @ActiveChooN , could you please review ASAP? |
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.
LGTM
…o dkru/fix-tests-migrating-antd
Сonflicts have been fixed. |
@dvkruchinin , could you please look at the failed test? |
Yes. I'm doing it now. |
b351454
to
ea7b45f
Compare
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.
LGTM
@@ -31,6 +31,7 @@ module.exports = (env) => ({ | |||
host: process.env.CVAT_UI_HOST || 'localhost', | |||
port: 3000, | |||
historyApiFallback: true, | |||
host: process.env.CVAT_UI_HOST || 'localhost', |
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.
@dvkruchinin , do we need the line two times?
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.
Unfortunately, I am not the author of this change.
@ActiveChooN
Can you please tell if it should be like this? If not, I will delete the extra line.
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.
OK. I will merge to unblock the PR. Thanks.
This reverts commit 1ecb44a.
…3694) * Revert "Revert "Updating tests for migration to a new version of antd (#3623)"" This reverts commit 0fd8b5d. * Fixed issue with annotations uploading * Fixed menu on annotation page * Tried to fix: Cannot read property nodeType of null * Updated deps * Fixed a couple of issues in menu * Fixed import after updating antd * Update cvat-ui/webpack.config.js Co-authored-by: Dmitry Kalinin <[email protected]> Co-authored-by: Dmitry Kalinin <[email protected]>
Depends on #3558
Motivation and context
Additional test update.
How has this been tested?
Checklist
develop
branchcvat-core, cvat-data and cvat-ui)
License
Feel free to contact the maintainers if that's a concern.