Skip to content

Commit

Permalink
uberf-8425: more qms fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Zinoviev <[email protected]>
  • Loading branch information
lexiv0re committed Jan 13, 2025
1 parent 6aaadf3 commit 9027d31
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 14 deletions.
1 change: 1 addition & 0 deletions dev/prod/public/branding.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"defaultApplication": "documents",
"defaultSpace": "documents:space:QualityDocuments",
"defaultSpecial": "",
"lastNameFirst": "true",
"links": [
{
"rel": "shortcut icon",
Expand Down
10 changes: 9 additions & 1 deletion qms-tests/sanity/tests/auth/auth.setup.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import { test as setup, Page } from '@playwright/test'
import path from 'path'

import { PlatformUser, PlatformUserSecond, PlatformUserThird, PlatformUserQara, PlatformWs, PlatformURI, setTestOptions } from '../utils'
import {
PlatformUser,
PlatformUserSecond,
PlatformUserThird,
PlatformUserQara,
PlatformWs,
PlatformURI,
setTestOptions
} from '../utils'
import { LoginPage } from '../model/login-page'
import { SelectWorkspacePage } from '../model/select-workspace-page'

Expand Down
4 changes: 0 additions & 4 deletions qms-tests/sanity/tests/documents/ES-40.2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,20 @@ test.describe('login test', () => {
})

test('check login', async () => {
await loginPage.clickOnLoginWithPassword()
await loginPage.login(PlatformUser, '1234')
})

test('TESTS-392 - As a non workspace user account I cannot log into TraceX', async () => {
await loginPage.clickOnLoginWithPassword()
await loginPage.login('Wrong User', 'Wrong password')
await loginPage.checkIfErrorMessageIsShown('Account not found or the provided credentials are incorrect')
})

test('TESTS-396 - Correct email and wrong password: I cannot log in', async () => {
await loginPage.clickOnLoginWithPassword()
await loginPage.login(PlatformUser, 'Wrong password')
await loginPage.checkIfErrorMessageIsShown('Account not found or the provided credentials are incorrect')
})

test('TESTS-397 - Wrong email and correct password: I cannot log in', async () => {
await loginPage.clickOnLoginWithPassword()
await loginPage.login('Wrong User', '1234')
await loginPage.checkIfErrorMessageIsShown('Account not found or the provided credentials are incorrect')
})
Expand Down
27 changes: 25 additions & 2 deletions qms-tests/sanity/tests/documents/ES-40.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
import { test } from '@playwright/test'
import { attachScreenshot, HomepageURI, PlatformSettingSecond, PlatformURI, waitForNetworIdle } from '../utils'
import {
attachScreenshot,
getNewPage,
HomepageURI,
PlatformSettingSecond,
PlatformURI,
PlatformWs,
waitForNetworIdle
} from '../utils'
import { allure } from 'allure-playwright'
import { DocumentContentPage } from '../model/documents/document-content-page'
import { faker } from '@faker-js/faker'
import { LoginPage } from '../model/login-page'
import { SelectWorkspacePage } from '../model/select-workspace-page'

test.use({
storageState: PlatformSettingSecond
Expand Down Expand Up @@ -35,11 +45,24 @@ test.describe('ISO 13485, 4.2.4 Control of documents ensure that documents of ex
})
})

test('TESTS-388. As a workspace owner, I can remove a user from workspace', async ({ page }) => {
test('TESTS-388. As a workspace owner, I can remove a user from workspace', async ({ page, browser }) => {
await allure.description(
'Requirement\nUser is not a part of space members and cannot see or edit any document from that space'
)
await allure.tms('TESTS-388', 'https://tracex.hc.engineering/workbench/platform/tracker/TESTS-388')

await test.step('1. login with new user so employee is created', async () => {
const anotherPage = await getNewPage(browser)
const loginPage = new LoginPage(anotherPage)
await loginPage.goto()
await loginPage.login('user4', '1234')
const swp = new SelectWorkspacePage(anotherPage)
await swp.selectWorkspace(PlatformWs)
await page.waitForURL((url) => {
return url.pathname.startsWith(`/workbench/${PlatformWs}/`)
})
})

await test.step('2. check if owner can kick user from workspace', async () => {
const documentContentPage = new DocumentContentPage(page)
await documentContentPage.clickContacts()
Expand Down
3 changes: 0 additions & 3 deletions qms-tests/sanity/tests/login/registration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ test.describe('Registration tests', () => {
await allure.tms('TESTS-396', 'https://front.hc.engineering/workbench/platform/tracker/TESTS-396')
await test.step('1. Try to login with wrong password', async () => {
const loginPage = new LoginPage(page)
await loginPage.loginWithPassword.click()
await loginPage.login('user1', 'wrongPassword')
await loginPage.checkIfUserIsLoggedIn('wrong-password')
})
Expand All @@ -94,7 +93,6 @@ test.describe('Registration tests', () => {
await allure.tms('TESTS-397', 'https://front.hc.engineering/workbench/platform/tracker/TESTS-397')
await test.step('1. Try to login with wrong email', async () => {
const loginPage = new LoginPage(page)
await loginPage.loginWithPassword.click()
await loginPage.login('wrongEmail', '1234')
await loginPage.checkIfUserIsLoggedIn('wrong-email')
})
Expand All @@ -106,7 +104,6 @@ test.describe('Registration tests', () => {
await allure.tms('TESTS-398', 'https://front.hc.engineering/workbench/platform/tracker/TESTS-397')
await test.step('1. Try to login with working credentials', async () => {
const loginPage = new LoginPage(page)
await loginPage.loginWithPassword.click()
await loginPage.login('user1', '1234')
await loginPage.checkIfUserIsLoggedIn('correct-credentials')
})
Expand Down
4 changes: 0 additions & 4 deletions qms-tests/sanity/tests/model/login-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ export class LoginPage {
}
}

async clickOnLoginWithPassword (): Promise<void> {
await this.loginWithPassword.click()
}

async checkIfUserIsLoggedIn (credentials: string): Promise<void> {
if (credentials === 'wrong-email' || credentials === 'wrong-password') {
await expect(this.buttonLogin).toBeVisible()
Expand Down
5 changes: 5 additions & 0 deletions qms-tests/sanity/tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ export async function getSecondPage (browser: Browser): Promise<Page> {
return await userSecondContext.newPage()
}

export async function getNewPage (browser: Browser): Promise<Page> {
const context = await browser.newContext({ storageState: undefined })
return await context.newPage()
}

export function randomString (): string {
return (Math.random() * 1000000).toString(36).replace('.', '')
}
Expand Down

0 comments on commit 9027d31

Please sign in to comment.