mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-09 09:20:54 +00:00
Add test for ISO 13485
Signed-off-by: Jasmin <jasmin@hardcoreeng.com>
This commit is contained in:
parent
a6c84cf798
commit
f78be82307
199
qms-tests/sanity/tests/documents/REQ-13.spec.ts
Normal file
199
qms-tests/sanity/tests/documents/REQ-13.spec.ts
Normal file
@ -0,0 +1,199 @@
|
||||
import { test } from '@playwright/test'
|
||||
import {
|
||||
attachScreenshot,
|
||||
DocumentURI,
|
||||
generateId,
|
||||
getSecondPage,
|
||||
HomepageURI,
|
||||
PlatformSetting,
|
||||
PlatformURI
|
||||
} from '../utils'
|
||||
import { allure } from 'allure-playwright'
|
||||
import { DocumentsPage } from '../model/documents/documents-page'
|
||||
import { DocumentDetails, DocumentRights, DocumentStatus, NewDocument } from '../model/types'
|
||||
import { DocumentContentPage } from '../model/documents/document-content-page'
|
||||
import { prepareDocumentStep } from '../documents/common-documents-steps'
|
||||
|
||||
import { DocumentHistoryPage } from '../model/documents/document-history-page'
|
||||
|
||||
test.use({
|
||||
storageState: PlatformSetting
|
||||
})
|
||||
|
||||
test.describe('ISO 13485, 4.2.4 Control of documents, ensure that the current revision status of and changes to documents are identified', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await (await page.goto(`${PlatformURI}/${HomepageURI}`))?.finished()
|
||||
})
|
||||
|
||||
test('TESTS-325. Create a Several documents with Minor & Major versions', async ({ page, browser }) => {
|
||||
await allure.description(
|
||||
'Requirement\nUsers need to make a resolve all comments and done documents for the Effective status'
|
||||
)
|
||||
await allure.tms('TESTS-325', 'https://front.hc.engineering/workbench/platform/tracker/TESTS-141')
|
||||
const userSecondPage = await getSecondPage(browser)
|
||||
const completeDocument: NewDocument = {
|
||||
template: 'HR (HR)',
|
||||
title: `Complete document-${generateId()}`,
|
||||
description: `Complete document description-${generateId()}`
|
||||
}
|
||||
const reviewer = 'Dirak Kainin'
|
||||
const documentDetails: DocumentDetails = {
|
||||
type: 'HR',
|
||||
category: 'Human Resources',
|
||||
version: 'v0.1',
|
||||
status: DocumentStatus.DRAFT,
|
||||
owner: 'Appleseed John',
|
||||
author: 'Appleseed John'
|
||||
}
|
||||
await prepareDocumentStep(page, completeDocument)
|
||||
|
||||
const documentContentPage = new DocumentContentPage(page)
|
||||
|
||||
await test.step('2. Send for Approval', async () => {
|
||||
await documentContentPage.buttonSendForApproval.click()
|
||||
await documentContentPage.fillSelectApproversForm([reviewer])
|
||||
await documentContentPage.checkDocumentStatus(DocumentStatus.IN_APPROVAL)
|
||||
await documentContentPage.checkDocument({
|
||||
...documentDetails,
|
||||
status: DocumentStatus.IN_APPROVAL,
|
||||
version: 'v0.1'
|
||||
})
|
||||
await documentContentPage.checkCurrentRights(DocumentRights.VIEWING)
|
||||
})
|
||||
|
||||
await test.step('3. Approve document', async () => {
|
||||
const documentsPageSecond = new DocumentsPage(userSecondPage)
|
||||
await (await userSecondPage.goto(`${PlatformURI}/${DocumentURI}`))?.finished()
|
||||
await documentsPageSecond.openDocument(completeDocument.title)
|
||||
|
||||
const documentContentPageSecond = new DocumentContentPage(userSecondPage)
|
||||
await documentContentPageSecond.confirmApproval()
|
||||
|
||||
await documentContentPageSecond.checkDocumentStatus(DocumentStatus.EFFECTIVE)
|
||||
await documentContentPageSecond.checkDocument({
|
||||
...documentDetails,
|
||||
status: DocumentStatus.EFFECTIVE,
|
||||
version: 'v0.1'
|
||||
})
|
||||
await documentContentPageSecond.checkCurrentRights(DocumentRights.VIEWING)
|
||||
|
||||
await attachScreenshot('TESTS-206_approve_document.png', page)
|
||||
})
|
||||
|
||||
await test.step('4. Check document', async () => {
|
||||
await documentContentPage.checkDocumentStatus(DocumentStatus.EFFECTIVE)
|
||||
await documentContentPage.checkDocument({
|
||||
...documentDetails,
|
||||
status: DocumentStatus.EFFECTIVE,
|
||||
version: 'v0.1'
|
||||
})
|
||||
await documentContentPage.checkCurrentRights(DocumentRights.VIEWING)
|
||||
|
||||
await attachScreenshot('TESTS-206_check_document.png', page)
|
||||
})
|
||||
await test.step('5. Check History tab', async () => {
|
||||
await documentContentPage.buttonHistoryTab.first().click()
|
||||
const documentHistoryPage = new DocumentHistoryPage(page)
|
||||
await documentHistoryPage.checkHistoryEventExist('New document creation')
|
||||
await attachScreenshot('TESTS-206_check_history_tab.png', page)
|
||||
await page.waitForTimeout(100)
|
||||
})
|
||||
await test.step('6. Send for Approval v0.2', async () => {
|
||||
await documentContentPage.sendForApproval(
|
||||
'Minor',
|
||||
'v0.2',
|
||||
'Reason 0.2',
|
||||
'impact 0.2',
|
||||
'v0.1',
|
||||
'v0.2',
|
||||
userSecondPage,
|
||||
completeDocument,
|
||||
documentDetails
|
||||
)
|
||||
})
|
||||
|
||||
await test.step('7. Send for Approval minor v0.3', async () => {
|
||||
await documentContentPage.sendForApproval(
|
||||
'Minor',
|
||||
'v0.3',
|
||||
'Reason 0.3',
|
||||
'impact 0.3',
|
||||
'v0.2',
|
||||
'v0.3',
|
||||
userSecondPage,
|
||||
completeDocument,
|
||||
documentDetails
|
||||
)
|
||||
})
|
||||
|
||||
await test.step('8. Send for Approval major v1.0', async () => {
|
||||
await documentContentPage.sendForApproval(
|
||||
'Major',
|
||||
'v1.0',
|
||||
'Reason 1.0',
|
||||
'impact 1.0',
|
||||
'v0.3',
|
||||
'v1.0',
|
||||
userSecondPage,
|
||||
completeDocument,
|
||||
documentDetails
|
||||
)
|
||||
})
|
||||
|
||||
await test.step('9. Send for Approval major v2.0', async () => {
|
||||
await documentContentPage.sendForApproval(
|
||||
'Major',
|
||||
'v2.0',
|
||||
'Reason 2.0',
|
||||
'impact 2.0',
|
||||
'v1.0',
|
||||
'v2.0',
|
||||
userSecondPage,
|
||||
completeDocument,
|
||||
documentDetails
|
||||
)
|
||||
})
|
||||
|
||||
await test.step('10. Send for Approval minor v2.1', async () => {
|
||||
await documentContentPage.sendForApproval(
|
||||
'Minor',
|
||||
'v2.1',
|
||||
'Reason 2.1',
|
||||
'impact 2.1',
|
||||
'v2.0',
|
||||
'v2.1',
|
||||
userSecondPage,
|
||||
completeDocument,
|
||||
documentDetails
|
||||
)
|
||||
})
|
||||
|
||||
await test.step('11. Send for Approval minor v2.2', async () => {
|
||||
await documentContentPage.sendForApproval(
|
||||
'Minor',
|
||||
'v2.2',
|
||||
'Reason 2.2',
|
||||
'impact 2.2',
|
||||
'v2.1',
|
||||
'v2.2',
|
||||
userSecondPage,
|
||||
completeDocument,
|
||||
documentDetails
|
||||
)
|
||||
})
|
||||
|
||||
await test.step('12. Send for Approval minor v2.3', async () => {
|
||||
await documentContentPage.sendForApproval(
|
||||
'Minor',
|
||||
'v2.3',
|
||||
'Reason 2.3',
|
||||
'impact 2.3',
|
||||
'v2.2',
|
||||
'v2.3',
|
||||
userSecondPage,
|
||||
completeDocument,
|
||||
documentDetails
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
@ -1,7 +1,8 @@
|
||||
import { expect, type Locator, type Page } from '@playwright/test'
|
||||
import { Content, DocumentDetails, DocumentRights, DocumentStatus } from '../types'
|
||||
import { Content, DocumentDetails, DocumentRights, DocumentStatus, NewDocument } from '../types'
|
||||
import { DocumentCommonPage } from './document-common-page'
|
||||
import { iterateLocator, PlatformPassword } from '../../utils'
|
||||
import { DocumentHistoryPage } from './document-history-page'
|
||||
|
||||
export class DocumentContentPage extends DocumentCommonPage {
|
||||
readonly page: Page
|
||||
@ -55,6 +56,7 @@ export class DocumentContentPage extends DocumentCommonPage {
|
||||
readonly createDraft: Locator
|
||||
readonly draftNewVersion: Locator
|
||||
readonly buttonHistoryTab: Locator
|
||||
readonly documentHeader: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super(page)
|
||||
@ -119,12 +121,17 @@ export class DocumentContentPage extends DocumentCommonPage {
|
||||
this.createDraft = page.getByRole('button', { name: 'Create Draft' })
|
||||
this.draftNewVersion = page.getByRole('button', { name: 'Draft new version' })
|
||||
this.buttonHistoryTab = page.getByText('History')
|
||||
this.documentHeader = page.getByRole('button', { name: 'Complete document' })
|
||||
}
|
||||
|
||||
async checkDocumentTitle (title: string): Promise<void> {
|
||||
await expect(this.buttonDocumentTitle).toContainText(title)
|
||||
}
|
||||
|
||||
async clickDocumentHeader (name: string): Promise<void> {
|
||||
await this.page.getByRole('button', { name }).click()
|
||||
}
|
||||
|
||||
async updateSectionTitle (sectionId: string, title: string): Promise<void> {
|
||||
await this.page
|
||||
.locator('span.hdr-alignment:not([class*="label"])', { hasText: sectionId })
|
||||
@ -133,6 +140,23 @@ export class DocumentContentPage extends DocumentCommonPage {
|
||||
.fill(title)
|
||||
}
|
||||
|
||||
async addReasonAndImpactToTheDocument (description: string, reason: string): Promise<void> {
|
||||
await this.page.getByText('Reason & Impact').click()
|
||||
await this.page.getByPlaceholder('Describe what was changed...').fill(description)
|
||||
await this.page.getByPlaceholder('Describe why it was changed...').click()
|
||||
await this.page.getByPlaceholder('Describe why it was changed...').fill(reason)
|
||||
}
|
||||
|
||||
async selectRelease (version: string): Promise<void> {
|
||||
await this.page.getByText('Release').click()
|
||||
if (version === 'Major') {
|
||||
await this.page.getByText('Major').click()
|
||||
}
|
||||
if (version === 'Minor') {
|
||||
await this.page.getByText('Minor').click()
|
||||
}
|
||||
}
|
||||
|
||||
async addContentToTheSection (content: Content): Promise<void> {
|
||||
const section = await this.getSectionLocator(content.sectionTitle)
|
||||
await section
|
||||
@ -288,6 +312,40 @@ export class DocumentContentPage extends DocumentCommonPage {
|
||||
}
|
||||
}
|
||||
|
||||
async sendForApproval (
|
||||
releaseType: string,
|
||||
version: string,
|
||||
reason: string,
|
||||
impact: string,
|
||||
prevVersion: string,
|
||||
newVersion: string,
|
||||
userPage: Page,
|
||||
completeDocument: NewDocument,
|
||||
documentDetails: DocumentDetails
|
||||
): Promise<void> {
|
||||
const documentContentPageSecond = new DocumentContentPage(userPage)
|
||||
|
||||
await this.clickDraftNewVersion()
|
||||
await this.selectRelease(releaseType)
|
||||
await this.addReasonAndImpactToTheDocument(reason, impact)
|
||||
await this.buttonSendForApproval.click()
|
||||
await this.buttonSelectMemberSubmit.click()
|
||||
await this.checkDocumentStatus(DocumentStatus.IN_APPROVAL)
|
||||
await this.checkDocument({
|
||||
...documentDetails,
|
||||
status: DocumentStatus.IN_APPROVAL,
|
||||
version
|
||||
})
|
||||
await this.checkCurrentRights(DocumentRights.VIEWING)
|
||||
await documentContentPageSecond.clickDocumentHeader(completeDocument.title + ' ' + prevVersion)
|
||||
await documentContentPageSecond.clickDocumentHeader(completeDocument.title + ' ' + newVersion)
|
||||
await documentContentPageSecond.confirmApproval()
|
||||
await this.buttonHistoryTab.first().click()
|
||||
const documentHistoryPage = new DocumentHistoryPage(this.page)
|
||||
await documentHistoryPage.checkHistoryEventExist('New document creation')
|
||||
await documentHistoryPage.checkHistoryEventExist(reason)
|
||||
}
|
||||
|
||||
async addMessageToTheSectionTitle (title: string, message: string, closePopup: boolean = true): Promise<void> {
|
||||
const locator = await this.getSectionLocator(title)
|
||||
const parentLocator =
|
||||
|
Loading…
Reference in New Issue
Block a user