mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-23 00:37:47 +00:00
parent
af66d716e0
commit
1b598b9ad8
@ -23611,10 +23611,11 @@ packages:
|
||||
dev: false
|
||||
|
||||
file:projects/qms-tests-sanity.tgz:
|
||||
resolution: {integrity: sha512-ntTsOcgNEYuQVnuTv8IDdeGHDmCqEJpcQijo2H/OJJlOfHBj52ijRQCFB8Jnhv6L2RLEV9euSHAk+VGxvWsqyw==, tarball: file:projects/qms-tests-sanity.tgz}
|
||||
resolution: {integrity: sha512-2NJnLTGNRdrMXybXslRQNNCyyDLmsA069UyXn8uBG/WQaMHzr9rTXvtRpltXSfgCn+WAc8VidyT68O6J8RAPQA==, tarball: file:projects/qms-tests-sanity.tgz}
|
||||
name: '@rush-temp/qms-tests-sanity'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@faker-js/faker': 8.4.1
|
||||
'@playwright/test': 1.41.2
|
||||
'@types/jest': 29.5.12
|
||||
'@types/node': 20.11.19
|
||||
|
@ -42,7 +42,8 @@
|
||||
"prettier": "^3.1.0",
|
||||
"typescript": "^5.3.3",
|
||||
"@playwright/test": "^1.41.2",
|
||||
"allure-playwright": "^2.9.2"
|
||||
"allure-playwright": "^2.9.2",
|
||||
"@faker-js/faker": "^8.4.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"dotenv": "~16.0.0",
|
||||
|
198
qms-tests/sanity/tests/documents/REQ-13.spec.ts
Normal file
198
qms-tests/sanity/tests/documents/REQ-13.spec.ts
Normal file
@ -0,0 +1,198 @@
|
||||
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-325')
|
||||
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-325_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-325_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-325_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. 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
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
@ -20,6 +20,7 @@ import { DocumentReleasePage } from '../model/documents/document-release-page'
|
||||
import { DocumentReasonAndImpactPage } from '../model/documents/document-reason-impact-page'
|
||||
import { LeftSideMenuPage } from '../model/left-side-menu-page'
|
||||
import { DocumentHistoryPage } from '../model/documents/document-history-page'
|
||||
import { faker } from '@faker-js/faker'
|
||||
|
||||
test.use({
|
||||
storageState: PlatformSetting
|
||||
@ -30,6 +31,13 @@ test.describe('QMS. Documents tests', () => {
|
||||
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-123. Create a document', async ({ page }) => {
|
||||
await allure.description('Requirement\nUsers need to create a new document')
|
||||
await allure.tms('TESTS-123', 'https://front.hc.engineering/workbench/platform/tracker/TESTS-123')
|
||||
@ -804,7 +812,7 @@ test.describe('QMS. Documents tests', () => {
|
||||
})
|
||||
|
||||
await test.step('10. Check History tab', async () => {
|
||||
await documentContentPage.buttonHistoryTab.click()
|
||||
await documentContentPage.buttonHistoryTab.first().click()
|
||||
|
||||
const documentHistoryPage = new DocumentHistoryPage(page)
|
||||
await documentHistoryPage.checkHistoryEventExist('New document creation')
|
||||
@ -1064,6 +1072,234 @@ test.describe('QMS. Documents tests', () => {
|
||||
})
|
||||
})
|
||||
|
||||
test('TESTS-206. Send for approval document after resolve comments', 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-206', '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'
|
||||
}
|
||||
const newContentFirst: Content = {
|
||||
sectionTitle: `Complete document. Overview-${generateId()}`,
|
||||
content: `Complete document. New content-${generateId()}!!!!`
|
||||
}
|
||||
const updateContentFirst: Content = {
|
||||
sectionTitle: `Complete document Updated. Updated Overview-${generateId()}`,
|
||||
content: `Complete document Updated. Updated content-${generateId()}!!!!`
|
||||
}
|
||||
const newContentSecond: Content = {
|
||||
sectionTitle: `Complete document. Description-${generateId()}`,
|
||||
content: `Complete document. New content Description-${generateId()}!!!!`
|
||||
}
|
||||
const messageToTitle: string = `Complete document. Message to the first title-${generateId()}`
|
||||
const messageToContent: string = `Complete document. Message to the content-${generateId()}`
|
||||
|
||||
await prepareDocumentStep(page, completeDocument)
|
||||
|
||||
const documentContentPage = new DocumentContentPage(page)
|
||||
await test.step('2. Add section and content', async () => {
|
||||
await documentContentPage.checkDocumentTitle(completeDocument.title)
|
||||
await documentContentPage.checkDocumentStatus(DocumentStatus.DRAFT)
|
||||
await documentContentPage.checkDocument(documentDetails)
|
||||
await documentContentPage.checkCurrentRights(DocumentRights.EDITING)
|
||||
|
||||
await documentContentPage.updateSectionTitle('1', newContentFirst.sectionTitle)
|
||||
await documentContentPage.addContentToTheSection(newContentFirst)
|
||||
|
||||
await documentContentPage.addNewSection('1', 'below')
|
||||
await documentContentPage.updateSectionTitle('2', newContentSecond.sectionTitle)
|
||||
await documentContentPage.addContentToTheSection(newContentSecond)
|
||||
await attachScreenshot('TESTS-206_add_section_and_content.png', page)
|
||||
})
|
||||
|
||||
await test.step('3. Send for Review', async () => {
|
||||
await documentContentPage.buttonSendForReview.click()
|
||||
await documentContentPage.fillSelectReviewersForm([reviewer])
|
||||
await documentContentPage.checkDocumentStatus(DocumentStatus.IN_REVIEW)
|
||||
await documentContentPage.checkDocument({
|
||||
...documentDetails,
|
||||
status: DocumentStatus.IN_REVIEW
|
||||
})
|
||||
await attachScreenshot('TESTS-206_send_for_review.png', page)
|
||||
})
|
||||
|
||||
await test.step('4. As author add comments to the first section', async () => {
|
||||
await documentContentPage.addMessageToTheSectionTitle(newContentFirst.sectionTitle, messageToTitle)
|
||||
await documentContentPage.addMessageToTheText(newContentFirst.content, messageToContent)
|
||||
|
||||
await documentContentPage.buttonComments.click()
|
||||
|
||||
const documentCommentsPage = new DocumentCommentsPage(page)
|
||||
await documentCommentsPage.checkCommentExist(newContentFirst.sectionTitle, 2)
|
||||
await documentCommentsPage.checkCommentCanBeResolved(newContentFirst.sectionTitle, 1)
|
||||
await documentCommentsPage.checkCommentCanBeResolved(newContentFirst.sectionTitle, 2)
|
||||
await attachScreenshot('TESTS-206_author_add_comments.png', page)
|
||||
})
|
||||
|
||||
await test.step('5. As reviewer add comments to the second section and Complete Review', async () => {
|
||||
await (await userSecondPage.goto(`${PlatformURI}/${DocumentURI}`))?.finished()
|
||||
|
||||
const documentsPageSecond = new DocumentsPage(userSecondPage)
|
||||
await documentsPageSecond.openDocument(completeDocument.title)
|
||||
|
||||
const documentContentPageSecond = new DocumentContentPage(userSecondPage)
|
||||
await documentContentPageSecond.addMessageToTheSectionTitle(newContentSecond.sectionTitle, messageToTitle)
|
||||
await documentContentPageSecond.addMessageToTheText(newContentSecond.content, messageToContent)
|
||||
|
||||
await documentContentPageSecond.buttonComments.click()
|
||||
|
||||
const documentCommentsPageSecond = new DocumentCommentsPage(userSecondPage)
|
||||
await documentCommentsPageSecond.checkCommentExist(newContentSecond.sectionTitle, 2)
|
||||
await documentCommentsPageSecond.checkCommentCanBeResolved(newContentSecond.sectionTitle, 3)
|
||||
await documentCommentsPageSecond.checkCommentCanBeResolved(newContentSecond.sectionTitle, 4)
|
||||
|
||||
await documentContentPageSecond.completeReview()
|
||||
|
||||
await documentContentPageSecond.checkDocumentStatus(DocumentStatus.REVIEWED)
|
||||
await documentContentPageSecond.checkCurrentRights(DocumentRights.VIEWING)
|
||||
await attachScreenshot('TESTS-206_reviewer_add_comments.png', page)
|
||||
})
|
||||
|
||||
await test.step('6. Update Document and fix reviews', async () => {
|
||||
await documentContentPage.buttonEditDocument.click()
|
||||
|
||||
await documentContentPage.updateSectionTitle('1', updateContentFirst.sectionTitle)
|
||||
await documentContentPage.addContentToTheSection(updateContentFirst)
|
||||
await documentContentPage.checkContentForTheSection(updateContentFirst)
|
||||
|
||||
const documentCommentsPage = new DocumentCommentsPage(page)
|
||||
await documentCommentsPage.checkCommentExist(updateContentFirst.sectionTitle, 2)
|
||||
await documentCommentsPage.resolveAllComments()
|
||||
|
||||
await documentCommentsPage.checkCommentNotExist(updateContentFirst.sectionTitle)
|
||||
await attachScreenshot('TESTS-206_fix_reviews.png', page)
|
||||
|
||||
await documentContentPage.buttonDocumentInformation.click()
|
||||
await documentContentPage.checkDocumentStatus(DocumentStatus.DRAFT)
|
||||
await documentContentPage.checkDocument({
|
||||
...documentDetails,
|
||||
status: DocumentStatus.DRAFT,
|
||||
version: 'v0.1'
|
||||
})
|
||||
await attachScreenshot('TESTS-206_check_document.png', page)
|
||||
})
|
||||
|
||||
await test.step('7. 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('8. Approve document', async () => {
|
||||
const documentsPageSecond = new DocumentsPage(userSecondPage)
|
||||
await documentsPageSecond.openDocument(completeDocument.title)
|
||||
|
||||
const documentContentPageSecond = new DocumentContentPage(userSecondPage)
|
||||
await documentContentPageSecond.confirmApproval()
|
||||
|
||||
await documentContentPageSecond.buttonDocumentInformation.click()
|
||||
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('9. 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('10. 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)
|
||||
})
|
||||
})
|
||||
|
||||
test('TESTS-352. Create a document', async ({ page }) => {
|
||||
const folderName = faker.word.words(1)
|
||||
const documentTitle = faker.word.words(2)
|
||||
await allure.description('Requirement\nUsers need to create a new document')
|
||||
await allure.tms('TESTS-352', 'https://front.hc.engineering/workbench/platform/tracker/TESTS-352')
|
||||
|
||||
const documentContentPage = new DocumentContentPage(page)
|
||||
await documentContentPage.clickAddFolderButton()
|
||||
await documentContentPage.fillDocumentSpaceForm(folderName)
|
||||
await documentContentPage.createNewDocumentInsideFolder(folderName)
|
||||
await documentContentPage.createNewDocumentFromFolder(documentTitle)
|
||||
|
||||
await test.step('2. Check if document and folder exists', async () => {
|
||||
await documentContentPage.checkIfFolderExists(folderName)
|
||||
await documentContentPage.checkDocumentTitle(documentTitle)
|
||||
})
|
||||
|
||||
await attachScreenshot('TESTS-352_create_document.png', page)
|
||||
})
|
||||
|
||||
test('TESTS-380. As a space QARA, I can select "Custom" field in "Reason" for creating this Quality doc and it is stored in the History of Version 2 of this doc', async ({
|
||||
page
|
||||
}) => {
|
||||
const folderName = generateId(5)
|
||||
const documentTitle = generateId(5)
|
||||
const reason = generateId(5)
|
||||
await allure.description('Requirement\nUsers need to create a new document')
|
||||
await allure.tms('TESTS-380', 'https://front.hc.engineering/workbench/platform/tracker/TESTS-380')
|
||||
|
||||
const documentContentPage = new DocumentContentPage(page)
|
||||
await documentContentPage.clickAddFolderButton()
|
||||
await documentContentPage.fillDocumentSpaceForm(folderName)
|
||||
await documentContentPage.createNewDocumentInsideFolder(folderName)
|
||||
await documentContentPage.createNewDocumentFromFolder(documentTitle, true, reason)
|
||||
|
||||
await test.step('2. Check if document and folder exists', async () => {
|
||||
await documentContentPage.checkIfFolderExists(folderName)
|
||||
await documentContentPage.checkDocumentTitle(documentTitle)
|
||||
})
|
||||
await documentContentPage.clickSendForApproval()
|
||||
await documentContentPage.fillSelectApproversForm(['Appleseed John'])
|
||||
await documentContentPage.confirmApproval()
|
||||
await documentContentPage.clickDraftNewVersion()
|
||||
await documentContentPage.clickHistoryTab()
|
||||
await test.step('3. Check if history version exists', async () => {
|
||||
await documentContentPage.checkIfHistoryVersionExists(reason)
|
||||
})
|
||||
await attachScreenshot('TESTS-380_create_document.png', page)
|
||||
await documentContentPage.clickLeaveFolder(folderName)
|
||||
})
|
||||
|
||||
test('TESTS-214. Check old existing document content', async ({ page, browser }) => {
|
||||
await allure.description(
|
||||
'Requirement\nAs a user, I want to open my previously created document and see all its content'
|
||||
|
@ -76,4 +76,37 @@ test.describe('Registration tests', () => {
|
||||
})
|
||||
await attachScreenshot('TESTS-144_duplicate_email.png', page)
|
||||
})
|
||||
|
||||
test('TESTS-396. Correct email and wrong password: I cannot log in ', async ({ page }) => {
|
||||
await allure.description('Requirement\nThe system should reject the wrong password')
|
||||
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.login('user1', 'wrongPassword')
|
||||
await loginPage.checkIfUserIsLoggedIn('wrong-password')
|
||||
})
|
||||
await attachScreenshot('TESTS-396_empty_fields.png', page)
|
||||
})
|
||||
|
||||
test('TESTS-397. Wrong email and correct password: I cannot log in ', async ({ page }) => {
|
||||
await allure.description('Requirement\nThe system should reject the registration with wrong email')
|
||||
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.login('wrongEmail', '1234')
|
||||
await loginPage.checkIfUserIsLoggedIn('wrong-email')
|
||||
})
|
||||
await attachScreenshot('TESTS-397_empty_fields.png', page)
|
||||
})
|
||||
|
||||
test('TESTS-398. Correct email and correct password: I can log in ', async ({ page }) => {
|
||||
await allure.description('Requirement\nUser is able to login with correct credentials')
|
||||
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.login('user1', '1234')
|
||||
await loginPage.checkIfUserIsLoggedIn('correct-credentials')
|
||||
})
|
||||
await attachScreenshot('TESTS-398_empty_fields.png', page)
|
||||
})
|
||||
})
|
||||
|
@ -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
|
||||
@ -42,6 +43,21 @@ export class DocumentContentPage extends DocumentCommonPage {
|
||||
readonly textId: Locator
|
||||
readonly sectionsLocatorViewRight: Locator
|
||||
readonly sectionsLocatorEditRight: Locator
|
||||
readonly addSpaceButton: Locator
|
||||
readonly inputSpaceName: Locator
|
||||
readonly roleSelector: Locator
|
||||
readonly selectRoleMember: Locator
|
||||
readonly createButton: Locator
|
||||
readonly createNewDocument: Locator
|
||||
readonly selectCustom: Locator
|
||||
readonly nextStepButton: Locator
|
||||
readonly customSpecificReason: Locator
|
||||
readonly newDocumentTitle: Locator
|
||||
readonly createDraft: Locator
|
||||
readonly draftNewVersion: Locator
|
||||
readonly buttonHistoryTab: Locator
|
||||
readonly documentHeader: Locator
|
||||
readonly leaveFolder: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super(page)
|
||||
@ -93,12 +109,31 @@ export class DocumentContentPage extends DocumentCommonPage {
|
||||
this.textId = page.locator('div.flex:has(div.label:text("ID")) div.field')
|
||||
this.sectionsLocatorViewRight = page.locator('div.section span.label')
|
||||
this.sectionsLocatorEditRight = page.locator('div.section span.label input')
|
||||
this.addSpaceButton = page.locator('#tree-orgspaces')
|
||||
this.inputSpaceName = page.getByPlaceholder('New documents space')
|
||||
this.roleSelector = page.getByRole('button', { name: 'Members' })
|
||||
this.selectRoleMember = page.getByRole('button', { name: 'AJ Appleseed John' })
|
||||
this.createButton = page.getByRole('button', { name: 'Create' })
|
||||
this.createNewDocument = page.getByRole('button', { name: 'Create new document' })
|
||||
this.selectCustom = page.getByText('Custom')
|
||||
this.customSpecificReason = page.getByPlaceholder('Specify the reason...')
|
||||
this.nextStepButton = page.getByRole('button', { name: 'Next step' })
|
||||
this.newDocumentTitle = page.getByPlaceholder('New document')
|
||||
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' })
|
||||
this.leaveFolder = page.getByRole('button', { name: 'Leave' })
|
||||
}
|
||||
|
||||
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 })
|
||||
@ -107,6 +142,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
|
||||
@ -137,6 +189,69 @@ export class DocumentContentPage extends DocumentCommonPage {
|
||||
await this.selectFromDropdown(this.page, action)
|
||||
}
|
||||
|
||||
async checkIfFolderExists (folderName: string): Promise<void> {
|
||||
await expect(this.page.getByRole('button', { name: folderName })).toBeVisible()
|
||||
}
|
||||
|
||||
async clickAddFolderButton (): Promise<void> {
|
||||
await this.addSpaceButton.click()
|
||||
}
|
||||
|
||||
async fillDocumentSpaceForm (spaceName: string): Promise<void> {
|
||||
await this.inputSpaceName.fill(spaceName)
|
||||
await this.roleSelector.nth(2).click()
|
||||
await this.selectRoleMember.nth(2).click()
|
||||
await this.page.keyboard.press('Escape')
|
||||
await this.page.waitForTimeout(1000)
|
||||
await this.createButton.click()
|
||||
}
|
||||
|
||||
async createNewDocumentInsideFolder (folderName: string): Promise<void> {
|
||||
await this.page.getByRole('button', { name: folderName }).hover()
|
||||
await this.page.getByRole('button', { name: folderName }).getByRole('button').click()
|
||||
await this.createNewDocument.click()
|
||||
}
|
||||
|
||||
async clickLeaveFolder (folderName: string): Promise<void> {
|
||||
await this.page.getByRole('button', { name: folderName }).hover()
|
||||
await this.page.getByRole('button', { name: folderName }).getByRole('button').click()
|
||||
await this.leaveFolder.click()
|
||||
}
|
||||
|
||||
async createNewDocumentFromFolder (
|
||||
title: string,
|
||||
custom: boolean = false,
|
||||
specificReason: string = ''
|
||||
): Promise<void> {
|
||||
await this.page.locator('.antiRadio > .marker').first().click()
|
||||
await this.nextStepButton.click()
|
||||
await this.newDocumentTitle.fill(title)
|
||||
if (custom) {
|
||||
await this.selectCustom.click()
|
||||
await this.customSpecificReason.fill(specificReason)
|
||||
}
|
||||
await this.nextStepButton.click()
|
||||
await this.createDraft.click()
|
||||
}
|
||||
|
||||
async clickSendForApproval (): Promise<void> {
|
||||
await this.buttonSendForApproval.click()
|
||||
}
|
||||
|
||||
async clickDraftNewVersion (): Promise<void> {
|
||||
await this.buttonDraftNewVersion.click()
|
||||
}
|
||||
|
||||
async clickHistoryTab (): Promise<void> {
|
||||
await this.buttonHistoryTab.first().click()
|
||||
}
|
||||
|
||||
async checkIfHistoryVersionExists (description: string): Promise<void> {
|
||||
await this.page.waitForTimeout(200)
|
||||
await expect(this.page.getByText(description)).toBeVisible()
|
||||
await expect(this.page.getByText('v0.1', { exact: true })).toBeVisible()
|
||||
}
|
||||
|
||||
async checkDocumentStatus (status: DocumentStatus): Promise<void> {
|
||||
await expect(this.textDocumentStatus).toHaveText(status)
|
||||
}
|
||||
@ -205,6 +320,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 =
|
||||
|
@ -26,4 +26,19 @@ export class LoginPage {
|
||||
expect(await this.buttonLogin.isEnabled()).toBe(true)
|
||||
await this.buttonLogin.click()
|
||||
}
|
||||
|
||||
async checkIfUserIsLoggedIn (credentials: string): Promise<void> {
|
||||
if (credentials === 'wrong-password') {
|
||||
await expect(this.buttonLogin).toBeVisible()
|
||||
await expect(this.page.getByText('Invalid password')).toBeVisible()
|
||||
}
|
||||
|
||||
if (credentials === 'wrong-email') {
|
||||
await expect(this.buttonLogin).toBeVisible()
|
||||
await expect(this.page.getByText('Account not found')).toBeVisible()
|
||||
}
|
||||
if (credentials === 'correct-credentials') {
|
||||
await expect(this.page.getByText('SanityTest')).toBeVisible()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user