Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for 'updating workspace name and deleting workspace' #6569

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions tests/sanity/tests/model/workspace/owner-pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ export class OwnersPage {
emailMask = (): Locator => this.page.getByRole('textbox', { name: 'Type text...' })
noLimitToggleButton = (): Locator => this.page.locator('label span')
avatarLarge = (): Locator => this.page.locator('.hulyAvatarSize-medium.ava-image')
updateWorkspaceNameButton = (): Locator => this.page.locator('.ws > .antiButton')
confirmUpdateWorkspaceName = (): Locator => this.page.locator('.ws > button').first()
inputWorkspaceName = (): Locator => this.page.getByPlaceholder('Workspace name')
deleteWorkspaceButton = (): Locator => this.page.getByRole('button', { name: 'Delete workspace' })
cancelDeleteWorkspace = (): Locator => this.page.getByRole('button', { name: 'Cancel' })
confirmDeleteWorkspace = (): Locator => this.page.getByRole('button', { name: 'Ok' })

async addMember (memberName: string): Promise<void> {
await expect(this.spacesAdminText()).toBeVisible()
Expand Down Expand Up @@ -74,4 +80,19 @@ export class OwnersPage {
await expect(this.avatarLarge()).toBeVisible()
await expect(this.avatarLarge()).toHaveAttribute('src')
}

async updateWorkspaceName (newName: string): Promise<void> {
await this.updateWorkspaceNameButton().click()
await this.inputWorkspaceName().fill(newName)
await this.confirmUpdateWorkspaceName().click()
await expect(this.inputWorkspaceName()).toHaveValue(newName)
}

async deleteWorkspace (): Promise<void> {
await this.deleteWorkspaceButton().click()
await this.cancelDeleteWorkspace().click()
await this.deleteWorkspaceButton().click()
await this.confirmDeleteWorkspace().click()
await expect(this.page.getByText('Select workspace')).toBeVisible();
}
}
37 changes: 37 additions & 0 deletions tests/sanity/tests/workspace/workspace-settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,41 @@ test.describe('Workspace tests', () => {
await workspaceSettingsPage.selectWorkspaceSettingsTab(ButtonType.InviteSettings)
await ownersPage.createEnumWithName(enumTitle, enumName)
})

test('User is able to update workspace name', async ({ page }) => {
newUser = {
firstName: faker.person.firstName(),
lastName: faker.person.lastName(),
email: faker.internet.email(),
password: '1234'
}
const newWorkspaceName = `New Workspace Name - ${generateId(2)}`
const updatedWorkspaceName = `Updated Workspace Name - ${generateId(3)}`
await loginPage.goto()
await loginPage.linkSignUp().click()
await signUpPage.signUp(newUser)
await selectWorkspacePage.createWorkspace(newWorkspaceName)
await userProfilePage.openProfileMenu()
await userProfilePage.clickSettings()
await workspaceSettingsPage.selectWorkspaceSettingsTab(ButtonType.General)
await ownersPage.updateWorkspaceName(updatedWorkspaceName)
})

test('User is able to delete workspace', async ({ page }) => {
newUser = {
firstName: faker.person.firstName(),
lastName: faker.person.lastName(),
email: faker.internet.email(),
password: '1234'
}
const newWorkspaceName = `New Workspace Name - ${generateId(2)}`
await loginPage.goto()
await loginPage.linkSignUp().click()
await signUpPage.signUp(newUser)
await selectWorkspacePage.createWorkspace(newWorkspaceName)
await userProfilePage.openProfileMenu()
await userProfilePage.clickSettings()
await workspaceSettingsPage.selectWorkspaceSettingsTab(ButtonType.General)
await ownersPage.deleteWorkspace()
})
})