mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-14 19:20:42 -06:00
* add packages/server experiments * show experiments in desktop GUI * add intro experiments text * conditional message * add experiments record to start of the headless run * keep experiments in the config, remove duplicate logic * small tweaks * remove experimentalComponentTesting for now, separate PR * rearrange settings spec into sections per panel * do not crash if there are no experiments * return component testing experiment * work on styling of experiments panel + adding basic tests * update settings spec text * add unit tests for experimental features in cypress run output * Add styling for 'non-enabled' status sign. * add more experiments and key whitelist in experiments GUI * add message when there are no experiments * fix coffeelint * fix merge in settings spec * trailing whitespace * make experiments info all live in one place * add ts lint exception * update unit test * update run spec * do not show experiments panel at all without experiments * add more comments * Update style of ON/OFF status for experimental features. * remove empty messaging from experiments panel (since panel is no longer shown when empty) * remove check for 'isEmpty' when showing list * update lock file Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
80 lines
2.1 KiB
JavaScript
80 lines
2.1 KiB
JavaScript
require('../spec_helper')
|
|
|
|
const { getExperiments, formatExperiments } = require(`${root}lib/experiments.ts`)
|
|
|
|
describe('experiments', () => {
|
|
context('#formatExperiments', () => {
|
|
it('forms single string with all values', () => {
|
|
const exp = {
|
|
featureA: { value: true },
|
|
featureB: { value: false },
|
|
featureC: { value: true },
|
|
}
|
|
const result = formatExperiments(exp)
|
|
|
|
expect(result).to.equal('featureA=true,featureB=false,featureC=true')
|
|
})
|
|
})
|
|
|
|
context('#getExperiments', () => {
|
|
it('returns enabled experiments', () => {
|
|
const names = {
|
|
experimentalFoo: 'experiment foo',
|
|
experimentalBar: 'experiment bar',
|
|
experimentalBaz: 'experiment baz',
|
|
}
|
|
const summaries = {
|
|
experimentalFoo: 'feature foo summary',
|
|
experimentalBar: 'feature bar summary',
|
|
// let the system use the default summary for other features
|
|
}
|
|
|
|
const project = {
|
|
resolvedConfig: {
|
|
// nope, experiment is not enabled
|
|
experimentalFoo: {
|
|
value: true,
|
|
from: 'default',
|
|
},
|
|
// enabled
|
|
experimentalBar: {
|
|
value: true,
|
|
from: 'config',
|
|
},
|
|
// enabled
|
|
experimentalBaz: {
|
|
value: 5,
|
|
from: 'plugins',
|
|
},
|
|
},
|
|
}
|
|
const result = getExperiments(project, names, summaries)
|
|
const expected = {
|
|
experimentalFoo: {
|
|
value: true,
|
|
enabled: false,
|
|
key: 'experimentalFoo',
|
|
name: 'experiment foo',
|
|
summary: 'feature foo summary',
|
|
},
|
|
experimentalBar: {
|
|
value: true,
|
|
enabled: true,
|
|
key: 'experimentalBar',
|
|
name: 'experiment bar',
|
|
summary: 'feature bar summary',
|
|
},
|
|
experimentalBaz: {
|
|
value: 5,
|
|
enabled: true,
|
|
key: 'experimentalBaz',
|
|
name: 'experiment baz',
|
|
summary: 'top secret',
|
|
},
|
|
}
|
|
|
|
expect(result).to.deep.equal(expected)
|
|
})
|
|
})
|
|
})
|