This repository has been archived by the owner on May 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(test) : Add tests for Query Tab (#2793)
- Add tests for creating a new workitem from query tab
- Loading branch information
1 parent
d6bf14f
commit 9dba43d
Showing
5 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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 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,38 @@ | ||
import { browser } from 'protractor'; | ||
import { PlannerPage } from '../page_objects/planner'; | ||
import * as support from '../support'; | ||
|
||
describe('Query tests', () => { | ||
let planner: PlannerPage; | ||
let c = new support.Constants(); | ||
let testData; | ||
|
||
beforeAll(async () => { | ||
await support.desktopTestSetup(); | ||
planner = new PlannerPage(browser.baseUrl); | ||
await planner.openInBrowser(); | ||
await planner.waitUntilUrlContains('typegroup'); | ||
testData = await c.browserName[browser.browserName]; | ||
}); | ||
|
||
it('should display search query result', async () => { | ||
let searchQuery = `typegroup.name : ${testData.group1}`; | ||
await planner.clickQueryTab(); | ||
await planner.waitUntilUrlContains('query'); | ||
expect(await browser.getCurrentUrl()).toContain('query'); | ||
await planner.query.enterQuery(searchQuery); | ||
expect(await planner.query.getDataTableHeaderCellCount()).toBe(8); | ||
}); | ||
|
||
it('should create a new Workitem', async () => { | ||
let title: string = 'Create work item from query page', | ||
searchQuery: string = `title:${title}`; | ||
await planner.clickQueryTab(); | ||
await planner.waitUntilUrlContains('query'); | ||
await planner.query.createWorkItem(title); | ||
await planner.quickPreview.notificationToast.untilCount(1); | ||
expect(await planner.quickPreview.notificationToast.count()).toBe(1); | ||
await planner.query.enterQuery(searchQuery); | ||
expect(await planner.query.hasWorkItem(title)).toBe(true); | ||
}); | ||
}); |
This file contains 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 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,30 @@ | ||
import { Key } from 'protractor'; | ||
import * as ui from '../../ui'; | ||
import { BaseElement, Clickable } from './../base.element'; | ||
import { WorkItemList } from './workitem-list'; | ||
|
||
export class Query extends WorkItemList { | ||
private queryTextInput = new ui.TextInput(this.$('input[placeholder="Enter your Query..."]'), 'Enter your Query'); | ||
private createWorkItemButton = new ui.BaseElement(this.$('.f8-query__create-workitem> button'), ' Create work Item'); | ||
private createWorkItemMenu = new ui.BaseElement(this.$('.f8-query__create-workitem-menu'), 'create work item menu'); | ||
private titleTextInput = new ui.TextInput(this.createWorkItemMenu.$('input[placeholder=" Type your title...."]'), 'title'); | ||
private createButton = new ui.Clickable(this.createWorkItemMenu.$('#quickadd-save'), 'create button'); | ||
|
||
async enterQuery(query: string , append: boolean = false) { | ||
await this.queryTextInput.ready(); | ||
if (!append) { | ||
await this.queryTextInput.clear(); | ||
} | ||
await this.queryTextInput.enterText(query); | ||
await this.queryTextInput.enterText(Key.ENTER); | ||
await this.datatableHeaderCell.untilCount(8); | ||
} | ||
|
||
async createWorkItem(title: string) { | ||
await this.createWorkItemButton.ready(); | ||
await this.createWorkItemButton.clickWhenReady(); | ||
await this.createWorkItemMenu.untilDisplayed(); | ||
await this.titleTextInput.enterText(title); | ||
await this.createButton.clickWhenReady(); | ||
} | ||
} |