Skip to content

Commit

Permalink
fix: create-volume.spec.ts and dynamicPricing.test.ts (linode#9578)
Browse files Browse the repository at this point in the history
* select region select differently

* run test with the `dcSpecificPricing` off

* fix test since calc was recently updated

* fix unit tests

* Added changeset: Fix volume e2e test and dc specific price unit test

---------

Co-authored-by: Banks Nussman <[email protected]>
Co-authored-by: Alban Bailly <[email protected]>
  • Loading branch information
3 people authored and corya-akamai committed Sep 6, 2023
1 parent 889d1c4 commit fb697ca
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

Fix volume e2e test and dc specific price unit test ([#9578](https://github.com/linode/manager/pull/9578))
27 changes: 27 additions & 0 deletions packages/manager/cypress/e2e/core/volumes/create-volume.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import { interceptCreateVolume } from 'support/intercepts/volumes';
import { randomNumber, randomString, randomLabel } from 'support/util/random';
import { chooseRegion } from 'support/util/regions';
import { ui } from 'support/ui';
import { makeFeatureFlagData } from 'support/util/feature-flags';
import {
mockAppendFeatureFlags,
mockGetFeatureFlagClientstream,
} from 'support/intercepts/feature-flags';

// Local storage override to force volume table to list up to 100 items.
// This is a workaround while we wait to get stuck volumes removed.
Expand Down Expand Up @@ -35,16 +40,29 @@ describe('volume create flow', () => {
regionLabel: region.label,
};

mockAppendFeatureFlags({
dcSpecificPricing: makeFeatureFlagData(false),
}).as('getFeatureFlags');
mockGetFeatureFlagClientstream().as('getClientStream');

interceptCreateVolume().as('createVolume');

cy.visitWithLogin('/volumes/create', {
localStorageOverrides: pageSizeOverride,
});

cy.wait(['@getFeatureFlags', '@getClientStream']);

// Fill out and submit volume create form.
containsClick('Label').type(volume.label);
containsClick('Size').type(`{selectall}{backspace}${volume.size}`);
containsClick('Select a Region').type(`${volume.region}{enter}`);

cy.findByText('Region')
.should('be.visible')
.click()
.type(`${volume.regionLabel}{enter}`);

fbtClick('Create Volume');
cy.wait('@createVolume');

Expand Down Expand Up @@ -85,11 +103,20 @@ describe('volume create flow', () => {
};

cy.defer(createLinode(linodeRequest), 'creating Linode').then((linode) => {
mockAppendFeatureFlags({
dcSpecificPricing: makeFeatureFlagData(false),
}).as('getFeatureFlags');

mockGetFeatureFlagClientstream().as('getClientStream');

interceptCreateVolume().as('createVolume');

cy.visitWithLogin('/volumes/create', {
localStorageOverrides: pageSizeOverride,
});

cy.wait(['@getFeatureFlags', '@getClientStream']);

// Fill out and submit volume create form.
containsClick('Label').type(volume.label);
containsClick('Size').type(`{selectall}{backspace}${volume.size}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('getDCSpecificPricingDisplay', () => {
flags: { dcSpecificPricing: true },
regionId: 'br-gru',
})
).toBe('26.00');
).toBe('28.00');
});

it('calculates dynamic pricing for a volumes based on size', () => {
Expand Down

0 comments on commit fb697ca

Please sign in to comment.