Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/remote/test/puppeteer/test/src/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  download.spec.ts

  Sprache: JAVA
 

Spracherkennung für: .ts vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

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

import {mkdtemp, rm} from 'fs/promises';
import {tmpdir} from 'os';
import {join} from '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();
    });
  });
});

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet am  2026-04-29) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

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.