add report time tests (#2368)

Signed-off-by: Ruslan Bayandinov <wazsone@ya.ru>
This commit is contained in:
Ruslan Bayandinov 2022-11-09 18:23:06 +07:00 committed by GitHub
parent eb2be10adf
commit bd1079cb53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 66 additions and 2 deletions

View File

@ -44,7 +44,7 @@
</script>
{#if kind === 'link'}
<div class="link-container flex-between" on:click={showReports}>
<div id="ReportedTimeEditor" class="link-container flex-between" on:click={showReports}>
{#if value !== undefined}
<span class="overflow-label">
{floorFractionDigits(value, 2)}

View File

@ -77,6 +77,6 @@
</Scroller>
</div>
<svelte:fragment slot="buttons">
<Button icon={IconAdd} size={'large'} on:click={addReport} />
<Button id="ReportsPopupAddButton" icon={IconAdd} size={'large'} on:click={addReport} />
</svelte:fragment>
</Card>

View File

@ -50,6 +50,7 @@
{#if value && value.value}
<span
id="TimeSpendReportValue"
class="issuePresenterRoot flex-row-center"
on:click={editSpendReport}
use:tooltip={value.employee

View File

@ -203,3 +203,66 @@ test('my-issues', async ({ page }) => {
await page.keyboard.press('Escape')
await expect(page.locator('.antiPanel-component')).not.toContainText(name)
})
test('report-time-from-issue-card', async ({ page }) => {
await navigate(page)
const assignee = 'Rosamund Chen'
const status = 'In Progress'
const values = ['0.25', '0.5', '0.75', '1']
for (let i = 0; i < 10; i++) {
const random = Math.floor(Math.random() * values.length)
const time = values[random]
const name = getIssueName()
await createIssue(page, { name, assignee, status })
await page.click('text="View issue"')
await page.click('#ReportedTimeEditor')
await page.click('#ReportsPopupAddButton')
await expect(page.locator('button:has-text("Create")')).toBeDisabled()
await page.fill('[placeholder="Reported\\ time"]', time)
await expect(page.locator('button:has-text("Create")')).toBeEnabled()
await page.click('button:has-text("Create")')
await page.keyboard.press('Escape')
await expect(page.locator('#TimeSpendReportValue')).toContainText(`${time}d`)
}
})
test('report-time-from-main-view', async ({ page }) => {
await navigate(page)
await page.click('text="Issues"')
await page.click('button:has-text("View")')
await page.click('text="Status" >> nth=1')
await page.click('text="Last updated"')
await page.keyboard.press('Escape')
const values = [0.25, 0.5, 0.75, 1]
const assignee = 'Rosamund Chen'
const status = 'In Progress'
for (let i = 0; i < 5; i++) {
const name = getIssueName()
await createIssue(page, { name, assignee, status })
await page.waitForSelector(`text="${name}"`)
await page.click('.close-button >> button')
let count = 0
for (let i = 0; i < 5; i++) {
const random = Math.floor(Math.random() * values.length)
const time = values[random]
count += time
await page.click('.estimation-container')
await page.waitForSelector('text="Estimation"')
await page.click('text="Add time report"')
await expect(page.locator('button:has-text("Create")')).toBeDisabled()
await page.fill('[placeholder="Reported\\ time"]', `${time}`)
await expect(page.locator('button:has-text("Create")')).toBeEnabled()
await page.click('button:has-text("Create")')
await page.keyboard.press('Escape')
await expect(page.locator('.estimation-container >> span').nth(0)).toContainText(`${Number(count.toFixed(2))}d`)
}
}
})