Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Dec 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tests/sanity/tests/model/tracker/template-details-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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> {
Expand Down Expand Up @@ -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)
}
}
6 changes: 5 additions & 1 deletion tests/sanity/tests/model/tracker/templates-page.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand Down Expand Up @@ -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)
}
}
23 changes: 23 additions & 0 deletions tests/sanity/tests/tracker/template.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
})