feat(tests): TESTS-58 dont test delete template (#4125)

This commit is contained in:
Alex Velichko 2023-12-02 15:33:04 +03:00 committed by GitHub
parent 676abfb67c
commit 591fef6555
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 1 deletions

View File

@ -15,6 +15,8 @@ export class TemplateDetailsPage extends CommonTrackerPage {
readonly buttonDueDate: Locator
readonly buttonSaveDueDate: Locator
readonly textComment: Locator
readonly buttonMoreActions: Locator
readonly buttonDelete: Locator
constructor (page: Page) {
super(page)
@ -30,6 +32,8 @@ export class TemplateDetailsPage extends CommonTrackerPage {
this.buttonDueDate = page.locator('(//span[text()="Due date"]/../div/button)[2]')
this.buttonSaveDueDate = page.locator('div.footer > button')
this.textComment = page.locator('div.labels-row')
this.buttonMoreActions = page.locator('div.popupPanel-title > div > button:nth-child(1)')
this.buttonDelete = page.locator('button[class*="menuItem"] > span', { hasText: 'Delete' })
}
async checkTemplate (data: NewIssue): Promise<void> {
@ -94,4 +98,10 @@ export class TemplateDetailsPage extends CommonTrackerPage {
async checkCommentExist (comment: string): Promise<void> {
await expect(this.textComment.filter({ hasText: comment })).toBeVisible()
}
async deleteTemplate (): Promise<void> {
await this.buttonMoreActions.click()
await this.buttonDelete.click()
await this.pressYesDeletePopup(this.page)
}
}

View File

@ -1,4 +1,4 @@
import { type Locator, type Page } from '@playwright/test'
import { expect, type Locator, type Page } from '@playwright/test'
import { CommonTrackerPage } from './common-tracker-page'
import { NewIssue } from './types'
@ -82,4 +82,8 @@ export class TemplatePage extends CommonTrackerPage {
async openTemplate (templateName: string): Promise<void> {
await this.page.locator('span.issuePresenterRoot > span', { hasText: templateName }).click()
}
async checkTemplateNotExist (templateName: string): Promise<void> {
await expect(this.page.locator('span.issuePresenterRoot > span').filter({ hasText: templateName })).toHaveCount(0)
}
}

View File

@ -111,4 +111,27 @@ test.describe('Tracker template tests', () => {
})
}
})
test('Delete Template', async ({ page }) => {
const deleteTemplate: NewIssue = {
title: `Template for delete-${generateId()}`,
description: 'Created template for delete'
}
const leftSideMenuPage = new LeftSideMenuPage(page)
await leftSideMenuPage.buttonTracker.click()
const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page)
await trackerNavigationMenuPage.buttonTemplates.click()
let templatePage = new TemplatePage(page)
await templatePage.createNewTemplate(deleteTemplate)
await templatePage.openTemplate(deleteTemplate.title)
const templateDetailsPage = new TemplateDetailsPage(page)
await templateDetailsPage.deleteTemplate()
templatePage = new TemplatePage(page)
await templatePage.checkTemplateNotExist(deleteTemplate.title)
})
})