TESTS-51: feat(tests): done Delete a component test (#4234)

Signed-off-by: Alex Velichko <nestor_007@mail.ru>
This commit is contained in:
Alex Velichko 2023-12-22 09:58:58 +03:00 committed by GitHub
parent b5bb679998
commit fa077d71a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 35 additions and 5 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -12,6 +12,7 @@ export class CommonTrackerPage extends CalendarPage {
readonly buttonMoveIssuesModal: Locator
readonly buttonKeepOriginalMoveIssuesModal: Locator
readonly inputKeepOriginalMoveIssuesModal: Locator
readonly buttonMoreActions: Locator
constructor (page: Page) {
super(page)
@ -27,6 +28,7 @@ export class CommonTrackerPage extends CalendarPage {
this.buttonMoveIssuesModal = page.locator('form[id="tracker:string:MoveIssues"] button[type="submit"]')
this.buttonKeepOriginalMoveIssuesModal = page.locator('form[id="tracker:string:MoveIssues"] span.toggle-switch')
this.inputKeepOriginalMoveIssuesModal = page.locator('form[id="tracker:string:MoveIssues"] input[type="checkbox"]')
this.buttonMoreActions = page.locator('div.popupPanel-title div.flex-row-center > button:first-child')
}
async selectFilter (filter: string, filterSecondLevel?: string): Promise<void> {

View File

@ -38,4 +38,10 @@ export class ComponentsDetailsPage extends CommonTrackerPage {
await expect(this.buttonLead).toHaveText(data.lead)
}
}
async deleteComponent (): Promise<void> {
await this.buttonMoreActions.click()
await this.selectFromDropdown(this.page, 'Delete')
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 { NewComponent } from './types'
import { CommonTrackerPage } from './common-tracker-page'
@ -40,4 +40,8 @@ export class ComponentsPage extends CommonTrackerPage {
async openComponentByName (componentName: string): Promise<void> {
await this.page.locator('div.row a', { hasText: componentName }).click()
}
async checkComponentNotExist (componentName: string): Promise<void> {
await expect(this.page.locator('div.row a', { hasText: componentName })).toHaveCount(0)
}
}

View File

@ -17,7 +17,6 @@ export class IssuesDetailsPage extends CommonTrackerPage {
readonly buttonEstimation: Locator
readonly buttonCreatedBy: Locator
readonly buttonCloseIssue: Locator
readonly buttonMoreActions: Locator
readonly textParentTitle: Locator
readonly buttonAddSubIssue: Locator
readonly textRelated: Locator
@ -38,7 +37,6 @@ export class IssuesDetailsPage extends CommonTrackerPage {
this.buttonEstimation = page.locator('(//span[text()="Estimation"]/../div/button)[3]')
this.buttonCreatedBy = page.locator('(//span[text()="Assignee"]/../div/button)[1]')
this.buttonCloseIssue = page.locator('div.popupPanel-title > button')
this.buttonMoreActions = page.locator('div.popupPanel-title div.flex-row-center > button:first-child')
this.textParentTitle = page.locator('span.issue-title')
this.buttonAddSubIssue = page.locator('#add-sub-issue')
this.textRelated = page.locator('//span[text()="Related"]/following-sibling::div[1]/div//span')

View File

@ -9,7 +9,6 @@ export class MilestonesDetailsPage extends CommonTrackerPage {
readonly buttonTargetDate: Locator
readonly inputMilestoneName: Locator
readonly inputDescription: Locator
readonly buttonMoreActions: Locator
readonly buttonYesMoveAndDeleteMilestonePopup: Locator
readonly buttonModalOk: Locator
@ -21,7 +20,6 @@ export class MilestonesDetailsPage extends CommonTrackerPage {
this.buttonTargetDate = page.locator('//span[text()="Target date"]/following-sibling::div[1]/button')
this.inputMilestoneName = page.locator('input[placeholder="Milestone name"]')
this.inputDescription = page.locator('div.inputMsg div.tiptap')
this.buttonMoreActions = page.locator('div.popupPanel-title > div:last-child > button:first-child')
this.buttonYesMoveAndDeleteMilestonePopup = page.locator(
'form[id="tracker:string:MoveAndDeleteMilestone"] button.primary'
)

View File

@ -75,4 +75,26 @@ test.describe('Tracker component tests', () => {
await componentsPage.openComponentByName(editComponent.name)
await componentsDetailsPage.checkComponent(editComponent)
})
test('Delete a component', async ({ page }) => {
const newComponent: NewComponent = {
name: 'Delete component test',
description: 'Delete component test description'
}
const leftSideMenuPage = new LeftSideMenuPage(page)
await leftSideMenuPage.buttonTracker.click()
const trackerNavigationMenuPage = new TrackerNavigationMenuPage(page)
await trackerNavigationMenuPage.openComponentsForProject('Default')
const componentsPage = new ComponentsPage(page)
await componentsPage.openComponentByName(newComponent.name)
const componentsDetailsPage = new ComponentsDetailsPage(page)
await componentsDetailsPage.checkComponent(newComponent)
await componentsDetailsPage.deleteComponent()
await componentsPage.checkComponentNotExist(newComponent.name)
})
})