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-51: feat(tests): done Delete a component test #4234

Merged
merged 5 commits into from
Dec 22, 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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added tests/sanity-ws/000005/tx-1703183593552-0.snp.gz
Binary file not shown.
Binary file not shown.
Binary file modified tests/sanity-ws/backup.json.gz
Binary file not shown.
2 changes: 2 additions & 0 deletions tests/sanity/tests/model/tracker/common-tracker-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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> {
Expand Down
6 changes: 6 additions & 0 deletions tests/sanity/tests/model/tracker/component-details-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
6 changes: 5 additions & 1 deletion tests/sanity/tests/model/tracker/components-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 { NewComponent } from './types'
import { CommonTrackerPage } from './common-tracker-page'

Expand Down Expand Up @@ -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)
}
}
2 changes: 0 additions & 2 deletions tests/sanity/tests/model/tracker/issues-details-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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')
Expand Down
2 changes: 0 additions & 2 deletions tests/sanity/tests/model/tracker/milestones-details-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

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