Add verifications for some test steps (#2371)

* Add verifications for some test steps

Signed-off-by: Ruslan Bayandinov <wazsone@ya.ru>

* Add verifications for some test steps

Signed-off-by: Ruslan Bayandinov <wazsone@ya.ru>

* remove random from tests

Signed-off-by: Ruslan Bayandinov <wazsone@ya.ru>

* return random and fix internal loop index

Signed-off-by: Ruslan Bayandinov <wazsone@ya.ru>

* remove outer loop

Signed-off-by: Ruslan Bayandinov <wazsone@ya.ru>

Signed-off-by: Ruslan Bayandinov <wazsone@ya.ru>
This commit is contained in:
Ruslan Bayandinov 2022-11-10 15:14:21 +07:00 committed by GitHub
parent cdbead6584
commit 4fcec640a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -208,22 +208,25 @@ 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']
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.waitForSelector(`text="${name}"`)
await page.waitForSelector('text="View issue"')
await page.click('text="View issue"')
await page.click('#ReportedTimeEditor')
await page.waitForSelector('text="Time spend reports"')
await page.click('#ReportsPopupAddButton')
await page.waitForSelector('text="Add time report"')
await expect(page.locator('button:has-text("Create")')).toBeDisabled()
await page.fill('[placeholder="Reported\\ time"]', time)
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 page.click('#card-close')
await expect(page.locator('#TimeSpendReportValue')).toContainText(`${time}d`)
}
@ -241,28 +244,28 @@ test('report-time-from-main-view', async ({ page }) => {
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')
const name = getIssueName()
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 createIssue(page, { name, assignee, status })
await page.waitForSelector(`text="${name}"`)
await page.click('.close-button > .button')
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')
let count = 0
for (let j = 0; j < 5; j++) {
const random = Math.floor(Math.random() * values.length)
const time = values[random]
count += time
await page.locator('.estimation-container').first().click()
await page.waitForSelector('text="Estimation"')
await expect(page.locator('.estimation-container >> span').nth(0)).toContainText(`${Number(count.toFixed(2))}d`)
}
await page.click('button:has-text("Add time report")')
await page.waitForSelector('.antiCard-header >> .antiCard-header__title-wrap >> span:has-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.click('#card-close')
await expect(page.locator('.estimation-container >> span').first()).toContainText(`${Number(count.toFixed(2))}d`)
}
})