mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 14:33:43 -05:00
05ecfa2e23
[server-pro] add e2e tests for registering users via GUI/script/email GitOrigin-RevId: 25243532038c8df72f1360c433af215b3a551f3a
54 lines
1.2 KiB
TypeScript
54 lines
1.2 KiB
TypeScript
import { reconfigure } from './hostAdminClient'
|
|
import { resetActivateUserRateLimit, resetCreatedUsersCache } from './login'
|
|
|
|
export const STARTUP_TIMEOUT =
|
|
parseInt(Cypress.env('STARTUP_TIMEOUT'), 10) || 120_000
|
|
|
|
export function isExcludedBySharding(
|
|
shard:
|
|
| 'CE_DEFAULT'
|
|
| 'CE_CUSTOM_1'
|
|
| 'CE_CUSTOM_2'
|
|
| 'PRO_DEFAULT_1'
|
|
| 'PRO_DEFAULT_2'
|
|
| 'PRO_CUSTOM_1'
|
|
| 'PRO_CUSTOM_2'
|
|
| 'PRO_CUSTOM_3'
|
|
) {
|
|
const SHARD = Cypress.env('SHARD')
|
|
return SHARD && shard !== SHARD
|
|
}
|
|
|
|
let lastConfig: string
|
|
|
|
export function startWith({
|
|
pro = false,
|
|
version = 'latest',
|
|
vars = {},
|
|
varsFn = () => ({}),
|
|
withDataDir = false,
|
|
resetData = false,
|
|
}) {
|
|
before(async function () {
|
|
Object.assign(vars, varsFn())
|
|
const cfg = JSON.stringify({
|
|
pro,
|
|
version,
|
|
vars,
|
|
withDataDir,
|
|
})
|
|
if (resetData) {
|
|
resetCreatedUsersCache()
|
|
resetActivateUserRateLimit()
|
|
// no return here, always reconfigure when resetting data
|
|
} else if (lastConfig === cfg) {
|
|
return
|
|
}
|
|
|
|
this.timeout(STARTUP_TIMEOUT)
|
|
await reconfigure({ pro, version, vars, withDataDir, resetData })
|
|
lastConfig = cfg
|
|
})
|
|
}
|
|
|
|
export { reconfigure }
|