Revert "Revert "Extend the new compile UI rollout, respecting existing allocations""
This reverts commit d0ffcb9a13e9597cebf95961c0c50ef8f950dd7a. GitOrigin-RevId: 46c52ee8df8de4028b3262cb0f3202118014814c
This commit is contained in:
committed by
Copybot
parent
0ee18df3e4
commit
966013f58a
@@ -27,18 +27,24 @@ describe('NewLogsUI helper', function () {
|
||||
)
|
||||
}
|
||||
|
||||
function getTestInterval(lowerBoundary, upperBoundary) {
|
||||
const midpoint = Math.floor(
|
||||
lowerBoundary + (upperBoundary - lowerBoundary) / 2
|
||||
)
|
||||
return [lowerBoundary, midpoint, upperBoundary]
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
this.user = {
|
||||
alphaProgram: false,
|
||||
betaProgram: false,
|
||||
_id: ObjectId('60085414b76eeb00737d93aa'),
|
||||
}
|
||||
this.settings = {
|
||||
logsUIPercentageBeta: 0,
|
||||
logsUIPercentageWithoutPopupBeta: 0,
|
||||
logsUIPercentage: 0,
|
||||
logsUIPercentageWithoutPopup: 0,
|
||||
overleaf: {
|
||||
foo: 'bar',
|
||||
},
|
||||
}
|
||||
|
||||
NewLogsUI = SandboxedModule.require(MODULE_PATH, {
|
||||
requires: {
|
||||
mongodb: { ObjectId },
|
||||
@@ -47,118 +53,87 @@ describe('NewLogsUI helper', function () {
|
||||
})
|
||||
})
|
||||
|
||||
it('should always show the new UI with popup for alpha users', function () {
|
||||
this.user.alphaProgram = true
|
||||
for (const percentile of [0, 20, 40, 60, 80]) {
|
||||
this.user._id = userIdFromTime(percentile)
|
||||
const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user)
|
||||
expect(isNewUIWithPopup(variant)).to.be.true
|
||||
}
|
||||
})
|
||||
|
||||
describe('for beta users', function () {
|
||||
describe('In a non-SaaS context', function () {
|
||||
beforeEach(function () {
|
||||
this.user.betaProgram = true
|
||||
delete this.settings.overleaf
|
||||
})
|
||||
|
||||
describe('with a 0% rollout', function () {
|
||||
it('should always show the existing UI', function () {
|
||||
for (const percentile of [0, 20, 40, 60, 80]) {
|
||||
this.user._id = userIdFromTime(percentile)
|
||||
const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user)
|
||||
expect(isExistingUI(variant)).to.be.true
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe('with a new UI rollout', function () {
|
||||
const newUIWithPopupPercentage = 33
|
||||
const newUIWithoutPopupPercentage = 33
|
||||
|
||||
const newUIWithPopupThreshold = newUIWithPopupPercentage
|
||||
const newUIWithoutPopupThreshold =
|
||||
newUIWithPopupPercentage + newUIWithoutPopupPercentage
|
||||
|
||||
beforeEach(function () {
|
||||
this.settings.logsUIPercentageBeta = newUIWithPopupPercentage
|
||||
this.settings.logsUIPercentageWithoutPopupBeta = newUIWithoutPopupPercentage
|
||||
})
|
||||
it('should show the new UI with popup when the id is below the new UI with popup upper threshold (exc)', function () {
|
||||
this.user._id = userIdFromTime(newUIWithPopupThreshold - 1)
|
||||
const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user)
|
||||
expect(isNewUIWithPopup(variant)).to.be.true
|
||||
})
|
||||
it('should show the new UI without popup when the id is at the new UI with popup upper threshold (exc)', function () {
|
||||
this.user._id = userIdFromTime(newUIWithPopupThreshold)
|
||||
const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user)
|
||||
expect(isNewUIWithoutPopup(variant)).to.be.true
|
||||
})
|
||||
it('should show the new UI without popup when the id is above the new UI with popup upper threshold (inc) and below the new UI without popup upper threshold (exc)', function () {
|
||||
this.user._id = userIdFromTime(newUIWithoutPopupThreshold - 1)
|
||||
const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user)
|
||||
expect(isNewUIWithoutPopup(variant)).to.be.true
|
||||
})
|
||||
it('should show the existing UI when the id is at the new UI without popup upper threshold (exc)', function () {
|
||||
this.user._id = userIdFromTime(newUIWithoutPopupThreshold)
|
||||
it('should always show the existing UI', function () {
|
||||
for (const percentile of [0, 20, 40, 60, 80]) {
|
||||
this.user._id = userIdFromTime(percentile)
|
||||
const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user)
|
||||
expect(isExistingUI(variant)).to.be.true
|
||||
})
|
||||
it('should show the existing UI when the id is above the new UI without popup upper threshold (exc)', function () {
|
||||
this.user._id = userIdFromTime(newUIWithoutPopupThreshold + 1)
|
||||
const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user)
|
||||
expect(isExistingUI(variant)).to.be.true
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe('for regular users', function () {
|
||||
describe('with a 0% rollout', function () {
|
||||
it('should always show the existing UI', function () {
|
||||
for (const percentile of [0, 20, 40, 60, 80]) {
|
||||
this.user._id = userIdFromTime(percentile)
|
||||
const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user)
|
||||
expect(isExistingUI(variant)).to.be.true
|
||||
}
|
||||
})
|
||||
describe('For alpha users', function () {
|
||||
beforeEach(function () {
|
||||
this.user.alphaProgram = true
|
||||
})
|
||||
|
||||
describe('with a new UI rollout', function () {
|
||||
const newUIWithPopupPercentage = 33
|
||||
const newUIWithoutPopupPercentage = 33
|
||||
|
||||
const newUIWithPopupThreshold = newUIWithPopupPercentage
|
||||
const newUIWithoutPopupThreshold =
|
||||
newUIWithPopupPercentage + newUIWithoutPopupPercentage
|
||||
|
||||
beforeEach(function () {
|
||||
this.settings.logsUIPercentage = newUIWithPopupPercentage
|
||||
this.settings.logsUIPercentageWithoutPopup = newUIWithoutPopupPercentage
|
||||
})
|
||||
it('should show the new UI with popup when the id is below the new UI with popup upper threshold (exc)', function () {
|
||||
this.user._id = userIdFromTime(newUIWithPopupThreshold - 1)
|
||||
it('should always show the new UI with popup', function () {
|
||||
for (const percentile of [0, 20, 40, 60, 80]) {
|
||||
this.user._id = userIdFromTime(percentile)
|
||||
const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user)
|
||||
expect(isNewUIWithPopup(variant)).to.be.true
|
||||
})
|
||||
it('should show the new UI without popup when the id is at the new UI with popup upper threshold (exc)', function () {
|
||||
this.user._id = userIdFromTime(newUIWithPopupThreshold)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe('For regular users', function () {
|
||||
it('should show the new UI with popup when the id is in the [0, 5[ interval', function () {
|
||||
const testInterval = getTestInterval(0, 4)
|
||||
for (const percentile of testInterval) {
|
||||
this.user._id = userIdFromTime(percentile)
|
||||
const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user)
|
||||
expect(isNewUIWithPopup(variant)).to.be.true
|
||||
}
|
||||
this.user._id = userIdFromTime(5)
|
||||
const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user)
|
||||
expect(isNewUIWithPopup(variant)).to.be.false
|
||||
})
|
||||
it('should show the new UI without popup when the id is in the [5, 10[ interval', function () {
|
||||
const testInterval = getTestInterval(5, 9)
|
||||
for (const percentile of testInterval) {
|
||||
this.user._id = userIdFromTime(percentile)
|
||||
const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user)
|
||||
expect(isNewUIWithoutPopup(variant)).to.be.true
|
||||
})
|
||||
it('should show the new UI without popup when the id is above the new UI with popup upper threshold (inc) and below the new UI without popup upper threshold (exc)', function () {
|
||||
this.user._id = userIdFromTime(newUIWithoutPopupThreshold - 1)
|
||||
}
|
||||
this.user._id = userIdFromTime(10)
|
||||
const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user)
|
||||
expect(isNewUIWithoutPopup(variant)).to.be.false
|
||||
})
|
||||
it('should show the new UI with popup when the id is in the [10, 38[ interval', function () {
|
||||
const testInterval = getTestInterval(10, 37)
|
||||
for (const percentile of testInterval) {
|
||||
this.user._id = userIdFromTime(percentile)
|
||||
const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user)
|
||||
expect(isNewUIWithPopup(variant)).to.be.true
|
||||
}
|
||||
this.user._id = userIdFromTime(38)
|
||||
const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user)
|
||||
expect(isNewUIWithPopup(variant)).to.be.false
|
||||
})
|
||||
it('should show the new UI without popup when the id is in the [38, 66[ interval', function () {
|
||||
const testInterval = getTestInterval(38, 65)
|
||||
for (const percentile of testInterval) {
|
||||
this.user._id = userIdFromTime(percentile)
|
||||
const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user)
|
||||
expect(isNewUIWithoutPopup(variant)).to.be.true
|
||||
})
|
||||
it('should show the existing UI when the id is at the new UI without popup upper threshold (exc)', function () {
|
||||
this.user._id = userIdFromTime(newUIWithoutPopupThreshold)
|
||||
}
|
||||
this.user._id = userIdFromTime(66)
|
||||
const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user)
|
||||
expect(isNewUIWithoutPopup(variant)).to.be.false
|
||||
})
|
||||
it('should show the existing UI when the id is in the [66, 99] interval', function () {
|
||||
const testInterval = getTestInterval(66, 99)
|
||||
for (const percentile of testInterval) {
|
||||
this.user._id = userIdFromTime(percentile)
|
||||
const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user)
|
||||
expect(isExistingUI(variant)).to.be.true
|
||||
})
|
||||
it('should show the existing UI when the id is above the new UI without popup upper threshold (exc)', function () {
|
||||
this.user._id = userIdFromTime(newUIWithoutPopupThreshold + 1)
|
||||
const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user)
|
||||
expect(isExistingUI(variant)).to.be.true
|
||||
})
|
||||
}
|
||||
this.user._id = userIdFromTime(100)
|
||||
const variant = NewLogsUI.getNewLogsUIVariantForUser(this.user)
|
||||
expect(isExistingUI(variant)).to.be.false
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user