-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add export win button and link behind a user feature group
- Loading branch information
Showing
5 changed files
with
104 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
test/functional/cypress/specs/export-win/user-feature-group-spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import qs from 'qs' | ||
|
||
import { exportListFaker } from '../../fakers/export' | ||
import urls from '../../../../../src/lib/urls' | ||
|
||
describe('Export win user feature groups', () => { | ||
const company = '/companies/00009ae3-1912-e411-8a2b-e4115bead28a/overview' | ||
|
||
context('Company page"', () => { | ||
it('should show the "Add export win" button', () => { | ||
cy.setUserFeatureGroups(['export-wins']) | ||
cy.visit(company) | ||
cy.get('[data-test="header-add-export-win"]').should('exist') | ||
}) | ||
it('should hide the "Add export win" button', () => { | ||
cy.setUserFeatureGroups([]) | ||
cy.visit(company) | ||
cy.get('[data-test="header-add-export-win"]').should('not.exist') | ||
}) | ||
}) | ||
|
||
context('Dashboard"', () => { | ||
const exports = exportListFaker(3) | ||
const endpoint = '/api-proxy/v4/export' | ||
const queryParams = qs.stringify({ | ||
limit: 10, | ||
page: 1, | ||
offset: 0, | ||
archived: false, | ||
sortby: 'created_on:desc', | ||
}) | ||
|
||
beforeEach(() => { | ||
cy.intercept('GET', `${endpoint}?${queryParams}`, { | ||
body: { | ||
count: exports.length, | ||
results: exports, | ||
}, | ||
}).as('apiReqList') | ||
cy.intercept('GET', '/api-proxy/v4/export/owner', []) | ||
}) | ||
|
||
it('should show the "Add export win" link', () => { | ||
cy.setUserFeatureGroups(['export-wins']) | ||
cy.visit(urls.exportPipeline.index()) | ||
cy.get('[data-test="export-wins"]').should('exist') | ||
}) | ||
|
||
it('should hide the "Add export win" button', () => { | ||
cy.setUserFeatureGroups([]) | ||
cy.visit(urls.exportPipeline.index()) | ||
cy.get('[data-test="export-wins"]').should('not.exist') | ||
}) | ||
}) | ||
}) |