2024-09-27 10:05:10 +03:00
|
|
|
/** @file Test the setup flow. */
|
2024-12-12 12:49:58 +03:00
|
|
|
import { expect, test } from '@playwright/test'
|
2024-09-27 10:05:10 +03:00
|
|
|
|
|
|
|
import { Plan } from 'enso-common/src/services/Backend'
|
2024-12-12 12:49:58 +03:00
|
|
|
import { mockAll } from './actions'
|
2024-09-27 10:05:10 +03:00
|
|
|
|
2024-11-15 15:12:55 +03:00
|
|
|
// Reset storage state for this file to avoid being authenticated
|
2024-12-12 12:49:58 +03:00
|
|
|
test.use({ storageState: { cookies: [], origins: [] } })
|
2024-11-15 15:12:55 +03:00
|
|
|
|
2024-12-12 12:49:58 +03:00
|
|
|
test('setup (free plan)', ({ page }) =>
|
|
|
|
mockAll({
|
|
|
|
page,
|
|
|
|
setupAPI: (api) => {
|
|
|
|
api.setCurrentUser(null)
|
|
|
|
},
|
|
|
|
})
|
2024-09-27 10:05:10 +03:00
|
|
|
.loginAsNewUser()
|
|
|
|
.setUsername('test user')
|
|
|
|
.stayOnFreePlan()
|
|
|
|
.goToPage.drive()
|
|
|
|
.withDriveView(async (drive) => {
|
2024-12-12 12:49:58 +03:00
|
|
|
await expect(drive).toBeVisible()
|
|
|
|
}))
|
2024-09-27 10:05:10 +03:00
|
|
|
|
2024-12-12 12:49:58 +03:00
|
|
|
test('setup (solo plan)', ({ page }) =>
|
|
|
|
mockAll({
|
|
|
|
page,
|
|
|
|
setupAPI: (api) => {
|
|
|
|
api.setCurrentUser(null)
|
|
|
|
},
|
|
|
|
})
|
2024-09-27 10:05:10 +03:00
|
|
|
.loginAsNewUser()
|
|
|
|
.setUsername('test user')
|
|
|
|
.selectSoloPlan()
|
|
|
|
.goToPage.drive()
|
|
|
|
.withDriveView(async (drive) => {
|
2024-12-12 12:49:58 +03:00
|
|
|
await expect(drive).toBeVisible()
|
|
|
|
}))
|
2024-09-27 10:05:10 +03:00
|
|
|
|
2024-12-12 12:49:58 +03:00
|
|
|
test('setup (team plan, skipping invites)', ({ page }) =>
|
|
|
|
mockAll({
|
|
|
|
page,
|
|
|
|
setupAPI: (api) => {
|
|
|
|
api.setCurrentUser(null)
|
|
|
|
},
|
|
|
|
})
|
2024-09-27 10:05:10 +03:00
|
|
|
.loginAsNewUser()
|
|
|
|
.setUsername('test user')
|
|
|
|
.selectTeamPlan(Plan.team)
|
|
|
|
.setOrganizationName('test organization')
|
|
|
|
.skipInvitingUsers()
|
|
|
|
.setTeamName('test team')
|
|
|
|
.goToPage.drive()
|
|
|
|
.withDriveView(async (drive) => {
|
2024-12-12 12:49:58 +03:00
|
|
|
await expect(drive).toBeVisible()
|
|
|
|
}))
|
2024-09-27 10:05:10 +03:00
|
|
|
|
2024-12-12 12:49:58 +03:00
|
|
|
test('setup (team plan)', ({ page }) =>
|
|
|
|
mockAll({
|
|
|
|
page,
|
|
|
|
setupAPI: (api) => {
|
|
|
|
api.setCurrentUser(null)
|
|
|
|
},
|
|
|
|
})
|
2024-09-27 10:05:10 +03:00
|
|
|
.loginAsNewUser()
|
|
|
|
.setUsername('test user')
|
|
|
|
.selectTeamPlan(Plan.team, 10)
|
|
|
|
.setOrganizationName('test organization')
|
|
|
|
.inviteUsers('foo@bar.baz bar@bar.baz, baz@example.com; other+email@org.co.uk')
|
|
|
|
.setTeamName('test team')
|
|
|
|
.goToPage.drive()
|
|
|
|
.withDriveView(async (drive) => {
|
2024-12-12 12:49:58 +03:00
|
|
|
await expect(drive).toBeVisible()
|
|
|
|
}))
|
2024-09-27 10:05:10 +03:00
|
|
|
|
|
|
|
// No test for enterprise plan as the plan must be set to enterprise manually.
|