mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 03:14:40 +03:00
parent
e983d402a5
commit
4e44f73314
@ -75,4 +75,81 @@ test.describe('ISO 13485, 4.2.4 Control of documents ensure that documents of ex
|
|||||||
await attachScreenshot('TESTS-347_manager_document_created.png', page)
|
await attachScreenshot('TESTS-347_manager_document_created.png', page)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('TESTS-402. As a non space member, I cannot see nor edit any doc from that space', async ({ page }) => {
|
||||||
|
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-402', 'https://tracex.hc.engineering/workbench/platform/tracker/TESTS-402')
|
||||||
|
await test.step('2. check if non member can see space', async () => {
|
||||||
|
const folderName = faker.word.words(1)
|
||||||
|
const documentContentPage = new DocumentContentPage(page)
|
||||||
|
await documentContentPage.clickAddFolderButton()
|
||||||
|
await documentContentPage.fillDocumentSpaceFormManager(folderName)
|
||||||
|
await documentContentPage.changeDocumentSpaceMembers(folderName)
|
||||||
|
await documentContentPage.checkIfTheSpaceIsVisible(folderName, false)
|
||||||
|
await attachScreenshot('TESTS-402_space_not_existing.png', page)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
test('TESTS-403. As a space member only, I cannot edit any doc from that space', async ({ page }) => {
|
||||||
|
await allure.description(
|
||||||
|
'Requirement\nUser is only part as a member and cannot see or edit any document from that space'
|
||||||
|
)
|
||||||
|
await allure.tms('TESTS-403', 'https://tracex.hc.engineering/workbench/platform/tracker/TESTS-403')
|
||||||
|
await test.step('2. check if non member edit or create a new doc in space', async () => {
|
||||||
|
const folderName = faker.word.words(1)
|
||||||
|
const documentContentPage = new DocumentContentPage(page)
|
||||||
|
const completeDocument: NewDocument = {
|
||||||
|
template: 'HR (HR)',
|
||||||
|
title: `Complete document-${generateId()}`,
|
||||||
|
description: `Complete document description-${generateId()}`
|
||||||
|
}
|
||||||
|
await documentContentPage.clickAddFolderButton()
|
||||||
|
await documentContentPage.fillDocumentSpaceFormManager(folderName)
|
||||||
|
await prepareDocumentStep(page, completeDocument, 1, undefined, folderName)
|
||||||
|
await documentContentPage.checkTeamMembersReviewerCoauthorApproverNotExists()
|
||||||
|
await attachScreenshot('TESTS-403_member_cant_edit_space.png', page)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
test('TESTS-404. As a space member only, I cannot create any doc from that space', async ({ page }) => {
|
||||||
|
await allure.description('Requirement\nUser is not able to create any document from that space')
|
||||||
|
await allure.tms('TESTS-404', 'https://tracex.hc.engineering/workbench/platform/tracker/TESTS-404')
|
||||||
|
await test.step('2. cCheck if user can not create documents as a space member', async () => {
|
||||||
|
const folderName = faker.word.words(1)
|
||||||
|
const documentContentPage = new DocumentContentPage(page)
|
||||||
|
await documentContentPage.clickAddFolderButton()
|
||||||
|
await documentContentPage.createDocumentSpaceMembersToJustMember(folderName)
|
||||||
|
await documentContentPage.checkIfEditSpaceButtonExists(folderName, false)
|
||||||
|
await page.keyboard.press('Escape')
|
||||||
|
await documentContentPage.checkIfUserCanSelectSpace(folderName, false)
|
||||||
|
await attachScreenshot('TESTS-404_non_space_member_can_not_create_documents.png', page)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
test('TESTS-405. As a Manager space member, I can delete a doc I have previously created', async ({ page }) => {
|
||||||
|
await allure.description('Requirement\nUser is not able to create any document from that space')
|
||||||
|
const completeDocument: NewDocument = {
|
||||||
|
template: 'HR (HR)',
|
||||||
|
title: `Complete document-${generateId()}`,
|
||||||
|
description: `Complete document description-${generateId()}`
|
||||||
|
}
|
||||||
|
await allure.tms('TESTS-405', 'https://tracex.hc.engineering/workbench/platform/tracker/TESTS-405')
|
||||||
|
await test.step('2. cCheck if user can not create documents as a space member', async () => {
|
||||||
|
const folderName = faker.word.words(1)
|
||||||
|
const documentContentPage = new DocumentContentPage(page)
|
||||||
|
await documentContentPage.clickAddFolderButton()
|
||||||
|
await documentContentPage.fillQuaraManager(folderName)
|
||||||
|
// check if user can create document in space
|
||||||
|
await prepareDocumentStep(page, completeDocument, 1, undefined, folderName)
|
||||||
|
await documentContentPage.executeMoreActions('Delete')
|
||||||
|
})
|
||||||
|
|
||||||
|
await test.step('3. Check that the document status is equal to deleted status', async () => {
|
||||||
|
const documentContentPage = new DocumentContentPage(page)
|
||||||
|
await documentContentPage.checkDocumentStatus(DocumentStatus.DELETED)
|
||||||
|
})
|
||||||
|
await attachScreenshot('TESTS-405_status_is_deleted.png', page)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
@ -6,7 +6,13 @@ import { NavigationMenuPage } from '../model/documents/navigation-menu-page'
|
|||||||
import { CategoriesPage } from '../model/documents/categories-page'
|
import { CategoriesPage } from '../model/documents/categories-page'
|
||||||
import { CategoryCreatePopup } from '../model/documents/category-create-popup'
|
import { CategoryCreatePopup } from '../model/documents/category-create-popup'
|
||||||
|
|
||||||
export async function prepareDocumentStep (page: Page, document: NewDocument, stepNumber: number = 1): Promise<void> {
|
export async function prepareDocumentStep (
|
||||||
|
page: Page,
|
||||||
|
document: NewDocument,
|
||||||
|
stepNumber: number = 1,
|
||||||
|
startSecondStep?: boolean,
|
||||||
|
spaceName?: string
|
||||||
|
): Promise<void> {
|
||||||
await test.step(`${stepNumber}. Create a new document`, async () => {
|
await test.step(`${stepNumber}. Create a new document`, async () => {
|
||||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||||
await leftSideMenuPage.buttonDocuments.click()
|
await leftSideMenuPage.buttonDocuments.click()
|
||||||
@ -14,7 +20,7 @@ export async function prepareDocumentStep (page: Page, document: NewDocument, st
|
|||||||
const documentsPage = new DocumentsPage(page)
|
const documentsPage = new DocumentsPage(page)
|
||||||
await documentsPage.buttonCreateDocument.click()
|
await documentsPage.buttonCreateDocument.click()
|
||||||
|
|
||||||
await documentsPage.createDocument(document)
|
await documentsPage.createDocument(document, startSecondStep, spaceName)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,6 @@ test.describe('QMS. Documents tests', () => {
|
|||||||
await documentContentPage.checkDocumentTitle(deleteDocument.title)
|
await documentContentPage.checkDocumentTitle(deleteDocument.title)
|
||||||
await documentContentPage.checkDocumentStatus(DocumentStatus.DRAFT)
|
await documentContentPage.checkDocumentStatus(DocumentStatus.DRAFT)
|
||||||
await documentContentPage.executeMoreActions('Delete')
|
await documentContentPage.executeMoreActions('Delete')
|
||||||
await documentContentPage.pressYesForPopup(page)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
await test.step('3. Check that the document status is equal to deleted status', async () => {
|
await test.step('3. Check that the document status is equal to deleted status', async () => {
|
||||||
|
@ -93,7 +93,6 @@ test.describe('QMS. Templates tests', () => {
|
|||||||
|
|
||||||
await test.step('2. Delete the template', async () => {
|
await test.step('2. Delete the template', async () => {
|
||||||
await documentContentPage.executeMoreActions('Delete')
|
await documentContentPage.executeMoreActions('Delete')
|
||||||
await documentContentPage.pressYesForPopup(page)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
await test.step('3. Check that the document status is equal to the deleted', async () => {
|
await test.step('3. Check that the document status is equal to the deleted', async () => {
|
||||||
|
@ -81,6 +81,8 @@ export class DocumentContentPage extends DocumentCommonPage {
|
|||||||
readonly addMember: Locator
|
readonly addMember: Locator
|
||||||
readonly addMemberDropdown: Locator
|
readonly addMemberDropdown: Locator
|
||||||
readonly changeSpaceButton: Locator
|
readonly changeSpaceButton: Locator
|
||||||
|
readonly createNewTemplateFromSpace: Locator
|
||||||
|
readonly okButton: Locator
|
||||||
|
|
||||||
constructor (page: Page) {
|
constructor (page: Page) {
|
||||||
super(page)
|
super(page)
|
||||||
@ -168,10 +170,12 @@ export class DocumentContentPage extends DocumentCommonPage {
|
|||||||
this.qualityButtonMembers = page.getByRole('button', { name: 'AJ DK AQ 3 members' }).first()
|
this.qualityButtonMembers = page.getByRole('button', { name: 'AJ DK AQ 3 members' }).first()
|
||||||
this.userMemberCainVelasquez = page.getByRole('button', { name: 'VC Velasquez Cain' })
|
this.userMemberCainVelasquez = page.getByRole('button', { name: 'VC Velasquez Cain' })
|
||||||
this.qualityDocument = page.getByRole('button', { name: 'Quality documents' })
|
this.qualityDocument = page.getByRole('button', { name: 'Quality documents' })
|
||||||
this.saveButton = page.getByRole('button', { name: 'Save' })
|
this.saveButton = page.getByRole('button', { name: 'Save', exact: true })
|
||||||
this.addMember = page.getByText('Add member')
|
this.addMember = page.getByText('Add member')
|
||||||
this.addMemberDropdown = page.locator('.selectPopup')
|
this.addMemberDropdown = page.locator('.selectPopup')
|
||||||
this.changeSpaceButton = page.locator('[id="space\\.selector"]')
|
this.changeSpaceButton = page.locator('[id="space\\.selector"]')
|
||||||
|
this.createNewTemplateFromSpace = page.getByRole('button', { name: 'Create new template' })
|
||||||
|
this.okButton = page.getByRole('button', { name: 'Ok', exact: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkDocumentTitle (title: string): Promise<void> {
|
async checkDocumentTitle (title: string): Promise<void> {
|
||||||
@ -306,6 +310,9 @@ export class DocumentContentPage extends DocumentCommonPage {
|
|||||||
async executeMoreActions (action: string): Promise<void> {
|
async executeMoreActions (action: string): Promise<void> {
|
||||||
await this.buttonMoreActions.click()
|
await this.buttonMoreActions.click()
|
||||||
await this.selectFromDropdown(this.page, action)
|
await this.selectFromDropdown(this.page, action)
|
||||||
|
if (action === 'Delete') {
|
||||||
|
await this.okButton.click()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkIfFolderExists (folderName: string): Promise<void> {
|
async checkIfFolderExists (folderName: string): Promise<void> {
|
||||||
@ -344,6 +351,15 @@ export class DocumentContentPage extends DocumentCommonPage {
|
|||||||
await this.createButton.click()
|
await this.createButton.click()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fillQuaraManager (spaceName: string): Promise<void> {
|
||||||
|
await this.inputSpaceName.fill(spaceName)
|
||||||
|
await this.roleSelector.nth(2).click()
|
||||||
|
await this.page.getByRole('button', { name: 'DK Dirak Kainin' }).nth(2).click()
|
||||||
|
await this.page.keyboard.press('Escape')
|
||||||
|
await this.page.waitForTimeout(1000)
|
||||||
|
await this.createButton.click()
|
||||||
|
}
|
||||||
|
|
||||||
async fillDocumentSpaceFormManager (spaceName: string): Promise<void> {
|
async fillDocumentSpaceFormManager (spaceName: string): Promise<void> {
|
||||||
await this.inputSpaceName.fill(spaceName)
|
await this.inputSpaceName.fill(spaceName)
|
||||||
await this.roleSelector.nth(1).click()
|
await this.roleSelector.nth(1).click()
|
||||||
@ -353,6 +369,53 @@ export class DocumentContentPage extends DocumentCommonPage {
|
|||||||
await this.createButton.click()
|
await this.createButton.click()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async changeDocumentSpaceMembers (spaceName: string): Promise<void> {
|
||||||
|
await this.page.getByRole('button', { name: spaceName }).hover()
|
||||||
|
await this.page.getByRole('button', { name: spaceName }).getByRole('button').click()
|
||||||
|
await this.editDocumentSpace.click()
|
||||||
|
await this.page.getByRole('button', { name: 'DK Dirak Kainin' }).first().click()
|
||||||
|
await this.page.getByRole('button', { name: 'DK Dirak Kainin' }).nth(3).click()
|
||||||
|
await this.page.getByRole('button', { name: 'AJ Appleseed John' }).click()
|
||||||
|
await this.page.keyboard.press('Escape')
|
||||||
|
await this.page.getByRole('button', { name: 'AJ DK 2 members' }).click()
|
||||||
|
await this.page.getByRole('button', { name: 'DK Dirak Kainin' }).nth(1).click()
|
||||||
|
await this.page.keyboard.press('Escape')
|
||||||
|
await this.page.waitForTimeout(1000)
|
||||||
|
await this.saveButton.click()
|
||||||
|
}
|
||||||
|
|
||||||
|
async createDocumentSpaceMembersToJustMember (spaceName: string): Promise<void> {
|
||||||
|
await this.inputSpaceName.fill(spaceName)
|
||||||
|
await this.page.getByRole('button', { name: 'DK Dirak Kainin' }).first().click()
|
||||||
|
await this.page.getByRole('button', { name: 'AJ Appleseed John' }).click()
|
||||||
|
await this.page.getByRole('button', { name: 'DK Dirak Kainin' }).nth(1).click()
|
||||||
|
await this.page.keyboard.press('Escape')
|
||||||
|
await this.page.waitForTimeout(1000)
|
||||||
|
await this.createButton.click()
|
||||||
|
}
|
||||||
|
|
||||||
|
async checkIfTheSpaceIsVisible (spaceName: string, visible: boolean): Promise<void> {
|
||||||
|
if (visible) {
|
||||||
|
await expect(this.page.getByRole('button', { name: spaceName })).toBeVisible()
|
||||||
|
} else {
|
||||||
|
await expect(this.page.getByRole('button', { name: spaceName })).not.toBeVisible()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async checkIfEditSpaceButtonExists (spaceName: string, visible: boolean): Promise<void> {
|
||||||
|
await this.page.getByRole('button', { name: spaceName }).hover()
|
||||||
|
await this.page.getByRole('button', { name: spaceName }).getByRole('button').click()
|
||||||
|
if (visible) {
|
||||||
|
await expect(this.editDocumentSpace).toBeVisible()
|
||||||
|
await expect(this.qualityButtonMembers).toBeVisible()
|
||||||
|
await expect(this.createNewTemplateFromSpace).toBeVisible()
|
||||||
|
} else {
|
||||||
|
await expect(this.createNewDocument).not.toBeVisible()
|
||||||
|
await expect(this.editDocumentSpace).not.toBeVisible()
|
||||||
|
await expect(this.createNewTemplateFromSpace).not.toBeVisible()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async checkSpaceFormIsCreated (spaceName: string): Promise<void> {
|
async checkSpaceFormIsCreated (spaceName: string): Promise<void> {
|
||||||
await expect(this.page.getByRole('button', { name: spaceName })).toBeVisible()
|
await expect(this.page.getByRole('button', { name: spaceName })).toBeVisible()
|
||||||
}
|
}
|
||||||
@ -404,6 +467,19 @@ export class DocumentContentPage extends DocumentCommonPage {
|
|||||||
await this.checkDocumentStatus(DocumentStatus.DRAFT)
|
await this.checkDocumentStatus(DocumentStatus.DRAFT)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async checkTeamMembersReviewerCoauthorApproverNotExists (): Promise<void> {
|
||||||
|
await this.page.waitForTimeout(500)
|
||||||
|
await this.page.getByText('Team').click()
|
||||||
|
await this.page.getByText('Add member').first().click()
|
||||||
|
await expect(this.page.getByRole('button', { name: 'AJ Appleseed John' })).not.toBeVisible()
|
||||||
|
await this.page.keyboard.press('Escape')
|
||||||
|
await this.page.getByText('Add member').nth(1).click()
|
||||||
|
await expect(this.page.getByRole('button', { name: 'AJ Appleseed John' })).not.toBeVisible()
|
||||||
|
await this.page.keyboard.press('Escape')
|
||||||
|
await this.page.getByText('Add member').nth(2).click()
|
||||||
|
await expect(this.page.getByRole('button', { name: 'AJ Appleseed John' })).not.toBeVisible()
|
||||||
|
}
|
||||||
|
|
||||||
async checkIfHistoryVersionExists (description: string): Promise<void> {
|
async checkIfHistoryVersionExists (description: string): Promise<void> {
|
||||||
await this.page.waitForTimeout(200)
|
await this.page.waitForTimeout(200)
|
||||||
await expect(this.page.getByText(description)).toBeVisible()
|
await expect(this.page.getByText(description)).toBeVisible()
|
||||||
@ -554,6 +630,18 @@ export class DocumentContentPage extends DocumentCommonPage {
|
|||||||
await expect(this.page.locator('span.text-editor-highlighted-node-delete', { hasText: text }).first()).toBeVisible()
|
await expect(this.page.locator('span.text-editor-highlighted-node-delete', { hasText: text }).first()).toBeVisible()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async checkIfUserCanSelectSpace (space: string, spaceExists: boolean): Promise<void> {
|
||||||
|
await expect(this.page.getByRole('button', { name: space, exact: true })).toBeVisible()
|
||||||
|
await this.page.getByRole('button', { name: 'New document' }).click()
|
||||||
|
await this.changeSpaceButton.click()
|
||||||
|
if (spaceExists) {
|
||||||
|
await expect(this.page.getByRole('button', { name: space, exact: true }).nth(1)).toBeVisible()
|
||||||
|
}
|
||||||
|
if (!spaceExists) {
|
||||||
|
await expect(this.page.getByRole('button', { name: space, exact: true }).nth(1)).not.toBeVisible()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async openApprovals (): Promise<void> {
|
async openApprovals (): Promise<void> {
|
||||||
await expect(this.buttonDocumentApprovals).toBeVisible()
|
await expect(this.buttonDocumentApprovals).toBeVisible()
|
||||||
await this.buttonDocumentApprovals.click({ position: { x: 1, y: 1 }, force: true })
|
await this.buttonDocumentApprovals.click({ position: { x: 1, y: 1 }, force: true })
|
||||||
|
@ -40,7 +40,11 @@ export class DocumentsPage extends CalendarPage {
|
|||||||
this.changeSpaceButton = page.locator('[id="space\\.selector"]')
|
this.changeSpaceButton = page.locator('[id="space\\.selector"]')
|
||||||
}
|
}
|
||||||
|
|
||||||
async createDocument (data: NewDocument, startSecondStep: boolean = false): Promise<void> {
|
async createDocument (
|
||||||
|
data: NewDocument,
|
||||||
|
startSecondStep: boolean = false,
|
||||||
|
changeSpaceInCreateDocument: string = 'Quality documents'
|
||||||
|
): Promise<void> {
|
||||||
if (data.location != null) {
|
if (data.location != null) {
|
||||||
await this.buttonSpaceSelector.click()
|
await this.buttonSpaceSelector.click()
|
||||||
await this.selectListItemWithSearch(this.page, data.location.space ?? '')
|
await this.selectListItemWithSearch(this.page, data.location.space ?? '')
|
||||||
@ -50,7 +54,7 @@ export class DocumentsPage extends CalendarPage {
|
|||||||
|
|
||||||
// template
|
// template
|
||||||
if (!startSecondStep) {
|
if (!startSecondStep) {
|
||||||
await this.changeSpaceInCreateDocumentForm('Quality documents')
|
await this.changeSpaceInCreateDocumentForm(changeSpaceInCreateDocument)
|
||||||
await this.buttonPopupNextStep.click()
|
await this.buttonPopupNextStep.click()
|
||||||
}
|
}
|
||||||
await this.page.locator('div.templates div.tmpHeader', { hasText: data.template }).click()
|
await this.page.locator('div.templates div.tmpHeader', { hasText: data.template }).click()
|
||||||
|
Loading…
Reference in New Issue
Block a user