当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript cucumber.After函数代码示例

本文整理汇总了TypeScript中cucumber.After函数的典型用法代码示例。如果您正苦于以下问题:TypeScript After函数的具体用法?TypeScript After怎么用?TypeScript After使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了After函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: catch

    await fs.stat(this.rootDir)
    rootDirExists = true
  } catch (e) {
    // nothing to do here
  }
  if (rootDirExists) {
    rimraf.sync(this.rootDir)
  }
  await fs.mkdir(this.rootDir)
})

After(async function(scenario) {
  await endChildProcesses()
  if (scenario.result.status === 'failed') {
    console.log('\ntest artifacts are located in', this.rootDir)
  } else {
    const rimrafp = util.promisify(rimraf)
    await rimrafp(this.rootDir, { maxBusyTries: 20 })
  }
})

Before({ tags: '@verbose' }, function() {
  this.verbose = true
})

After({ tags: '@verbose' }, function() {
  this.verbose = false
})

Before({ tags: '@debug' }, function() {
  this.debug = true
开发者ID:Originate,项目名称:tutorial-runner,代码行数:31,代码来源:env.ts

示例2: use

import chaiFs from 'chai-fs';
import chaiString from 'chai-string';
import { Question } from './world';

use(chaiString);
use(chaiFs);

use(chaiJestSnapshot);

BeforeAll(function() {
  chaiJestSnapshot.resetSnapshotRegistry();
});

After(function() {
  if (this.spawned && !this.output.closed) {
    this.spawned.kill();
  }
});

Before(function(testCase) {
  const { name } = testCase.pickle;

  this.snapshot.testname = name;
  this.snapshot.filename = `features/__snaps__/${name
    .toLowerCase()
    .replace(/\s/g, '-')}.snap`;
});

/**
 * Given I Have
 */
开发者ID:valtech-nyc,项目名称:brookjs,代码行数:31,代码来源:steps.ts

示例3: StepSampleWithoutDefineSupportCode

function StepSampleWithoutDefineSupportCode() {
    setWorldConstructor(function({attach, parameters}) {
        this.attach = attach;
        this.parameters = parameters;
        this.visit = (url: string, callback: Callback) => {
            callback(null, 'pending');
        };
        this.toInt = parseInt;
    });

    Before((scenarioResult: HookScenarioResult, callback: Callback) => {
        console.log(scenarioResult.result.status === Status.FAILED);
        callback();
    });

    Before({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => {
        console.log(scenarioResult.result.status === Status.FAILED);
        callback();
    });

    Before('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => {
        console.log(scenarioResult.result.status === Status.FAILED);
        callback();
    });

    BeforeAll((callback: Callback) => {
        console.log("Before all");
        callback();
    });

    BeforeAll({ timeout: 1000 }, (callback: Callback) => {
        console.log("Before all");
        callback();
    });

    BeforeAll('@tag', (callback: Callback) => {
        console.log("Before all");
        callback();
    });

    After((scenarioResult: HookScenarioResult, callback: Callback) => {
        console.log("After");
        callback();
    });

    After({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => {
        console.log("After");
        callback();
    });

    After('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => {
        console.log("After");
        callback();
    });

    AfterAll((callback: Callback) => {
        console.log("After all");
        callback();
    });

    AfterAll({ timeout: 1000 }, (callback: Callback) => {
        console.log("After all");
        callback();
    });

    AfterAll('@tag', (callback: Callback) => {
        console.log("After all");
        callback();
    });

    Given(/^a variable set to (\d+)$/, (x: string) => {
        console.log("the number is: " + x);
    });

    Given(/^a variable set to (\d+)$/, (x: number) => {
        console.log(typeof x);
    });

    Given(/^I am on the Cucumber.js GitHub repository$/, function(callback: Callback) {
        this.visit('https://github.com/cucumber/cucumber-js', callback);
    });

    When(/^I go to the README file$/, (title: string, callback: Callback) => {
        callback(null, 'pending');
    });

    Then(/^I should see "(.*)" as the page title$/, {timeout: 60 * 1000}, function(title: string, callback: Callback) {
        const pageTitle = this.browser.text('title');

        if (title === pageTitle) {
            callback();
        } else {
            callback(new Error("Expected to be on page with title " + title));
        }
    });

    // Type for data_table.js on
    // https://github.com/cucumber/cucumber-js/blob/a5fd8251918c278ab2e389226d165cedb44df14a/lib/cucumber/ast/data_table.js

    Given(/^a table step with Table raw$/, (table: Table) => {
//.........这里部分代码省略.........
开发者ID:AlexGalays,项目名称:DefinitelyTyped,代码行数:101,代码来源:cucumber-tests.ts

示例4: require

const { BeforeAll, After, Status } = require("cucumber");
import * as fs from "fs";
import { browser } from "protractor";
import { config } from "../config/config";

BeforeAll({timeout: 10 * 1000}, async () => {
    await browser.get(config.baseUrl);
});

After(async function(scenario) {
    if (scenario.result.status === Status.FAILED) {
        // screenShot is a base-64 encoded PNG
         const screenShot = await browser.takeScreenshot();
         this.attach(screenShot, "image/png");
    }
});
开发者ID:alexrun,项目名称:protractor-cucumber-typescript,代码行数:16,代码来源:hooks.ts


注:本文中的cucumber.After函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。