|
| 1 | +import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags'; |
| 2 | +import { ui } from 'support/ui'; |
| 3 | + |
| 4 | +describe('Quotas accessible when limitsEvolution feature flag enabled', () => { |
| 5 | + beforeEach(() => { |
| 6 | + // TODO M3-10003 - Remove mock once `limitsEvolution` feature flag is removed. |
| 7 | + mockAppendFeatureFlags({ |
| 8 | + limitsEvolution: { |
| 9 | + enabled: true, |
| 10 | + }, |
| 11 | + }).as('getFeatureFlags'); |
| 12 | + }); |
| 13 | + it('can navigate directly to Quotas page', () => { |
| 14 | + cy.visitWithLogin('/account/quotas'); |
| 15 | + cy.wait('@getFeatureFlags'); |
| 16 | + cy.url().should('endWith', '/quotas'); |
| 17 | + cy.contains( |
| 18 | + 'View your Object Storage quotas by applying the endpoint filter below' |
| 19 | + ).should('be.visible'); |
| 20 | + }); |
| 21 | + |
| 22 | + it('can navigate to the Quotas page via the User Menu', () => { |
| 23 | + cy.visitWithLogin('/'); |
| 24 | + cy.wait('@getFeatureFlags'); |
| 25 | + // Open user menu |
| 26 | + ui.userMenuButton.find().click(); |
| 27 | + ui.userMenu.find().within(() => { |
| 28 | + cy.get('[data-testid="menu-item-Quotas"]').should('be.visible').click(); |
| 29 | + cy.url().should('endWith', '/quotas'); |
| 30 | + }); |
| 31 | + }); |
| 32 | + |
| 33 | + it('Quotas tab is visible from all other tabs in Account tablist', () => { |
| 34 | + cy.visitWithLogin('/account/billing'); |
| 35 | + cy.wait('@getFeatureFlags'); |
| 36 | + ui.tabList.find().within(() => { |
| 37 | + cy.get('a').each(($link) => { |
| 38 | + cy.wrap($link).click(); |
| 39 | + cy.get('[data-testid="Quotas"]').should('be.visible'); |
| 40 | + }); |
| 41 | + }); |
| 42 | + cy.get('[data-testid="Quotas"]').should('be.visible').click(); |
| 43 | + cy.url().should('endWith', '/quotas'); |
| 44 | + }); |
| 45 | +}); |
| 46 | + |
| 47 | +describe('Quotas inaccessible when limitsEvolution feature flag disabled', () => { |
| 48 | + beforeEach(() => { |
| 49 | + mockAppendFeatureFlags({ |
| 50 | + limitsEvolution: { |
| 51 | + enabled: false, |
| 52 | + }, |
| 53 | + }).as('getFeatureFlags'); |
| 54 | + }); |
| 55 | + it('Quotas page is inaccessible', () => { |
| 56 | + cy.visitWithLogin('/account/quotas'); |
| 57 | + cy.wait('@getFeatureFlags'); |
| 58 | + cy.url().should('endWith', '/billing'); |
| 59 | + }); |
| 60 | + |
| 61 | + it('cannot navigate to the Quotas tab via the Users & Grants link in the User Menu', () => { |
| 62 | + cy.visitWithLogin('/'); |
| 63 | + cy.wait('@getFeatureFlags'); |
| 64 | + // Open user menu |
| 65 | + ui.userMenuButton.find().click(); |
| 66 | + ui.userMenu.find().within(() => { |
| 67 | + cy.get('[data-testid="menu-item-Quotas"]').should('not.exist'); |
| 68 | + cy.get('[data-testid="menu-item-Users & Grants"]') |
| 69 | + .should('be.visible') |
| 70 | + .click(); |
| 71 | + }); |
| 72 | + cy.url().should('endWith', '/users'); |
| 73 | + cy.get('[data-testid="Quotas"]').should('not.exist'); |
| 74 | + }); |
| 75 | + |
| 76 | + it('cannot navigate to the Quotas tab via the Billing link in the User Menu', () => { |
| 77 | + cy.visitWithLogin('/'); |
| 78 | + cy.wait('@getFeatureFlags'); |
| 79 | + ui.userMenuButton.find().click(); |
| 80 | + ui.userMenu.find().within(() => { |
| 81 | + cy.get('[data-testid="menu-item-Quotas"]').should('not.exist'); |
| 82 | + cy.get('[data-testid="menu-item-Billing & Contact Information"]') |
| 83 | + .should('be.visible') |
| 84 | + .click(); |
| 85 | + }); |
| 86 | + cy.url().should('endWith', '/billing'); |
| 87 | + cy.get('[data-testid="Quotas"]').should('not.exist'); |
| 88 | + }); |
| 89 | +}); |
0 commit comments