Skip to content

Commit

Permalink
feat(tests): TESTS-171 done Check validation steps test (#4558)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Velichko <nestor_007@mail.ru>
  • Loading branch information
nestoragent authored Feb 7, 2024
1 parent 2f6c46d commit 7510879
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 2 deletions.
12 changes: 12 additions & 0 deletions tests/sanity/tests/model/common-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,16 @@ export class CommonPage {
async closeNotification (page: Page): Promise<void> {
await page.locator('div.notify-container button[type="button"].small').nth(0).click()
}

async checkError (page: Page, errorMessage: string): Promise<void> {
await expect(page.locator('div.ERROR span')).toHaveText(errorMessage)
}

async checkInfo (page: Page, errorMessage: string): Promise<void> {
await expect(page.locator('div.INFO span')).toHaveText(errorMessage)
}

async checkInfoSectionNotExist (page: Page): Promise<void> {
await expect(page.locator('div.INFO span')).not.toBeAttached()
}
}
4 changes: 3 additions & 1 deletion tests/sanity/tests/model/select-workspace-page.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { expect, type Locator, type Page } from '@playwright/test'
import { CommonPage } from './common-page'

export class SelectWorkspacePage {
export class SelectWorkspacePage extends CommonPage {
readonly page: Page
readonly buttonWorkspace: Locator
readonly buttonCreateWorkspace: Locator
readonly buttonWorkspaceName: Locator
readonly buttonCreateNewWorkspace: Locator

constructor (page: Page) {
super()
this.page = page
this.buttonWorkspace = page.locator('div[class*="workspace"]')
this.buttonCreateWorkspace = page.locator('button > span', { hasText: 'Create workspace' })
Expand Down
4 changes: 3 additions & 1 deletion tests/sanity/tests/model/signup-page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { expect, type Locator, type Page } from '@playwright/test'
import { SignUpData } from './common-types'
import { CommonPage } from './common-page'

export class SignUpPage {
export class SignUpPage extends CommonPage {
readonly page: Page
readonly inputFirstName: Locator
readonly inputLastName: Locator
Expand All @@ -11,6 +12,7 @@ export class SignUpPage {
readonly buttonSignUp: Locator

constructor (page: Page) {
super()
this.page = page
this.inputFirstName = page.locator('input[name="given-name"]')
this.inputLastName = page.locator('input[name="family-name"]')
Expand Down
34 changes: 34 additions & 0 deletions tests/sanity/tests/workspace/create.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,38 @@ test.describe('Workspace tests', () => {
estimation: '2h'
})
})

test('Check validation steps description for the create flow', 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.checkInfo(page, 'Required field First name')
await signUpPage.inputFirstName.fill(newUser.firstName)
await signUpPage.checkInfo(page, 'Required field Last name')
await signUpPage.inputLastName.fill(newUser.lastName)
await signUpPage.checkInfo(page, 'Required field Email')
await signUpPage.inputEmail.fill(newUser.email)
await signUpPage.checkInfo(page, 'Required field Password')
await signUpPage.inputNewPassword.fill(newUser.password)
await signUpPage.checkInfo(page, "Repeat password don't match Password")
await signUpPage.inputRepeatPassword.fill(newUser.password)
await signUpPage.checkInfoSectionNotExist(page)
await signUpPage.buttonSignUp.click()

const selectWorkspacePage = new SelectWorkspacePage(page)
await selectWorkspacePage.buttonCreateWorkspace.click()
await selectWorkspacePage.checkInfo(page, 'Required field Workspace name')
await selectWorkspacePage.buttonWorkspaceName.fill(newWorkspaceName)
await selectWorkspacePage.checkInfoSectionNotExist(page)
})
})

0 comments on commit 7510879

Please sign in to comment.