diff --git a/qms-tests/sanity/tests/documents/REQ-03.spec.ts b/qms-tests/sanity/tests/documents/REQ-03.spec.ts index 3154e6d645..dce0d5329d 100644 --- a/qms-tests/sanity/tests/documents/REQ-03.spec.ts +++ b/qms-tests/sanity/tests/documents/REQ-03.spec.ts @@ -25,6 +25,13 @@ test.describe('ISO 13485, 4.2.4 Control of documents, ensure that the current re await (await page.goto(`${PlatformURI}/${HomepageURI}`))?.finished() }) + test.afterEach(async ({ browser }) => { + const contexts = browser.contexts() + for (const context of contexts) { + await context.close() + } + }) + 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' diff --git a/qms-tests/sanity/tests/documents/REQ-05.spec.ts b/qms-tests/sanity/tests/documents/REQ-05.spec.ts index f5a7c19572..11f9021ba1 100644 --- a/qms-tests/sanity/tests/documents/REQ-05.spec.ts +++ b/qms-tests/sanity/tests/documents/REQ-05.spec.ts @@ -16,6 +16,13 @@ test.describe('ISO 13485, 4.2.4 Control of documents', () => { await (await page.goto(`${PlatformURI}/${HomepageURI}`))?.finished() }) + test.afterEach(async ({ browser }) => { + const contexts = browser.contexts() + for (const context of contexts) { + await context.close() + } + }) + test('TESTS-298. Create a new Category from top right corner', async ({ page }) => { await allure.description('Requirement\nUsers need to create a new category') await allure.tms('TESTS-298', 'https://tracex.hc.engineering/workbench/platform/tracker/TESTS-298') diff --git a/qms-tests/sanity/tests/documents/REQ-14.spec.ts b/qms-tests/sanity/tests/documents/REQ-14.spec.ts new file mode 100644 index 0000000000..ab44785598 --- /dev/null +++ b/qms-tests/sanity/tests/documents/REQ-14.spec.ts @@ -0,0 +1,129 @@ +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 './common-documents-steps' +import { DocumentHistoryPage } from '../model/documents/document-history-page' + +test.use({ + storageState: PlatformSetting +}) + +test.describe('QMS. Documents tests for Control of documents ISO 13485, 4.2.4 FS-150', () => { + test.beforeEach(async ({ page }) => { + await (await page.goto(`${PlatformURI}/${HomepageURI}`))?.finished() + }) + + test.afterEach(async ({ browser }) => { + const contexts = browser.contexts() + for (const context of contexts) { + await context.close() + } + }) + + test('TESTS-384. Create a new doc version and previous one then marked to “Obsolete”', async ({ page, browser }) => { + await allure.description('Requirement\nUsers need to create a new document and new version document') + await allure.tms('TESTS-384', 'https://front.hc.engineering/workbench/platform/tracker/TESTS-384') + 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('TEST-384_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-384_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-384_check_history_tab.png', page) + }) + 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. Check archived status', async () => { + const documentContentPageSecond = new DocumentContentPage(userSecondPage) + await documentContentPage.clickPreviousVersionHeader(userSecondPage, completeDocument, 'v0.2') + await documentContentPage.clickPreviousVersionHeader(userSecondPage, completeDocument, 'v0.1') + await documentContentPageSecond.checkDocument({ + ...documentDetails, + status: DocumentStatus.ARCHIVED, + version: 'v0.1' + }) + await attachScreenshot('TESTS-384_archived_status.png', page) + }) + }) +}) diff --git a/qms-tests/sanity/tests/model/documents/document-content-page.ts b/qms-tests/sanity/tests/model/documents/document-content-page.ts index 1f447b2a5a..c2059843b5 100644 --- a/qms-tests/sanity/tests/model/documents/document-content-page.ts +++ b/qms-tests/sanity/tests/model/documents/document-content-page.ts @@ -236,7 +236,7 @@ export class DocumentContentPage extends DocumentCommonPage { } async selectRelease (version: string): Promise { - await this.page.getByText('Release').click() + await this.page.getByText('Release', { exact: true }).click() if (version === 'Major') { await this.page.getByText('Major').click() } @@ -459,6 +459,11 @@ export class DocumentContentPage extends DocumentCommonPage { await documentHistoryPage.checkHistoryEventExist(reason) } + async clickPreviousVersionHeader (userPage: Page, completeDocument: NewDocument, prevVersion: string): Promise { + const documentContentPageSecond = new DocumentContentPage(userPage) + await documentContentPageSecond.clickDocumentHeader(completeDocument.title + ' ' + prevVersion) + } + async addMessageToTheSectionTitle (title: string, message: string, closePopup: boolean = true): Promise { const locator = await this.getSectionLocator(title) const parentLocator = diff --git a/qms-tests/sanity/tests/model/types.ts b/qms-tests/sanity/tests/model/types.ts index 8e6c698c3c..92e1009118 100644 --- a/qms-tests/sanity/tests/model/types.ts +++ b/qms-tests/sanity/tests/model/types.ts @@ -32,7 +32,8 @@ export enum DocumentStatus { REVIEWED = 'Reviewed', REJECTED = 'Rejected', APPROVED = 'Approved', - EFFECTIVE = 'Effective' + EFFECTIVE = 'Effective', + ARCHIVED = 'Archived' } export interface DocumentDetails {