Skip to content

Commit

Permalink
feat(tests): TESTS-93 updated Created date filter test (hcengineering…
Browse files Browse the repository at this point in the history
…#4862)

Signed-off-by: Alex Velichko <alex@hardcoreeng.com>
Signed-off-by: Tiago Cruz <tcruz@netic.io>
  • Loading branch information
nestoragent authored and tjaoc committed Mar 5, 2024
1 parent 5ea6a1c commit 89039d1
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 3 deletions.
3 changes: 3 additions & 0 deletions tests/restore-workspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@

./tool.sh configure sanity-ws --enable=*
./tool.sh configure sanity-ws --list

# setup issue createdOn for yesterday
./tool.sh change-field sanity-ws --objectId 65e47f1f1b875b51e3b4b983 --objectClass tracker:class:Issue --attribute createdOn --value $(($(date +%s)*1000 - 86400000)) --type number --domain task
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/000007/space-1709473575430-0.snp.gz
Binary file not shown.
Binary file not shown.
Binary file added tests/sanity-ws/000007/task-1709473575430-0.snp.gz
Binary file not shown.
Binary file not shown.
Binary file added tests/sanity-ws/000007/tx-1709473575430-0.snp.gz
Binary file not shown.
Binary file not shown.
Binary file modified tests/sanity-ws/backup.json.gz
Binary file not shown.
12 changes: 10 additions & 2 deletions tests/sanity/tests/model/tracker/common-tracker-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,25 @@ export class CommonTrackerPage extends CalendarPage {
}
}

async updateFilterDimension (filterSecondLevel: string, dateStart?: string): Promise<void> {
async updateFilterDimension (
filterSecondLevel: string,
dateStart?: string,
needToOpenCalendar: boolean = false
): Promise<void> {
await this.page.locator('div.filter-section button:nth-child(2)').click()
await this.page.locator('div.selectPopup [class*="menu"]', { hasText: filterSecondLevel }).click()

if (dateStart !== undefined) {
if (needToOpenCalendar) {
await this.page.locator('div.filter-section button:nth-child(3)').click()
}

switch (dateStart) {
case 'Today':
await this.page.locator('div.popup div.calendar button.day.today').click()
break
default:
await this.page.locator('div.popup div.calendar button.day', { hasText: dateStart }).click()
await this.page.locator('div.popup div.calendar button.day').locator(`text="${dateStart}"`).click()
break
}
}
Expand Down
18 changes: 17 additions & 1 deletion tests/sanity/tests/tracker/filter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ test.describe('Tracker filters tests', () => {
})

test('Created date', async ({ page }) => {
const yesterdayIssueTitle = 'Issue for the Check Filter Yesterday'
const newIssue: NewIssue = {
title: `Issue for the Created filter-${generateId()}`,
description: 'Issue for the Created filter',
Expand All @@ -138,12 +139,14 @@ test.describe('Tracker filters tests', () => {
await issuesPage.checkFilter('Created date', 'Today')

await issuesPage.checkFilteredIssueExist(newIssue.title)
await issuesPage.checkFilteredIssueNotExist(yesterdayIssueTitle)
})

await test.step('Check Filter Yesterday', async () => {
await issuesPage.updateFilterDimension('Yesterday')
await issuesPage.checkFilter('Created date', 'Yesterday')

await issuesPage.checkFilteredIssueExist(yesterdayIssueTitle)
await issuesPage.checkFilteredIssueNotExist(newIssue.title)
})

Expand All @@ -152,20 +155,33 @@ test.describe('Tracker filters tests', () => {
await issuesPage.checkFilter('Created date', 'This week')

await issuesPage.checkFilteredIssueExist(newIssue.title)
await issuesPage.checkFilteredIssueExist(yesterdayIssueTitle)
})

await test.step('Check Filter This month', async () => {
await issuesPage.updateFilterDimension('This month')
await issuesPage.checkFilter('Created date', 'This month')

await issuesPage.checkFilteredIssueExist(newIssue.title)
await issuesPage.checkFilteredIssueExist(yesterdayIssueTitle)
})

await test.step('Check Filter Exact date - Yesterday', async () => {
const dateYesterday = new Date()
dateYesterday.setDate(dateYesterday.getDate() - 1)
await issuesPage.updateFilterDimension('Exact date', dateYesterday.getDate().toString())
await issuesPage.checkFilter('Created date', 'is', dateYesterday.getDate().toString())

await issuesPage.checkFilteredIssueExist(yesterdayIssueTitle)
await issuesPage.checkFilteredIssueNotExist(newIssue.title)
})

await test.step('Check Filter Exact date - Today', async () => {
await issuesPage.updateFilterDimension('Exact date', 'Today')
await issuesPage.updateFilterDimension('Exact date', 'Today', true)
await issuesPage.checkFilter('Created date', 'is', 'Today')

await issuesPage.checkFilteredIssueExist(newIssue.title)
await issuesPage.checkFilteredIssueNotExist(yesterdayIssueTitle)
})

await test.step('Check Filter Before date - Today', async () => {
Expand Down

0 comments on commit 89039d1

Please sign in to comment.