|
|
@@ -9,7 +9,6 @@ import ProjectDeleter from '../app/src/Features/Project/ProjectDeleter.js'
|
|
|
import SplitTestManager from '../app/src/Features/SplitTests/SplitTestManager.js'
|
|
|
import UserDeleter from '../app/src/Features/User/UserDeleter.js'
|
|
|
import UserRegistrationHandler from '../app/src/Features/User/UserRegistrationHandler.js'
|
|
|
-import { scriptRunner } from './lib/ScriptRunner.mjs'
|
|
|
|
|
|
const MONOREPO = Path.dirname(
|
|
|
Path.dirname(Path.dirname(Path.dirname(fileURLToPath(import.meta.url))))
|
|
|
@@ -24,7 +23,7 @@ async function createUser(email) {
|
|
|
email,
|
|
|
password: process.env.CYPRESS_DEFAULT_PASSWORD,
|
|
|
})
|
|
|
- const features = email.startsWith('free@')
|
|
|
+ const features = email.startsWith('free+')
|
|
|
? Settings.defaultFeatures
|
|
|
: Settings.features.professional
|
|
|
await db.users.updateOne(
|
|
|
@@ -32,7 +31,7 @@ async function createUser(email) {
|
|
|
{
|
|
|
$set: {
|
|
|
// Set admin flag.
|
|
|
- isAdmin: email.startsWith('admin@'),
|
|
|
+ isAdmin: email.startsWith('admin+'),
|
|
|
// Disable spell-checking for performance and flakiness reasons.
|
|
|
'ace.spellCheckLanguage': '',
|
|
|
// Override features.
|
|
|
@@ -76,6 +75,11 @@ async function deleteUser(email) {
|
|
|
* @return {Promise<void>}
|
|
|
*/
|
|
|
async function provisionUser(email) {
|
|
|
+ if (!email.includes('+')) {
|
|
|
+ throw new Error(
|
|
|
+ `email=${email} should include the test suite name, e.g. user+project-sharing@example.com`
|
|
|
+ )
|
|
|
+ }
|
|
|
await deleteUser(email)
|
|
|
await createUser(email)
|
|
|
}
|
|
|
@@ -83,7 +87,7 @@ async function provisionUser(email) {
|
|
|
async function provisionUsers() {
|
|
|
const emails = Settings.recaptcha.trustedUsers
|
|
|
console.log(`> Provisioning ${emails.length} E2E users.`)
|
|
|
- await promiseMapWithLimit(3, emails, provisionUser)
|
|
|
+ await promiseMapWithLimit(5, emails, provisionUser)
|
|
|
}
|
|
|
|
|
|
async function purgeNewUsers() {
|
|
|
@@ -95,7 +99,7 @@ async function purgeNewUsers() {
|
|
|
.toArray()
|
|
|
console.log(`> Deleting ${users.length} newly created E2E users.`)
|
|
|
await promiseMapWithLimit(
|
|
|
- 3,
|
|
|
+ 5,
|
|
|
users.map(user => user.email),
|
|
|
deleteUser
|
|
|
)
|
|
|
@@ -154,12 +158,10 @@ async function main() {
|
|
|
throw new Error('only available in dev-env')
|
|
|
}
|
|
|
|
|
|
- await purgeNewUsers()
|
|
|
- await provisionUsers()
|
|
|
- await provisionSplitTests()
|
|
|
+ await Promise.all([purgeNewUsers(), provisionUsers(), provisionSplitTests()])
|
|
|
}
|
|
|
|
|
|
-await scriptRunner(main)
|
|
|
+await main()
|
|
|
await GracefulShutdown.gracefulShutdown(
|
|
|
{
|
|
|
close(cb) {
|