-
Notifications
You must be signed in to change notification settings - Fork 2k
TESTS-43: feat(tests): added the Create an issue with all params test #3905
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { Page } from '@playwright/test' | ||
| import { CommonPage } from '../common-page' | ||
|
|
||
| export class CommonTrackerPage extends CommonPage { | ||
| readonly page: Page | ||
|
|
||
| constructor (page: Page) { | ||
| super() | ||
| this.page = page | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import { expect, type Locator, type Page } from '@playwright/test' | ||
| import { CommonTrackerPage } from './common-tracker-page' | ||
| import { NewIssue } from './types' | ||
|
|
||
| export class IssuesDetailsPage extends CommonTrackerPage { | ||
| readonly page: Page | ||
| readonly inputTitle: Locator | ||
| readonly inputDescription: Locator | ||
| readonly textStatus: Locator | ||
| readonly textPriority: Locator | ||
| readonly textAssignee: Locator | ||
| readonly textLabels: Locator | ||
| readonly textComponent: Locator | ||
| readonly textMilestone: Locator | ||
| readonly textEstimation: Locator | ||
|
|
||
| constructor (page: Page) { | ||
| super(page) | ||
| this.page = page | ||
| this.inputTitle = page.locator('div.popupPanel-body input[type="text"]') | ||
| this.inputDescription = page.locator('div.popupPanel-body div.textInput p') | ||
| this.textStatus = page.locator('//span[text()="Status"]/../button[1]//span') | ||
| this.textPriority = page.locator('//span[text()="Status"]/../button[2]//span') | ||
| this.textAssignee = page.locator('(//span[text()="Assignee"]/../div/button)[2]') | ||
| this.textLabels = page.locator('div.step-container div.listitems-container') | ||
| this.textComponent = page.locator('(//span[text()="Component"]/../div/div/button)[2]') | ||
| this.textMilestone = page.locator('(//span[text()="Milestone"]/../div/div/button)[3]') | ||
| this.textEstimation = page.locator('(//span[text()="Estimation"]/../div/button)[4]') | ||
| } | ||
|
|
||
| async checkIssueDescription (data: NewIssue): Promise<void> { | ||
| await expect(this.inputTitle).toHaveValue(data.title) | ||
| await expect(this.inputDescription).toHaveText(data.description) | ||
| if (data.status != null) { | ||
| await expect(this.textStatus).toHaveText(data.status) | ||
| } | ||
| if (data.priority != null) { | ||
| await expect(this.textPriority).toHaveText(data.priority) | ||
| } | ||
| if (data.assignee != null) { | ||
| await expect(this.textAssignee).toHaveText(data.assignee) | ||
| } | ||
| if (data.labels != null) { | ||
| await expect(this.textLabels).toHaveText(data.labels) | ||
| } | ||
| if (data.component != null) { | ||
| await expect(this.textComponent).toHaveText(data.component) | ||
| } | ||
| if (data.milestone != null) { | ||
| await expect(this.textMilestone).toHaveText(data.milestone) | ||
| } | ||
| if (data.estimation != null) { | ||
| await expect(this.textEstimation).toHaveText(data.estimation) | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| import { expect, type Locator, type Page } from '@playwright/test' | ||
| import { NewIssue } from './types' | ||
| import path from 'path' | ||
| import { CommonTrackerPage } from './common-tracker-page' | ||
|
|
||
| export class IssuesPage extends CommonTrackerPage { | ||
| readonly page: Page | ||
| readonly pageHeader: Locator | ||
| readonly buttonCreateNewIssue: Locator | ||
| readonly inputPopupCreateNewIssueTitle: Locator | ||
| readonly inputPopupCreateNewIssueDescription: Locator | ||
| readonly buttonPopupCreateNewIssueStatus: Locator | ||
| readonly buttonPopupCreateNewIssuePriority: Locator | ||
| readonly buttonPopupCreateNewIssueAssignee: Locator | ||
| readonly buttonPopupCreateNewIssueLabels: Locator | ||
| readonly buttonPopupCreateNewIssueComponent: Locator | ||
| readonly buttonPopupCreateNewIssueEstimation: Locator | ||
| readonly buttonPopupCreateNewIssueMilestone: Locator | ||
| readonly buttonPopupCreateNewIssueDuedate: Locator | ||
| readonly buttonDatePopupToday: Locator | ||
| readonly inputPopupCreateNewIssueFile: Locator | ||
| readonly textPopupCreateNewIssueFile: Locator | ||
| readonly buttonCreateIssue: Locator | ||
| readonly inputSearch: Locator | ||
|
|
||
| constructor (page: Page) { | ||
| super(page) | ||
| this.page = page | ||
| this.pageHeader = page.locator('span[class*="header"]', { hasText: 'Issues' }) | ||
| this.buttonCreateNewIssue = page.locator('button > span', { hasText: 'New issue' }) | ||
| this.inputPopupCreateNewIssueTitle = page.locator('form[id="tracker:string:NewIssue"] input[type="text"]') | ||
| this.inputPopupCreateNewIssueDescription = page.locator('form[id="tracker:string:NewIssue"] div.tiptap') | ||
| this.buttonPopupCreateNewIssueStatus = page.locator('form[id="tracker:string:NewIssue"] div#status-editor button') | ||
| this.buttonPopupCreateNewIssuePriority = page.locator( | ||
| 'form[id="tracker:string:NewIssue"] div#priority-editor button' | ||
| ) | ||
| this.buttonPopupCreateNewIssueAssignee = page.locator( | ||
| 'form[id="tracker:string:NewIssue"] div#assignee-editor button' | ||
| ) | ||
| this.buttonPopupCreateNewIssueLabels = page.locator('form[id="tracker:string:NewIssue"] button span', { | ||
| hasText: 'Labels' | ||
| }) | ||
| this.buttonPopupCreateNewIssueComponent = page.locator( | ||
| 'form[id="tracker:string:NewIssue"] button span[title="No component"]' | ||
| ) | ||
| this.buttonPopupCreateNewIssueEstimation = page.locator( | ||
| 'form[id="tracker:string:NewIssue"] div#estimation-editor button' | ||
| ) | ||
| this.buttonPopupCreateNewIssueMilestone = page.locator( | ||
| 'form[id="tracker:string:NewIssue"] div#milestone-editor button' | ||
| ) | ||
| this.buttonPopupCreateNewIssueDuedate = page.locator('form[id="tracker:string:NewIssue"] div#duedate-editor button') | ||
| this.buttonDatePopupToday = page.locator('div.popup div.today') | ||
| this.inputPopupCreateNewIssueFile = page.locator('form[id="tracker:string:NewIssue"] input[type="file"]') | ||
| this.textPopupCreateNewIssueFile = page.locator('div[class*="attachments"] > div[class*="attachment"]') | ||
| this.buttonCreateIssue = page.locator('button > span', { hasText: 'Create issue' }) | ||
| this.inputSearch = page.locator('input[placeholder="Search"]') | ||
| } | ||
|
|
||
| async createNewIssue (data: NewIssue): Promise<void> { | ||
| await this.buttonCreateNewIssue.click() | ||
|
|
||
| await this.inputPopupCreateNewIssueTitle.fill(data.title) | ||
| await this.inputPopupCreateNewIssueDescription.fill(data.description) | ||
| if (data.status != null) { | ||
| await this.buttonPopupCreateNewIssueStatus.click() | ||
| await this.selectFromDropdown(this.page, data.status) | ||
| } | ||
| if (data.priority != null) { | ||
| await this.buttonPopupCreateNewIssuePriority.click() | ||
| await this.selectMenuItem(this.page, data.priority) | ||
| } | ||
| if (data.assignee != null) { | ||
| await this.buttonPopupCreateNewIssueAssignee.click() | ||
| await this.selectAssignee(this.page, data.assignee) | ||
| } | ||
| if (data.labels != null && data.createLabel != null) { | ||
| await this.buttonPopupCreateNewIssueLabels.click() | ||
| if (data.createLabel) { | ||
| await this.pressCreateButtonSelectPopup(this.page) | ||
| await this.addNewTagPopup(this.page, data.labels, 'Tag from createNewIssue') | ||
| } | ||
| await this.checkFromDropdown(this.page, data.labels) | ||
| await this.inputPopupCreateNewIssueTitle.click({ force: true }) | ||
| } | ||
| if (data.component != null) { | ||
| await this.buttonPopupCreateNewIssueComponent.click() | ||
| await this.selectMenuItem(this.page, data.component) | ||
| } | ||
| if (data.estimation != null) { | ||
| await this.buttonPopupCreateNewIssueEstimation.click({ delay: 100 }) | ||
| await this.fillToSelectPopup(this.page, data.estimation) | ||
| } | ||
| if (data.milestone != null) { | ||
| await this.buttonPopupCreateNewIssueMilestone.click() | ||
| await this.selectMenuItem(this.page, data.milestone) | ||
| } | ||
| if (data.duedate != null) { | ||
| await this.buttonPopupCreateNewIssueDuedate.click() | ||
| if (data.duedate === 'today') { | ||
| await this.buttonDatePopupToday.click() | ||
| } else { | ||
| await this.fillToSelectPopup(this.page, data.duedate) | ||
| } | ||
| } | ||
| if (data.filePath != null) { | ||
| await this.inputPopupCreateNewIssueFile.setInputFiles(path.join(__dirname, `../../files/${data.filePath}`)) | ||
| await expect(await this.textPopupCreateNewIssueFile.filter({ hasText: data.filePath })).toBeVisible() | ||
| } | ||
|
|
||
| await this.buttonCreateIssue.click() | ||
| } | ||
|
|
||
| async searchIssueByName (issueName: string): Promise<void> { | ||
| await this.inputSearch.fill(issueName) | ||
| await this.page.waitForTimeout(3000) | ||
| } | ||
|
|
||
| async openIssueByName (issueName: string): Promise<void> { | ||
| await this.page.locator('a', { hasText: issueName }).click() | ||
| } | ||
|
|
||
| async checkIssueNotExist (issueName: string): Promise<void> { | ||
| await expect(this.page.locator('tr', { hasText: issueName })).toHaveCount(0) | ||
| } | ||
| } | ||
11 changes: 11 additions & 0 deletions
11
tests/sanity/tests/model/tracker/tracker-navigation-menu-page.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { type Locator, type Page } from '@playwright/test' | ||
|
|
||
| export class TrackerNavigationMenuPage { | ||
| readonly page: Page | ||
| readonly buttonIssues: Locator | ||
|
|
||
| constructor (page: Page) { | ||
| this.page = page | ||
| this.buttonIssues = page.locator('a span', { hasText: 'Issues' }) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| export interface NewIssue { | ||
| title: string | ||
| description: string | ||
| status?: string | ||
| priority?: string | ||
| assignee?: string | ||
| createLabel?: boolean | ||
| labels?: string | ||
| component?: string | ||
| estimation?: string | ||
| milestone?: string | ||
| duedate?: string | ||
| filePath?: string | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import { test } from '@playwright/test' | ||
| import { generateId, PlatformSetting, PlatformURI } from '../utils' | ||
| import { LeftSideMenuPage } from '../model/left-side-menu-page' | ||
| import { IssuesPage } from '../model/tracker/issues-page' | ||
| import { IssuesDetailsPage } from '../model/tracker/issues-details-page' | ||
| import { NewIssue } from '../model/tracker/types' | ||
|
|
||
| test.use({ | ||
| storageState: PlatformSetting | ||
| }) | ||
|
|
||
| test.describe('tracker issue tests', () => { | ||
| test.beforeEach(async ({ page }) => { | ||
| await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished() | ||
| }) | ||
|
|
||
| test('Create an issue with all parameters and attachments', async ({ page }) => { | ||
| const newIssue: NewIssue = { | ||
| title: `Issue with all parameters and attachments-${generateId()}`, | ||
| description: 'Created issue with all parameters and attachments description', | ||
| status: 'In Progress', | ||
| priority: 'Urgent', | ||
| assignee: 'Appleseed John', | ||
| createLabel: true, | ||
| labels: `CREATE-ISSUE-${generateId()}`, | ||
| component: 'No component', | ||
| estimation: '2', | ||
| milestone: 'No Milestone', | ||
| duedate: 'today', | ||
| filePath: 'cat.jpeg' | ||
| } | ||
|
|
||
| const leftSideMenuPage = new LeftSideMenuPage(page) | ||
| await leftSideMenuPage.buttonTracker.click() | ||
|
|
||
| const issuesPage = new IssuesPage(page) | ||
| await issuesPage.createNewIssue(newIssue) | ||
| await issuesPage.searchIssueByName(newIssue.title) | ||
| await issuesPage.openIssueByName(newIssue.title) | ||
|
|
||
| const issuesDetailsPage = new IssuesDetailsPage(page) | ||
| await issuesDetailsPage.checkIssueDescription({ | ||
| ...newIssue, | ||
| milestone: 'Milestone', | ||
| estimation: '2h' | ||
| }) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/sanity/tests/tracker.loading.spec.ts → ...ity/tests/tracker/tracker.loading.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/sanity/tests/tracker.projects.spec.ts → ...ty/tests/tracker/tracker.projects.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.