2020-10-13 15:44:56 +02:00
|
|
|
describe('Feature Flags', () => {
|
|
|
|
beforeEach(() => {
|
2020-10-22 10:58:32 +02:00
|
|
|
cy.visit('/feature_flags')
|
2020-10-13 15:44:56 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Create feature flag', () => {
|
2021-05-20 16:42:26 +02:00
|
|
|
// ensure unique names to avoid clashes
|
|
|
|
const name = 'beta-feature' + Math.floor(Math.random() * 10000000)
|
2020-10-13 15:44:56 +02:00
|
|
|
cy.get('h1').should('contain', 'Feature Flags')
|
|
|
|
cy.get('[data-attr=new-feature-flag]').click()
|
2021-05-20 16:42:26 +02:00
|
|
|
cy.get('[data-attr=feature-flag-key]').type(name).should('have.value', name)
|
2021-03-23 22:34:48 +01:00
|
|
|
cy.get('[data-attr=feature-flag-description]')
|
|
|
|
.type('This is a new feature.')
|
|
|
|
.should('have.value', 'This is a new feature.')
|
2020-11-20 11:03:14 +01:00
|
|
|
|
|
|
|
// select "add filter" and "property"
|
2021-03-23 22:34:48 +01:00
|
|
|
cy.get('[data-attr=new-prop-filter-feature-flag-null-0-1').click()
|
2020-11-20 11:03:14 +01:00
|
|
|
|
|
|
|
// select the first property
|
2021-07-22 20:40:49 +02:00
|
|
|
cy.get('[data-attr=taxonomic-filter-searchfield]').click()
|
|
|
|
cy.get('[data-attr=taxonomic-filter-searchfield]').type('is_demo')
|
|
|
|
cy.get('[data-attr=taxonomic-tab-person_properties]').click()
|
|
|
|
cy.get('[data-attr=prop-filter-person_properties-0]').click({ force: true })
|
2020-11-20 11:03:14 +01:00
|
|
|
|
|
|
|
// selects the first value
|
|
|
|
cy.get('[data-attr=prop-val]').click()
|
|
|
|
cy.get('[data-attr=prop-val-0]').click({ force: true })
|
|
|
|
|
2021-03-23 22:34:48 +01:00
|
|
|
cy.get('[data-attr=feature-flag-submit]').click()
|
|
|
|
cy.get('.Toastify__toast-body').click() // clicking the toast gets you back to the list
|
2021-05-20 16:42:26 +02:00
|
|
|
cy.get('[data-attr=feature-flag-table]').should('contain', name)
|
2021-03-23 22:34:48 +01:00
|
|
|
cy.get('[data-attr=feature-flag-table]').should('not.contain', '%') // By default it's released to everyone, if a % is not specified
|
|
|
|
cy.get('[data-attr=feature-flag-table]').should('contain', 'is_demo')
|
2020-10-13 15:44:56 +02:00
|
|
|
|
2021-06-24 17:09:41 +02:00
|
|
|
cy.get(`[data-row-key=${name}]`).click()
|
2021-05-20 16:42:26 +02:00
|
|
|
cy.get('[data-attr=feature-flag-key]')
|
|
|
|
.type('-updated')
|
|
|
|
.should('have.value', name + '-updated')
|
2021-03-23 22:34:48 +01:00
|
|
|
cy.get('[data-attr=feature-flag-submit]').click()
|
|
|
|
cy.get('.Toastify__toast-body').click() // clicking the toast gets you back to the list
|
2021-05-20 16:42:26 +02:00
|
|
|
cy.get('[data-attr=feature-flag-table]').should('contain', name + '-updated')
|
2021-04-02 20:07:33 +02:00
|
|
|
|
2021-06-24 17:09:41 +02:00
|
|
|
cy.get(`[data-row-key=${name}-updated] [data-attr=usage]`).click()
|
2021-04-02 20:07:33 +02:00
|
|
|
cy.location().should((loc) => {
|
|
|
|
expect(loc.pathname.toString()).to.contain('/insight')
|
|
|
|
})
|
2020-10-13 15:44:56 +02:00
|
|
|
})
|
2020-10-14 09:01:17 +02:00
|
|
|
|
|
|
|
it('Delete feature flag', () => {
|
2021-05-20 16:42:26 +02:00
|
|
|
const name = 'to-be-deleted' + Math.floor(Math.random() * 10000000)
|
2020-10-14 09:01:17 +02:00
|
|
|
cy.get('h1').should('contain', 'Feature Flags')
|
|
|
|
cy.get('[data-attr=new-feature-flag]').click()
|
2021-05-20 16:42:26 +02:00
|
|
|
cy.get('[data-attr=feature-flag-key]').type(name).should('have.value', name)
|
2021-03-23 22:34:48 +01:00
|
|
|
cy.get('[data-attr=feature-flag-submit]').click()
|
|
|
|
cy.get('.Toastify__toast-body').click() // clicking the toast gets you back to the list
|
2021-05-20 16:42:26 +02:00
|
|
|
cy.get('[data-attr=feature-flag-table]').should('contain', name)
|
|
|
|
cy.get('[data-row-key="' + name + '"]').click()
|
2020-10-14 09:01:17 +02:00
|
|
|
cy.get('[data-attr=delete-flag]').click()
|
2020-11-11 12:22:15 +01:00
|
|
|
cy.contains('Click to undo').should('exist')
|
2020-10-14 09:01:17 +02:00
|
|
|
})
|
2020-10-13 15:44:56 +02:00
|
|
|
})
|