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

TESTS-171: feat(tests): done Check validation steps test #4558

Merged
merged 1 commit into from
Feb 7, 2024
Merged
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
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)
})
})
Loading