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-93: feat(tests): updated Created date filter test #4862

Merged
merged 1 commit into from
Mar 3, 2024
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
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