|
@@ -1,6 +1,6 @@
|
|
|
import { expect } from '@playwright/test'
|
|
|
import { test } from './fixtures'
|
|
|
-import { createRandomPage } from './utils'
|
|
|
+import { createRandomPage, searchAndJumpToPage } from './utils'
|
|
|
|
|
|
/***
|
|
|
* Test side bar features
|
|
@@ -19,10 +19,8 @@ test('favorite item and recent item test', async ({ page }) => {
|
|
|
await page.click(":nth-match(.favorite-item, 1)")
|
|
|
expect(await page.innerText('.page-title .title')).toBe(fav_page_name)
|
|
|
|
|
|
- // TODO: Check out why this works on local, and fails on github CI
|
|
|
- // await page.waitForTimeout(2000)
|
|
|
- // expect(await page.innerText(':nth-match(.recent-item a, 1)')).toBe('◦' + fav_page_name)
|
|
|
- // expect(await page.innerText(':nth-match(.recent-item a, 2)')).toBe('◦' + another_page_name)
|
|
|
+ expect(await page.innerText(':nth-match(.recent-item a, 1)')).toBe('◦' + fav_page_name)
|
|
|
+ expect(await page.innerText(':nth-match(.recent-item a, 2)')).toBe('◦' + another_page_name)
|
|
|
|
|
|
// remove fav
|
|
|
await page.click('.ui__dropdown-trigger')
|
|
@@ -32,6 +30,26 @@ test('favorite item and recent item test', async ({ page }) => {
|
|
|
expect(favs.length).toEqual(previous_fav_count)
|
|
|
|
|
|
// click from fav page
|
|
|
- // await page.click(':nth-match(.recent-item a, 2)')
|
|
|
- // expect(await page.innerText('.page-title .title')).toBe(another_page_name)
|
|
|
-})
|
|
|
+ await page.click(':nth-match(.recent-item a, 2)')
|
|
|
+ expect(await page.innerText('.page-title .title')).toBe(another_page_name)
|
|
|
+})
|
|
|
+
|
|
|
+
|
|
|
+test('recent is updated #4320', async ({ page }) => {
|
|
|
+ const page1 = await createRandomPage(page)
|
|
|
+ await page.fill(':nth-match(textarea, 1)', 'Random Thought')
|
|
|
+
|
|
|
+ const page2 = await createRandomPage(page)
|
|
|
+ await page.fill(':nth-match(textarea, 1)', 'Another Random Thought')
|
|
|
+
|
|
|
+ const firstRecent = page.locator('.nav-content-item.recent li >> nth=0')
|
|
|
+ expect(await firstRecent.textContent()).toContain(page2)
|
|
|
+
|
|
|
+ const secondRecent = page.locator('.nav-content-item.recent li >> nth=1')
|
|
|
+ expect(await secondRecent.textContent()).toContain(page1)
|
|
|
+
|
|
|
+ // then jump back
|
|
|
+ await searchAndJumpToPage(page, page1)
|
|
|
+ expect(await firstRecent.textContent()).toContain(page1)
|
|
|
+ expect(await secondRecent.textContent()).toContain(page2)
|
|
|
+})
|