-
-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(): use playwright test for e2e
- Loading branch information
Showing
81 changed files
with
768 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,6 @@ | |
node_modules | ||
.cache | ||
dist | ||
e2e/__examples.jsx | ||
e2e/__examples.html | ||
examples/__examples.jsx | ||
examples/__examples.html | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
describe('list with hundred items', () => { | ||
beforeEach(async () => { | ||
import { test, expect } from '@playwright/test' | ||
|
||
test.describe('list with hundred items', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto('http://localhost:1234/grid') | ||
await page.waitForSelector('#test-root') | ||
await page.waitForTimeout(100) | ||
}) | ||
|
||
it('renders 20 items', async () => { | ||
test('renders 16 items', async ({ page }) => { | ||
const itemCount = await page.evaluate(() => { | ||
const listContainer = document.querySelector('#test-root > div > div > div') | ||
return listContainer!.childElementCount | ||
}) | ||
expect(itemCount).toBe(20) | ||
expect(itemCount).toBe(16) | ||
}) | ||
|
||
it('fills in the scroller', async () => { | ||
test('fills in the scroller', async ({ page }) => { | ||
await page.waitForTimeout(100) | ||
const scrollHeight = await page.evaluate(() => { | ||
const scroller = document.querySelector('#test-root > div') | ||
const scroller = document.querySelector('[data-test-id=virtuoso-scroller]') | ||
return scroller!.scrollHeight | ||
}) | ||
expect(scrollHeight).toBe(1625) | ||
expect(scrollHeight).toBe(2000) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,33 @@ | ||
describe('list with prependable items', () => { | ||
beforeEach(async () => { | ||
import { test, expect, Page } from '@playwright/test' | ||
|
||
test.describe('list with prependable items', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto('http://localhost:1234/prepend-items') | ||
await page.waitForSelector('#test-root') | ||
await page.waitForTimeout(100) | ||
}) | ||
|
||
async function getScrollTop() { | ||
async function getScrollTop(page: Page) { | ||
await page.waitForTimeout(100) | ||
return await page.evaluate(() => { | ||
const scroller = document.querySelector('#test-root > div > div') | ||
return scroller!.scrollTop | ||
}) | ||
} | ||
|
||
it('keeps the location at where it should be', async () => { | ||
expect(await getScrollTop()).toBe(0) | ||
test('keeps the location at where it should be', async ({ page }) => { | ||
expect(await getScrollTop(page)).toBe(0) | ||
|
||
await page.evaluate(() => { | ||
document.querySelector('button')!.click() | ||
}) | ||
|
||
expect(await getScrollTop()).toBe(2 * 55) | ||
expect(await getScrollTop(page)).toBe(2 * 55) | ||
|
||
await page.evaluate(() => { | ||
document.querySelector('button')!.click() | ||
}) | ||
|
||
expect(await getScrollTop()).toBe(4 * 55) | ||
expect(await getScrollTop(page)).toBe(4 * 55) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.