Browse Source

fix(test): wrong expect usage in e2e

Andelf 1 year ago
parent
commit
8390c957f0
2 changed files with 8 additions and 8 deletions
  1. 6 6
      e2e-tests/basic.spec.ts
  2. 2 2
      e2e-tests/page-rename.spec.ts

+ 6 - 6
e2e-tests/basic.spec.ts

@@ -299,8 +299,8 @@ test('Scheduled date picker should point to the already specified Date #6985', a
   // Open date picker
   await page.click('a.opacity-80')
   await page.waitForTimeout(500)
-  expect(page.locator('text=May 2000')).toBeVisible()
-  expect(page.locator('td:has-text("6").active')).toBeVisible()
+  await expect(page.locator('text=May 2000')).toBeVisible()
+  await expect(page.locator('td:has-text("6").active')).toBeVisible()
 
   // Close date picker
   await page.click('a.opacity-80')
@@ -325,10 +325,10 @@ test('Opening a second datepicker should close the first one #7341', async ({ pa
   await page.waitForTimeout(50)
   await page.click('a:has-text("2000-05-06 Sat").opacity-80')
   await page.waitForTimeout(50)
-  expect(page.locator('text=May 2000')).toBeVisible()
-  expect(page.locator('td:has-text("6").active')).toBeVisible()
-  expect(page.locator('text=June 2000')).not.toBeVisible()
-  expect(page.locator('td:has-text("7").active')).not.toBeVisible()
+  await expect(page.locator('text=May 2000')).toBeVisible()
+  await expect(page.locator('td:has-text("6").active')).toBeVisible()
+  await expect(page.locator('text=June 2000')).not.toBeVisible()
+  await expect(page.locator('td:has-text("7").active')).not.toBeVisible()
 
   // Close date picker
   await page.click('a:has-text("2000-05-06 Sat").opacity-80')

+ 2 - 2
e2e-tests/page-rename.spec.ts

@@ -91,7 +91,7 @@ test('page title property test', async ({ page }) => {
   await page.type(':nth-match(textarea, 1)', 'title:: ' + new_name + "     ")
   await page.press(':nth-match(textarea, 1)', 'Enter') // DWIM property mode creates new line
   await page.press(':nth-match(textarea, 1)', 'Enter')
-  expect(await page.innerText('.page-title .title')).toBe(new_name)
+  await expect(page.locator('.page-title .title')).toHaveText(new_name)
 
   // Edit Title Property and Esc (ETPE)
   // exit editing via moving out focus
@@ -101,5 +101,5 @@ test('page title property test', async ({ page }) => {
   await createPage(page, original_name)
   await page.type(':nth-match(textarea, 1)', 'title:: ' + new_name)
   await page.press(':nth-match(textarea, 1)', 'Escape')
-  expect(await page.innerText('.page-title .title')).toBe(new_name)
+  await expect(page.locator('.page-title .title')).toHaveText(new_name)
 })