test: [M3-7068] - Add integration tests for Linode migration dialog DC-specific pricing#9681
Conversation
There was a problem hiding this comment.
| * - Confirms that pricing comparison is not shown in "Region" section migration occurs in the same DC. | |
| * - Confirms that pricing comparison is not shown in "Region" section if migration occurs in a DC with the same price structure. |
Here, it is the same DC, because that's the mock data we have to work with, but for clarity, it's probably best to note that the price notice shouldn't show up if the region prices are the same -- even if they're different regions.
There was a problem hiding this comment.
| * - Confirms that pricing comparison is shown in "Region" section when migration occurs in different DCs. | |
| * - Confirms that pricing comparison is shown in "Region" section when migration occurs in DCs with different price structures. |
Similar comment as below.
There was a problem hiding this comment.
| it('shows DC-specific pricing information when migrating linodes between different DCs', () => { | |
| it('shows DC-specific pricing information when migrating linodes between differently priced DCs', () => { |
There was a problem hiding this comment.
| // TODO Remove feature flag mocks once DC pricing is live. | |
| // TODO: DC Pricing - M3-7073: Remove feature flag mocks once DC pricing is live. |
There was a problem hiding this comment.
| // TODO Remove feature flag mocks once DC pricing is live. | |
| // TODO: DC Pricing - M3-7073: Remove feature flag mocks once DC pricing is live. |
For clarity and ease of clean up later, let's format DC pricing related TODOs with TODO: DC Pricing. In this case, we have a related ticket number, so it's useful to include that too.
There was a problem hiding this comment.
Do we mean that this test just not exist once DC-pricing goes live? The other two test cases test that pricing information is shown and isn't shown depending on region prices.
There was a problem hiding this comment.
Yes, I think so.
There was a problem hiding this comment.
Nice work @cliu-akamai! I agree with the clean up suggestions that Mariah made, and additionally have a few suggestions of my own.
It also seems like there may've been a misunderstanding on the requirements for one of the tests, so I posted a pair of comments (1, 2) that I hope will clear that up without sacrificing any of the coverage you've already added 👍
There was a problem hiding this comment.
Could we define a helper in support/intercepts/linodes.ts named mockMigrateLinode() that does this?
There was a problem hiding this comment.
| // Mock requests to get all Linode types, and to get individual types. | |
| mockGetLinodeType(dcPricingMockLinodeTypes[0]).as('getLinodeTypeOld'); | |
| mockGetLinodeType(dcPricingMockLinodeTypes[1]).as('getLInodeTypeNew'); | |
| // Mock requests to get individual Linode types. | |
| mockGetLinodeType(dcPricingMockLinodeTypes[0]); | |
| mockGetLinodeType(dcPricingMockLinodeTypes[1]); |
No need to assign an alias via .as("..."); here since we don't cy.wait() for it later 👍
There was a problem hiding this comment.
| // Mock requests to get all Linode types, and to get individual types. | |
| mockGetLinodeType(dcPricingMockLinodeTypes[0]).as('getLinodeTypeOld'); | |
| mockGetLinodeType(dcPricingMockLinodeTypes[1]).as('getLInodeTypeNew'); | |
| // Mock requests to get individual Linode types. | |
| mockGetLinodeType(dcPricingMockLinodeTypes[0]); | |
| mockGetLinodeType(dcPricingMockLinodeTypes[1]); |
(Same as my other comment)
There was a problem hiding this comment.
Expanding on Mariah's suggestion, I think there might be a misunderstanding over the requirements for this one.
We want to test that the DC-specific pricing warnings do not appear if we're migrating from one DC to another DC which has the same pricing structure. Right now, the tests confirm that the user can't select the same region where the Linode is already hosted (which is good to have, too!)
We can extend this pretty easily to cover both cases, but we need to modify these two constants first so that 1) they're two different regions, and 2) they're not the same regions we mock in dcPricingMockLinodeTypes
| const initialRegion = getRegionById('us-west'); | |
| const newRegion = getRegionById('us-west'); | |
| const initialRegion = getRegionById('us-southeast'); | |
| const newRegion = getRegionById('us-central'); |
There was a problem hiding this comment.
Following up from my other comment, we can extend these assertions to ensure that the test covers both flows: that the user cannot select the same DC where the Linode is already hosted, and that when the user selects another DC with the same price structure, no DC-specific pricing information is shown.
| containsClick(selectRegionString).type(`${newRegion.label}{enter}`); | |
| cy.findByText('No results').should('be.visible'); | |
| // No DC pricing information shows up | |
| cy.findByText(dcPricingCurrentPriceLabel).should('not.exist'); | |
| cy.get('[data-testid="current-price-panel"]').should('not.exist'); | |
| cy.findByText(dcPricingNewPriceLabel).should('not.exist'); | |
| cy.get('[data-testid="new-price-panel"]').should('not.exist'); | |
| // Confirm that user cannot select the Linode's current DC when migrating. | |
| cy.findByText('New Region') | |
| .click() | |
| .type(`${initialRegion.label}{enter}`); | |
| cy.findByText('No results').should('be.visible'); | |
| // Confirm that DC pricing information does not show up | |
| cy.findByText(dcPricingCurrentPriceLabel).should('not.exist'); | |
| cy.get('[data-testid="current-price-panel"]').should('not.exist'); | |
| cy.findByText(dcPricingNewPriceLabel).should('not.exist'); | |
| cy.get('[data-testid="new-price-panel"]').should('not.exist'); | |
| // Change region selection to another region with the same price structure. | |
| cy.findByText('New Region') | |
| .click() | |
| .type(`${newRegion.label}{enter}`); | |
| // Confirm that DC pricing information still does not show up. | |
| cy.findByText(dcPricingCurrentPriceLabel).should('not.exist'); | |
| cy.get('[data-testid="current-price-panel"]').should('not.exist'); | |
| cy.findByText(dcPricingNewPriceLabel).should('not.exist'); | |
| cy.get('[data-testid="new-price-panel"]').should('not.exist'); | |
| // Confirm that migration queue button is enabled. | |
| ui.button | |
| .findByTitle('Enter Migration Queue') | |
| .should('be.visible') | |
| .should('be.enabled'); |
jdamore-linode
left a comment
There was a problem hiding this comment.
Thanks for the updates @cliu-akamai, everything looks great!
6da86a1 to
42e190b
Compare

Description 📝
Add new cypress tests for Linode migration dialog DC pricing
Major Changes 🔄
How to test 🧪