Lines Matching refs:page

9 test.beforeEach(async ({ page }) => {
10 await page.goto(httpHost);
13 const openSearchModal = async (page) => {
14 await page.getByRole('button', {name: 'Search'}).click();
15 const modal = await page.getByRole('dialog', { name: 'Search modal' });
18 await expect(page.locator('#search-modal__backdrop.show')).not.toHaveClass('showing');
24 const expectModalToBeHidden = async (page, modal) => {
25 await expect(page.locator('#search-modal__backdrop')).not.toHaveClass(['show', 'hiding']);
37 test('should open search modal when search button is clicked', async ({ page }) => {
38 const searchModal = await openSearchModal(page);
42 test('should disable window scroll when search modal is open', async ({ page }) => {
43 await openSearchModal(page);
44 await page.mouse.wheel(0, 100);
45 await page.waitForTimeout(100);
46 const currentScrollY = await page.evaluate(() => window.scrollY);
50 test('should focus on search input when modal is opened', async ({ page }) => {
51 const modal = await openSearchModal(page);
57 test('should close search modal when close button is clicked', async ({ page }) => {
58 const modal = await openSearchModal(page);
60 await expectModalToBeHidden(page, modal);
63 test('should re-enable window scroll when search modal is closed', async ({ page }) => {
64 const modal = await openSearchModal(page);
66 await expectModalToBeHidden(page, modal);
67 await page.mouse.wheel(0, 100);
68 await page.waitForTimeout(100); // wait for scroll event to be processed
69 const currentScrollY = await page.evaluate(() => window.scrollY);
73 test('should close search modal when Escape key is pressed', async ({ page }) => {
74 const modal = await openSearchModal(page);
75 await page.keyboard.press('Escape');
76 await expectModalToBeHidden(page, modal);
79 test('should close search modal when clicking outside of it', async ({ page }) => {
80 const modal = await openSearchModal(page);
81 await page.click('#search-modal__backdrop', { position: { x: 10, y: 10 } });
82 await expectModalToBeHidden(page, modal);
85 test('should perform search and display results', async ({ page }) => {
86 const modal = await openSearchModal(page);
93 test('should navigate through search results with arrow keys', async ({ page }) => {
94 const modal = await openSearchModal(page);
98 await page.keyboard.press('ArrowDown');
101 await page.keyboard.press('ArrowDown');
102 await page.keyboard.press('ArrowDown');
103 await page.keyboard.press('ArrowDown');
106 await page.keyboard.press('ArrowUp');
110 test('should navigate to selected result page when Enter is pressed', async ({ page }) => {
111 const modal = await openSearchModal(page);
115 await page.keyboard.press('ArrowDown');
116 await page.keyboard.press('Enter');
117 await expect(page).toHaveURL(`http://${httpHost}/manual/en/function.strpos.php`);
120 test('should navigate to search page when Enter is pressed with no selection', async ({ page }) => {
121 const modal = await openSearchModal(page);
123 await page.keyboard.press('Enter');
124 await expect(page).toHaveURL(`http://${httpHost}/search.php?lang=en&q=php%20basics`);