Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: move files in utils in subfolder #12384

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .mocharc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if (!!process.env.DEBUGGER_ATTACHED) {
module.exports = {
reporter: 'dot',
logLevel: 'debug',
require: ['./test/build/mocha-utils.js', 'source-map-support/register'],
require: ['./test/build/utils/mocha-utils.js', 'source-map-support/register'],
exit: !!process.env.CI,
retries: process.env.CI ? 3 : 0,
parallel: !!process.env.PARALLEL,
Expand Down
2 changes: 1 addition & 1 deletion packages/browsers/.mocharc.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
logLevel: 'debug',
spec: 'test/build/**/*.spec.js',
require: ['./test/build/mocha-utils.js'],
require: ['./test/build/utils/mocha-utils.js'],
exit: !!process.env.CI,
reporter: 'spec',
timeout: 10_000,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test/src/accessibility.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import assert from 'assert';
import expect from 'expect';
import type {SerializedAXNode} from 'puppeteer-core/internal/cdp/Accessibility.js';

import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
import {getTestState, setupTestBrowserHooks} from './utils/mocha-utils.js';

describe('Accessibility', function () {
setupTestBrowserHooks();
Expand Down
4 changes: 2 additions & 2 deletions test/src/ariaqueryhandler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import expect from 'expect';
import {TimeoutError} from 'puppeteer';
import type {ElementHandle} from 'puppeteer-core/internal/api/ElementHandle.js';

import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
import {attachFrame, detachFrame} from './utils.js';
import {getTestState, setupTestBrowserHooks} from './utils/mocha-utils.js';
import {attachFrame, detachFrame} from './utils/utils.js';

describe('AriaQueryHandler', () => {
setupTestBrowserHooks();
Expand Down
2 changes: 1 addition & 1 deletion test/src/autofill.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import expect from 'expect';

import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
import {getTestState, setupTestBrowserHooks} from './utils/mocha-utils.js';

describe('Autofill', function () {
setupTestBrowserHooks();
Expand Down
6 changes: 5 additions & 1 deletion test/src/browser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@

import expect from 'expect';

import {getTestState, launch, setupTestBrowserHooks} from './mocha-utils.js';
import {
getTestState,
launch,
setupTestBrowserHooks,
} from './utils/mocha-utils.js';

describe('Browser specs', function () {
setupTestBrowserHooks();
Expand Down
4 changes: 2 additions & 2 deletions test/src/browsercontext.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import expect from 'expect';
import {TimeoutError} from 'puppeteer';
import type {Page} from 'puppeteer-core/internal/api/Page.js';

import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
import {waitEvent} from './utils.js';
import {getTestState, setupTestBrowserHooks} from './utils/mocha-utils.js';
import {waitEvent} from './utils/utils.js';

describe('BrowserContext', function () {
setupTestBrowserHooks();
Expand Down
4 changes: 2 additions & 2 deletions test/src/cdp/CDPSession.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import expect from 'expect';
import type {Target} from 'puppeteer-core/internal/api/Target.js';
import {isErrorLike} from 'puppeteer-core/internal/util/ErrorLike.js';

import {getTestState, setupTestBrowserHooks} from '../mocha-utils.js';
import {waitEvent} from '../utils.js';
import {getTestState, setupTestBrowserHooks} from '../utils/mocha-utils.js';
import {waitEvent} from '../utils/utils.js';

describe('Target.createCDPSession', function () {
setupTestBrowserHooks();
Expand Down
4 changes: 2 additions & 2 deletions test/src/cdp/TargetManager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import expect from 'expect';
import type {CdpBrowser} from 'puppeteer-core/internal/cdp/Browser.js';

import {getTestState, launch} from '../mocha-utils.js';
import {attachFrame} from '../utils.js';
import {getTestState, launch} from '../utils/mocha-utils.js';
import {attachFrame} from '../utils/utils.js';

describe('TargetManager', () => {
/* We use a special browser for this test as we need the --site-per-process flag */
Expand Down
4 changes: 2 additions & 2 deletions test/src/cdp/bfcache.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import expect from 'expect';
import {PageEvent} from 'puppeteer-core';

import {launch} from '../mocha-utils.js';
import {waitEvent} from '../utils.js';
import {launch} from '../utils/mocha-utils.js';
import {waitEvent} from '../utils/utils.js';

describe('BFCache', function () {
it('can navigate to a BFCached page', async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/src/cdp/devtools.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import expect from 'expect';
import type {PuppeteerLaunchOptions} from 'puppeteer-core/internal/node/PuppeteerNode.js';

import {getTestState, launch} from '../mocha-utils.js';
import {getTestState, launch} from '../utils/mocha-utils.js';

describe('DevTools', function () {
/* These tests fire up an actual browser so let's
Expand Down
2 changes: 1 addition & 1 deletion test/src/cdp/extensions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import path from 'path';
import expect from 'expect';
import type {PuppeteerLaunchOptions} from 'puppeteer-core/internal/node/PuppeteerNode.js';

import {getTestState, launch} from '../mocha-utils.js';
import {getTestState, launch} from '../utils/mocha-utils.js';

const extensionPath = path.join(
__dirname,
Expand Down
2 changes: 1 addition & 1 deletion test/src/cdp/pdf.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {readFile, unlink} from 'fs/promises';

import expect from 'expect';

import {getTestState, setupTestBrowserHooks} from '../mocha-utils.js';
import {getTestState, setupTestBrowserHooks} from '../utils/mocha-utils.js';

describe('Page.pdf', () => {
setupTestBrowserHooks();
Expand Down
4 changes: 2 additions & 2 deletions test/src/cdp/prerender.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {statSync} from 'fs';

import expect from 'expect';

import {getTestState, setupTestBrowserHooks} from '../mocha-utils.js';
import {getUniqueVideoFilePlaceholder} from '../utils.js';
import {getTestState, setupTestBrowserHooks} from '../utils/mocha-utils.js';
import {getUniqueVideoFilePlaceholder} from '../utils/utils.js';

describe('Prerender', function () {
setupTestBrowserHooks();
Expand Down
2 changes: 1 addition & 1 deletion test/src/cdp/queryObjects.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
import expect from 'expect';

import {getTestState, setupTestBrowserHooks} from '../mocha-utils.js';
import {getTestState, setupTestBrowserHooks} from '../utils/mocha-utils.js';

describe('page.queryObjects', function () {
setupTestBrowserHooks();
Expand Down
4 changes: 2 additions & 2 deletions test/src/cdp/screencast.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {statSync} from 'fs';

import expect from 'expect';

import {getTestState, setupTestBrowserHooks} from '../mocha-utils.js';
import {getUniqueVideoFilePlaceholder} from '../utils.js';
import {getTestState, setupTestBrowserHooks} from '../utils/mocha-utils.js';
import {getUniqueVideoFilePlaceholder} from '../utils/utils.js';

describe('Screencasts', function () {
setupTestBrowserHooks();
Expand Down
8 changes: 6 additions & 2 deletions test/src/chromiumonly.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ import type {IncomingMessage} from 'http';
import expect from 'expect';
import {Deferred} from 'puppeteer-core/internal/util/Deferred.js';

import {getTestState, setupTestBrowserHooks, launch} from './mocha-utils.js';
import {waitEvent} from './utils.js';
import {
getTestState,
setupTestBrowserHooks,
launch,
} from './utils/mocha-utils.js';
import {waitEvent} from './utils/utils.js';
// TODO: rename this test suite to launch/connect test suite as it actually
// works across browsers.
describe('Chromium-Specific Launcher tests', function () {
Expand Down
4 changes: 2 additions & 2 deletions test/src/click.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import expect from 'expect';
import {KnownDevices} from 'puppeteer';

import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
import {attachFrame} from './utils.js';
import {getTestState, setupTestBrowserHooks} from './utils/mocha-utils.js';
import {attachFrame} from './utils/utils.js';

describe('Page.click', function () {
setupTestBrowserHooks();
Expand Down
2 changes: 1 addition & 1 deletion test/src/cookies.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
getTestState,
launch,
setupTestBrowserHooks,
} from './mocha-utils.js';
} from './utils/mocha-utils.js';

describe('Cookie specs', () => {
setupTestBrowserHooks();
Expand Down
2 changes: 1 addition & 1 deletion test/src/coverage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import expect from 'expect';

import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
import {getTestState, setupTestBrowserHooks} from './utils/mocha-utils.js';

describe('Coverage specs', function () {
setupTestBrowserHooks();
Expand Down
2 changes: 1 addition & 1 deletion test/src/debugInfo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import expect from 'expect';

import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
import {getTestState, setupTestBrowserHooks} from './utils/mocha-utils.js';

describe('DebugInfo', function () {
setupTestBrowserHooks();
Expand Down
2 changes: 1 addition & 1 deletion test/src/defaultbrowsercontext.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
expectCookieEquals,
getTestState,
setupTestBrowserHooks,
} from './mocha-utils.js';
} from './utils/mocha-utils.js';

describe('DefaultBrowserContext', function () {
setupTestBrowserHooks();
Expand Down
2 changes: 1 addition & 1 deletion test/src/device-request-prompt.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import expect from 'expect';
import {TimeoutError} from 'puppeteer';

import {launch} from './mocha-utils.js';
import {launch} from './utils/mocha-utils.js';

describe('device request prompt', function () {
let state: Awaited<ReturnType<typeof launch>>;
Expand Down
2 changes: 1 addition & 1 deletion test/src/dialog.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import expect from 'expect';
import sinon from 'sinon';

import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
import {getTestState, setupTestBrowserHooks} from './utils/mocha-utils.js';

describe('Page.Events.Dialog', function () {
setupTestBrowserHooks();
Expand Down
2 changes: 1 addition & 1 deletion test/src/drag-and-drop.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import assert from 'assert';

import expect from 'expect';

import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
import {getTestState, setupTestBrowserHooks} from './utils/mocha-utils.js';

async function getDragState() {
const {page} = await getTestState({skipLaunch: true});
Expand Down
7 changes: 3 additions & 4 deletions test/src/elementhandle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ import {
} from 'puppeteer-core/internal/util/disposable.js';
import sinon from 'sinon';

import {getTestState, setupTestBrowserHooks} from './utils/mocha-utils.js';
import {
getTestState,
setupTestBrowserHooks,
attachFrame,
shortWaitForArrayToHaveAtLeastNElements,
} from './mocha-utils.js';
import {attachFrame} from './utils.js';
} from './utils/utils.js';

describe('ElementHandle specs', function () {
setupTestBrowserHooks();
Expand Down
2 changes: 1 addition & 1 deletion test/src/emulation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import expect from 'expect';
import {KnownDevices, PredefinedNetworkConditions} from 'puppeteer';

import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
import {getTestState, setupTestBrowserHooks} from './utils/mocha-utils.js';

const iPhone = KnownDevices['iPhone 6'];
const iPhoneLandscape = KnownDevices['iPhone 6 landscape'];
Expand Down
4 changes: 2 additions & 2 deletions test/src/evaluation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

import expect from 'expect';

import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
import {attachFrame} from './utils.js';
import {getTestState, setupTestBrowserHooks} from './utils/mocha-utils.js';
import {attachFrame} from './utils/utils.js';

describe('Evaluation specs', function () {
setupTestBrowserHooks();
Expand Down
4 changes: 2 additions & 2 deletions test/src/fixtures.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import path from 'path';

import expect from 'expect';

import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
import {waitEvent} from './utils.js';
import {getTestState, setupTestBrowserHooks} from './utils/mocha-utils.js';
import {waitEvent} from './utils/utils.js';

describe('Fixtures', function () {
setupTestBrowserHooks();
Expand Down
4 changes: 2 additions & 2 deletions test/src/frame.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import {CDPSession} from 'puppeteer-core/internal/api/CDPSession.js';
import type {Frame} from 'puppeteer-core/internal/api/Frame.js';
import {assert} from 'puppeteer-core/internal/util/assert.js';

import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
import {getTestState, setupTestBrowserHooks} from './utils/mocha-utils.js';
import {
attachFrame,
detachFrame,
dumpFrames,
navigateFrame,
waitEvent,
} from './utils.js';
} from './utils/utils.js';

describe('Frame specs', function () {
setupTestBrowserHooks();
Expand Down
2 changes: 1 addition & 1 deletion test/src/headful.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import expect from 'expect';
import type {PuppeteerLaunchOptions} from 'puppeteer-core/internal/node/PuppeteerNode.js';
import {rmSync} from 'puppeteer-core/internal/node/util/fs.js';

import {getTestState, launch} from './mocha-utils.js';
import {getTestState, launch} from './utils/mocha-utils.js';

const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-');

Expand Down
2 changes: 1 addition & 1 deletion test/src/idle_override.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import expect from 'expect';
import type {ElementHandle} from 'puppeteer-core/internal/api/ElementHandle.js';
import type {Page} from 'puppeteer-core/internal/api/Page.js';

import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
import {getTestState, setupTestBrowserHooks} from './utils/mocha-utils.js';

describe('Emulate idle state', () => {
setupTestBrowserHooks();
Expand Down
2 changes: 1 addition & 1 deletion test/src/ignorehttpserrors.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {TLSSocket} from 'tls';
import expect from 'expect';
import type {HTTPResponse} from 'puppeteer-core/internal/api/HTTPResponse.js';

import {launch} from './mocha-utils.js';
import {launch} from './utils/mocha-utils.js';

describe('ignoreHTTPSErrors', function () {
/* Note that this test creates its own browser rather than use
Expand Down
2 changes: 1 addition & 1 deletion test/src/injected.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import expect from 'expect';
import {LazyArg} from 'puppeteer-core/internal/common/LazyArg.js';

import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
import {getTestState, setupTestBrowserHooks} from './utils/mocha-utils.js';

describe('PuppeteerUtil tests', function () {
setupTestBrowserHooks();
Expand Down
4 changes: 2 additions & 2 deletions test/src/input.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import path from 'path';
import expect from 'expect';
import {TimeoutError} from 'puppeteer';

import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
import {waitEvent} from './utils.js';
import {getTestState, setupTestBrowserHooks} from './utils/mocha-utils.js';
import {waitEvent} from './utils/utils.js';

const FILE_TO_UPLOAD = path.join(__dirname, '/../assets/file-to-upload.txt');

Expand Down
2 changes: 1 addition & 1 deletion test/src/jshandle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from 'puppeteer-core/internal/util/disposable.js';
import sinon from 'sinon';

import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
import {getTestState, setupTestBrowserHooks} from './utils/mocha-utils.js';

describe('JSHandle', function () {
setupTestBrowserHooks();
Expand Down
4 changes: 2 additions & 2 deletions test/src/keyboard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import os from 'os';
import expect from 'expect';
import type {KeyInput} from 'puppeteer-core/internal/common/USKeyboardLayout.js';

import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
import {attachFrame} from './utils.js';
import {getTestState, setupTestBrowserHooks} from './utils/mocha-utils.js';
import {attachFrame} from './utils/utils.js';

describe('Keyboard', function () {
setupTestBrowserHooks();
Expand Down
4 changes: 2 additions & 2 deletions test/src/launcher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import type {Page} from 'puppeteer-core/internal/api/Page.js';
import {rmSync} from 'puppeteer-core/internal/node/util/fs.js';
import sinon from 'sinon';

import {getTestState, launch} from './mocha-utils.js';
import {dumpFrames, waitEvent} from './utils.js';
import {getTestState, launch} from './utils/mocha-utils.js';
import {dumpFrames, waitEvent} from './utils/utils.js';

const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-');
const FIREFOX_TIMEOUT = 30_000;
Expand Down