-
Notifications
You must be signed in to change notification settings - Fork 367
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
test: [M3-7124] - Add Cypress integration tests for VPC assign/unassign flows #9818
Conversation
cy.visitWithLogin('/linodes'); | ||
cy.wait(['@getFeatureFlags', '@getClientStream']); | ||
|
||
ui.nav.findItemByTitle('VPC').should('be.visible').click(); | ||
cy.wait('@getVPCs'); | ||
|
||
cy.url().should('endWith', '/vpcs'); | ||
|
||
cy.visitWithLogin(`/vpcs/${mockVPC.id}`); | ||
cy.wait(['@getVPC', '@getSubnets']); |
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 we have to navigate to the VPCs page manually? We might be able to save some time by navigating to /vpcs/${mockVPC.id}
directly (I didn't test though!)
cy.visitWithLogin('/linodes'); | |
cy.wait(['@getFeatureFlags', '@getClientStream']); | |
ui.nav.findItemByTitle('VPC').should('be.visible').click(); | |
cy.wait('@getVPCs'); | |
cy.url().should('endWith', '/vpcs'); | |
cy.visitWithLogin(`/vpcs/${mockVPC.id}`); | |
cy.wait(['@getVPC', '@getSubnets']); | |
cy.visitWithLogin(`/vpcs/${mockVPC.id}`); | |
cy.wait(['@getFeatureFlags', '@getClientStream', '@getVPC', '@getSubnets']); |
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.
Thanks @cliu-akamai, this looks great!
When there are multiple Linodes in the select list, users type the label to select one of them, then it will deselect all when users type another label and select it.
I'm seeing this too -- I'm guessing this has to do with the issue fixed by #9820 (though I haven't had a chance to look too closely at that PR yet).
When users click the Unassign Linode button, it doesn’t send any request to tell the VPC to unassign Linodes.
Also observing no HTTP request getting fired off upon submitting the drawer, but curious if this might be a data mocking issue -- for example, maybe we have to mock the GET
request to the Linode config endpoint with the VPC interface data set up correctly in order for the frontend to make a PUT
to remove the VPC.
Would a developer be able to offer any insight here?
I think both those issues will be resolved in #9820 |
@cliu-akamai #9820 was just merged! Can we get the latest |
Sure thing! I will rebase the code. |
b327f7b
to
d6e5c7c
Compare
After I rebase the code, the |
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.
Hey Cassie! Could you send a screenshot of what you're seeing for the Unassign Linodes drawer? I'm not seeing the button grey'd out
Looks like this test is failing consistently in the can unassign Linode(s) from a VPC
test case once a Linode is selected to be unassigned. The test checks for
ui.button
.findByTitle('Unassign Linodes')
.should('be.visible')
.should('be.enabled')
.click();
and fails because it's not enabled. Can't replicate this in the UI, though, like @coliu-akamai mentioned so it seems like there's something in the test. Based on SubnetUnassignLinodesDrawer
code, the Unassign Linodes button is only disabled when configInterfacesToDelete.length === 0
, so are we not mocking something correctly?
/* | ||
* - Confirms that can assign a Linode to the VPC when feature is enabled. | ||
*/ | ||
it.skip('can assign Linode(s) to a VPC', () => { |
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.
Let's not forget to unskip this!
it.skip('can assign Linode(s) to a VPC', () => { | |
it('can assign Linode(s) to a VPC', () => { |
Thanks, @mjac0bs! @cliu-akamai It looks like the root of the issue is that the Linode's mocked config doesn't contain the corresponding VPC interface. Defining the config mock like this: // (...Somewhere around line 214...)
const mockLinodeConfig = configFactory.build({
interfaces: [LinodeConfigInterfaceFactoryWithVPC.build({
vpc_id: mockVPC.id,
subnet_id: mockSubnet.id,
})],
}); And then using it on line 259 (instead of |
Don't forget to add a changeset to this PR. |
d6e5c7c
to
05834cf
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.
* | ||
* @returns Cypress chainable. | ||
*/ | ||
export const mockDeleteLinodeConfignInterface = ( |
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.
export const mockDeleteLinodeConfignInterface = ( | |
export const mockDeleteLinodeConfigInterface = ( |
I think this is a small typo. 🔍
05834cf
to
583e39c
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.
Just some import conflicts but after these changes the test passes!
import { | ||
mockCreateLinodeConfigInterfaces, | ||
mockGetLinodeConfigs, | ||
mockDeleteLinodeConfignInterface, |
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.
mockDeleteLinodeConfignInterface, | |
mockDeleteLinodeConfigInterface, |
); | ||
cy.findByText(mockSecondLinode.label).should('be.visible'); | ||
|
||
mockDeleteLinodeConfignInterface( |
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.
mockDeleteLinodeConfignInterface( | |
mockDeleteLinodeConfigInterface( |
mockLinodeConfig.id, | ||
mockLinodeConfig.interfaces[0].id | ||
).as('deleteLinodeConfigInterface1'); | ||
mockDeleteLinodeConfignInterface( |
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.
mockDeleteLinodeConfignInterface( | |
mockDeleteLinodeConfigInterface( |
583e39c
to
9fe8f46
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.
Confirmed test passed! Approving pending one small comment regarding the changeset 🎉
@@ -0,0 +1,5 @@ | |||
--- | |||
"@linode/manager": Added |
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.
Could we change this to Tests? You'll also need to update the file name itself from pr-9818-added-..
to pr-9818-tests-...
"@linode/manager": Added | |
"@linode/manager": 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.
Nice work @cliu-akamai! One small suggestion to wrap the mocked interfaces in a makeResponse
call (doesn't impact your test but could cause issues in other places), but otherwise this looks great!
return cy.intercept( | ||
'POST', | ||
apiMatcher(`linode/instances/${linodeId}/configs/${config.id}/interfaces`), | ||
config.interfaces |
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.
config.interfaces | |
makeResponse(config.interfaces) |
(@cliu-akamai we can also disregard the e2e failure for this, it'll be fixed by PR #9890) |
Description 📝
Add new cypress tests for VPC assign/unassign flows.
Major Changes 🔄
How to test 🧪
Known Issues
Unassign Linode
button, it doesn’t send any request to tell the VPC to unassign Linodes.