UNPKG

wix-style-react

Version:
41 lines (36 loc) 1.21 kB
import { createTestkit, navigateToStory, } from '../../../../test/utils/sled-helpers'; import { eventually } from '@unidriver/core'; import { DropdownLayoutUniDriver, dropdownLayoutDriverFactory, } from '../../DropdownLayout.uni.driver'; describe('DropdownLayout', () => { it('loads more items until scrollable', async () => { const iframe = await navigateToStory( 'dropdownlayout--initial-items-not-scrollable', ); const { testkit } = await createTestkit<DropdownLayoutUniDriver>({ page: iframe, driver: dropdownLayoutDriverFactory, dataHook: 'dropdown-layout', }); await eventually(async () => { // the driver counts also the loader, probably a bug const optionsCount = (await testkit.optionsLength()) - 1; expect(optionsCount).toBe(12); }, 5000); // make sure we're not scrolling infinitely await new Promise((resolve, reject) => eventually(async () => { // the driver counts also the loader, probably a bug const optionsCount = (await testkit.optionsLength()) - 1; expect(optionsCount).toBeGreaterThan(12); }, 2000) .then(reject) .catch(resolve), ); }); });