feat: Ability to skip initial content creation (#10812)

* feat: Configure workspaces during creation

Signed-off-by: Artem Savchenko <armisav@gmail.com>

* Fix question description

Signed-off-by: Artem Savchenko <armisav@gmail.com>

* Clean up

Signed-off-by: Artem Savchenko <armisav@gmail.com>

* Fix formatting

Signed-off-by: Artem Savchenko <armisav@gmail.com>

* Fix tests

Signed-off-by: Artem Savchenko <armisav@gmail.com>

* Fix tests

Signed-off-by: Artem Savchenko <armisav@gmail.com>

* Potential fix for pull request finding 'CodeQL / Insecure randomness'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Artyom Savchenko <armisav@gmail.com>

* Revert "Potential fix for pull request finding 'CodeQL / Insecure randomness'"

This reverts commit e37b6de69c.

Signed-off-by: Artem Savchenko <armisav@gmail.com>

* Simplify workspace creation

Signed-off-by: Artem Savchenko <armisav@gmail.com>

* Fix layout

Signed-off-by: Artem Savchenko <armisav@gmail.com>

* Clean up

Signed-off-by: Artem Savchenko <armisav@gmail.com>

* Keep redesigned version

Signed-off-by: Artem Savchenko <armisav@gmail.com>

* Fix tests

Signed-off-by: Artem Savchenko <armisav@gmail.com>

---------

Signed-off-by: Artem Savchenko <armisav@gmail.com>
Signed-off-by: Artyom Savchenko <armisav@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
Artyom Savchenko
2026-05-22 18:58:10 +07:00
committed by GitHub
co-authored by Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
parent a78630fa4d
commit e3d3276451
61 changed files with 540 additions and 122 deletions
@@ -12,12 +12,15 @@ export class SelectWorkspacePage extends CommonPage {
title = (): Locator => this.page.locator('div.title', { hasText: 'Select workspace' })
buttonWorkspace = (): Locator => this.page.locator('div[class*="workspace"]')
buttonCreateWorkspace = (): Locator => this.page.locator('button > span', { hasText: 'Create workspace' })
buttonWorkspaceName = (): Locator => this.page.locator('input')
buttonCreateNewWorkspace = (): Locator => this.page.locator('div.form-row button')
buttonWorkspaceName = (): Locator => this.page.locator('input[type="text"]').first()
buttonCreateNewWorkspace = (): Locator => this.page.locator('div.form-row.send button')
workspaceButtonByName = (workspace: string): Locator => this.buttonWorkspace().filter({ hasText: workspace }).first()
createAnotherWorkspace = (): Locator => this.page.getByRole('link', { name: 'Create workspace' })
workspaceLogo = (): Locator => this.page.getByText('N', { exact: true })
workspaceList = (workspaceName: string): Locator => this.page.getByRole('button', { name: workspaceName })
createSampleProjectsToggle = (): Locator =>
this.page.locator('label', { hasText: 'Create sample projects and demo content' }).locator('input[type="checkbox"]')
async selectWorkspace (workspace: string): Promise<void> {
await this.workspaceButtonByName(workspace).click()
}
@@ -47,4 +50,19 @@ export class SelectWorkspacePage extends CommonPage {
async checkIfWorkspaceExists (workspace: string): Promise<void> {
await expect(this.workspaceList(workspace)).toBeVisible()
}
/**
* Creates a workspace with the demo-content toggle flipped off, exercising
* `withDemoContent: false`. Toggle's underlying checkbox is visually hidden,
* so the click goes through with `force: true`.
*/
async createWorkspaceWithoutDemoContent (workspaceName: string): Promise<void> {
await this.buttonCreateWorkspace().waitFor({ state: 'visible' })
await this.enterWorkspaceName(workspaceName)
const toggle = this.createSampleProjectsToggle()
if (await toggle.isChecked()) {
await toggle.click({ force: true })
}
await this.buttonCreateNewWorkspace().click()
}
}
@@ -149,6 +149,26 @@ test.describe('Workspace tests', () => {
}
})
test('Create a workspace without demo content (withDemoContent: false)', async ({ page }) => {
const newUser: SignUpData = {
firstName: `FirstName-${generateId()}`,
lastName: `LastName-${generateId()}`,
email: `sanity-email+${generateId()}@gmail.com`,
password: '1234'
}
const newWorkspaceName = `WS No Demo - ${generateId(2)}`
await loginPage.goto()
await loginPage.clickSignUp()
await signUpPage.signUp(newUser)
await selectWorkspacePage.createWorkspaceWithoutDemoContent(newWorkspaceName)
// The init script normally seeds a "Default" project in Tracker. With demo
// content disabled, no sample project should be created — so navigating to
// Tracker should not show the canned project list.
await leftSideMenuPage.clickTracker()
await trackerNavigationMenuPage.checkProjectNotExist('Default')
})
test('Create a workspace with join link - existing account', async ({ page, browser }) => {
const newUser: SignUpData = {
firstName: `FirstName-${generateId()}`,