-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add end-to-end deregistration tests for Host Details page #1649
Conversation
@@ -355,4 +355,41 @@ context('Host Details', () => { | |||
cy.get('span').find('svg').should('exist'); | |||
}); | |||
}); | |||
|
|||
describe('Deregistration', () => { | |||
describe('"Clean up" button should be visible only for an unhealthy host', () => { |
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.
Similar tests for the visibility of the Clean up button are also already tested in the React component tests (see HostDetails.test.jsx) Do you think they are necessary in end-to-end too?
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.
Yes, let's have them!
}); | ||
|
||
it('should allow to deregister a host after clean-up confirmation', () => { | ||
cy.contains('button', 'Clean up', { timeout: 15000 }).click(); |
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.
The value of timeout
depends on Elixir environment variable config :trento, deregistration_debounce
. These timeouts are also present in the Hosts List tests for the same reason. Could we abstract this to an environment variable somehow?
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.
@jamie-suse I see that we use a totally different way compared with the HostList view. I think we should be consistent, and after the other is merged, follow the same logic.
@rtorrero Could you assist on this? And review as you have the best insights!
@@ -355,4 +355,41 @@ context('Host Details', () => { | |||
cy.get('span').find('svg').should('exist'); | |||
}); | |||
}); | |||
|
|||
describe('Deregistration', () => { | |||
describe('"Clean up" button should be visible only for an unhealthy host', () => { |
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.
Yes, let's have them!
describe('"Clean up" button should be visible only for an unhealthy host', () => { | ||
it('should not display the "Clean up" button for healthy host', () => { | ||
cy.task('startAgentHeartbeat', [selectedHost.id]); | ||
cy.contains('button', 'Clean up').should('not.exist'); |
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.
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 actually preferred this one too, but when I tried it for the confirmation dialog (which also has the text Clean up
) it would get only the button from the table and not the one in the modal. If you find a way for this to work in all cases, this would be preferred but otherwise I'd keep the other approach.
cy.get('@modal').contains('button', 'Clean up').click(); | ||
|
||
cy.get('@modal').should('not.exist'); | ||
cy.url().should('eq', cy.config().baseUrl + '/hosts'); |
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 should check that the row in the host list view for this host goes away
e0ac49f
to
101ff08
Compare
it('should allow to deregister a host after clean-up confirmation', () => { | ||
cy.contains('button', 'Clean up', { timeout: 15000 }).click(); | ||
|
||
cy.get('#headlessui-portal-root').as('modal'); |
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.
Regarding my previous comment: I think this is how you solved the contains
getting the Clean up
button from the modal. If that's so, then I'm up for it. I'll create a tech debt to update the other deregistration e2e tests.
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 now @jamie-suse , thanks!
Description
Adds end-to-end deregistration tests for the Host Details page.
How was this tested?
By adding end-to-end deregistration tests for the Host Details page.