mirror of
https://github.com/hcengineering/platform.git
synced 2025-01-08 21:27:45 +03:00
TESTS-169: feat(tests): done Create a workspace with a custom name test (#4541)
Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
parent
407ba908a8
commit
723bf994bc
6
tests/sanity/tests/model/common-types.ts
Normal file
6
tests/sanity/tests/model/common-types.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export interface SignUpData {
|
||||
firstName: string
|
||||
lastName: string
|
||||
email: string
|
||||
password: string
|
||||
}
|
@ -6,12 +6,14 @@ export class LoginPage {
|
||||
readonly inputEmail: Locator
|
||||
readonly inputPassword: Locator
|
||||
readonly buttonLogin: Locator
|
||||
readonly linkSignUp: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
this.page = page
|
||||
this.inputEmail = page.locator('input[name=email]')
|
||||
this.inputPassword = page.locator('input[name=current-password]')
|
||||
this.buttonLogin = page.locator('button', { hasText: 'Log In' })
|
||||
this.linkSignUp = page.locator('a.title', { hasText: 'Sign Up' })
|
||||
}
|
||||
|
||||
async goto (): Promise<void> {
|
||||
|
@ -1,15 +1,27 @@
|
||||
import { type Locator, type Page } from '@playwright/test'
|
||||
import { expect, type Locator, type Page } from '@playwright/test'
|
||||
|
||||
export class SelectWorkspacePage {
|
||||
readonly page: Page
|
||||
readonly buttonWorkspace: Locator
|
||||
readonly buttonCreateWorkspace: Locator
|
||||
readonly buttonWorkspaceName: Locator
|
||||
readonly buttonCreateNewWorkspace: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
this.page = page
|
||||
this.buttonWorkspace = page.locator('div[class*="workspace"]')
|
||||
this.buttonCreateWorkspace = page.locator('button > span', { hasText: 'Create workspace' })
|
||||
this.buttonWorkspaceName = page.locator('input')
|
||||
this.buttonCreateNewWorkspace = page.locator('div.form-row button')
|
||||
}
|
||||
|
||||
async selectWorkspace (workspace: string): Promise<void> {
|
||||
await this.buttonWorkspace.filter({ hasText: workspace }).click()
|
||||
}
|
||||
|
||||
async createWorkspace (workspaceName: string): Promise<void> {
|
||||
await this.buttonWorkspaceName.fill(workspaceName)
|
||||
expect(await this.buttonCreateNewWorkspace.isEnabled()).toBe(true)
|
||||
await this.buttonCreateNewWorkspace.click()
|
||||
}
|
||||
}
|
||||
|
32
tests/sanity/tests/model/signup-page.ts
Normal file
32
tests/sanity/tests/model/signup-page.ts
Normal file
@ -0,0 +1,32 @@
|
||||
import { expect, type Locator, type Page } from '@playwright/test'
|
||||
import { SignUpData } from './common-types'
|
||||
|
||||
export class SignUpPage {
|
||||
readonly page: Page
|
||||
readonly inputFirstName: Locator
|
||||
readonly inputLastName: Locator
|
||||
readonly inputEmail: Locator
|
||||
readonly inputNewPassword: Locator
|
||||
readonly inputRepeatPassword: Locator
|
||||
readonly buttonSignUp: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
this.page = page
|
||||
this.inputFirstName = page.locator('input[name="given-name"]')
|
||||
this.inputLastName = page.locator('input[name="family-name"]')
|
||||
this.inputEmail = page.locator('input[name="email"]')
|
||||
this.inputNewPassword = page.locator('//div[text()="Password"]/../input')
|
||||
this.inputRepeatPassword = page.locator('//div[text()="Repeat password"]/../input')
|
||||
this.buttonSignUp = page.locator('button', { hasText: 'Sign Up' })
|
||||
}
|
||||
|
||||
async signUp (data: SignUpData): Promise<void> {
|
||||
await this.inputFirstName.fill(data.firstName)
|
||||
await this.inputLastName.fill(data.lastName)
|
||||
await this.inputEmail.fill(data.email)
|
||||
await this.inputNewPassword.fill(data.password)
|
||||
await this.inputRepeatPassword.fill(data.password)
|
||||
expect(await this.buttonSignUp.isEnabled()).toBe(true)
|
||||
await this.buttonSignUp.click()
|
||||
}
|
||||
}
|
96
tests/sanity/tests/workspace/create.spec.ts
Normal file
96
tests/sanity/tests/workspace/create.spec.ts
Normal file
@ -0,0 +1,96 @@
|
||||
import { test } from '@playwright/test'
|
||||
import { allure } from 'allure-playwright'
|
||||
import { LoginPage } from '../model/login-page'
|
||||
import { generateId } from '../utils'
|
||||
import { SelectWorkspacePage } from '../model/select-workspace-page'
|
||||
import { SignUpPage } from '../model/signup-page'
|
||||
import { SignUpData } from '../model/common-types'
|
||||
import { LeftSideMenuPage } from '../model/left-side-menu-page'
|
||||
import { NewIssue } from '../model/tracker/types'
|
||||
import { IssuesPage } from '../model/tracker/issues-page'
|
||||
import { IssuesDetailsPage } from '../model/tracker/issues-details-page'
|
||||
import { TrackerNavigationMenuPage } from '../model/tracker/tracker-navigation-menu-page'
|
||||
|
||||
test.describe('Workspace tests', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await allure.parentSuite('Workspace tests')
|
||||
})
|
||||
|
||||
test('Create a workspace with a custom name', async ({ page }) => {
|
||||
const newUser: SignUpData = {
|
||||
firstName: `FirstName-${generateId()}`,
|
||||
lastName: `LastName-${generateId()}`,
|
||||
email: `email+${generateId()}@gmail.com`,
|
||||
password: '1234'
|
||||
}
|
||||
const newWorkspaceName = `New Workspace Name - ${generateId(2)}`
|
||||
|
||||
const loginPage = new LoginPage(page)
|
||||
await loginPage.goto()
|
||||
await loginPage.linkSignUp.click()
|
||||
|
||||
const signUpPage = new SignUpPage(page)
|
||||
await signUpPage.signUp(newUser)
|
||||
|
||||
const selectWorkspacePage = new SelectWorkspacePage(page)
|
||||
await selectWorkspacePage.buttonCreateWorkspace.click()
|
||||
await selectWorkspacePage.createWorkspace(newWorkspaceName)
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.buttonTracker.click()
|
||||
})
|
||||
|
||||
test('Create a new issue in the workspace with a custom name', async ({ page }) => {
|
||||
const newUser: SignUpData = {
|
||||
firstName: `FirstName-${generateId()}`,
|
||||
lastName: `LastName-${generateId()}`,
|
||||
email: `email+${generateId()}@gmail.com`,
|
||||
password: '1234'
|
||||
}
|
||||
const newIssue: NewIssue = {
|
||||
title: `Issue with all parameters and attachments-${generateId()}`,
|
||||
description: 'Created issue with all parameters and attachments description',
|
||||
status: 'In progress',
|
||||
priority: 'Urgent',
|
||||
assignee: `${newUser.lastName} ${newUser.firstName}`,
|
||||
createLabel: true,
|
||||
labels: `CREATE-ISSUE-${generateId()}`,
|
||||
component: 'No component',
|
||||
estimation: '2',
|
||||
milestone: 'No Milestone',
|
||||
duedate: 'today',
|
||||
filePath: 'cat.jpeg'
|
||||
}
|
||||
const newWorkspaceName = `New Issue Name - ${generateId(2)}`
|
||||
|
||||
const loginPage = new LoginPage(page)
|
||||
await loginPage.goto()
|
||||
await loginPage.linkSignUp.click()
|
||||
|
||||
const signUpPage = new SignUpPage(page)
|
||||
await signUpPage.signUp(newUser)
|
||||
|
||||
const selectWorkspacePage = new SelectWorkspacePage(page)
|
||||
await selectWorkspacePage.buttonCreateWorkspace.click()
|
||||
await selectWorkspacePage.createWorkspace(newWorkspaceName)
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.buttonTracker.click()
|
||||
|
||||
const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page)
|
||||
await trackerNavigationMenuPage.openIssuesForProject('Default')
|
||||
|
||||
const issuesPage = new IssuesPage(page)
|
||||
await issuesPage.modelSelectorAll.click()
|
||||
await issuesPage.createNewIssue(newIssue)
|
||||
await issuesPage.searchIssueByName(newIssue.title)
|
||||
await issuesPage.openIssueByName(newIssue.title)
|
||||
|
||||
const issuesDetailsPage = new IssuesDetailsPage(page)
|
||||
await issuesDetailsPage.checkIssue({
|
||||
...newIssue,
|
||||
milestone: 'Milestone',
|
||||
estimation: '2h'
|
||||
})
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue
Block a user