Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/remote/test/puppeteer/test/src/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 1 kB image not shown  

Quelle  download.spec.ts   Sprache: JAVA

 

/**
 * @license
 * Copyright 2024 Google Inc.
 * SPDX-License-Identifier: Apache-2.0
 */


import {mkdtemp, rm} from 'node:fs/promises';
import {tmpdir} from 'node:os';
import {join} from 'node:path';

import expect from 'expect';

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

describe('Download', () => {
  setupTestBrowserHooks();
  let tempDir: string;

  beforeEach(async () => {
    tempDir = await mkdtemp(join(tmpdir(), 'downloads-'));
  });

  afterEach(async () => {
    await rm(tempDir, {recursive: true, force: true});
  });

  describe('Browser.createBrowserContext', () => {
    it('should download to configured location', async () => {
      const {browser, server} = await getTestState({
        skipContextCreation: true,
      });

      using context = await browser.createBrowserContext({
        downloadBehavior: {
          policy: 'allow',
          downloadPath: tempDir,
        },
      });
      const page = await context.newPage();
      await page.goto(server.PREFIX + '/download.html');
      await page.click('#download');
      await waitForFileExistence(join(tempDir, 'download.txt'));
    });
    it('should not download to location', async () => {
      const {browser, server} = await getTestState({
        skipContextCreation: true,
      });

      using context = await browser.createBrowserContext({
        downloadBehavior: {
          policy: 'deny',
          downloadPath: '/tmp',
        },
      });
      const page = await context.newPage();
      await page.goto(server.PREFIX + '/download.html');
      await page.click('#download');
      await expect(
        waitForFileExistence(join(tempDir, 'download.txt')),
      ).rejects.toThrow();
    });
  });
});

Messung V0.5 in Prozent
C=99 H=75 G=87

¤ Dauer der Verarbeitung: 0.8 Sekunden  (vorverarbeitet am  2026-09-28) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.