• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript cucumber.defineSupportCode函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: defineSupportCode

defineSupportCode(function ({ Given, Then, When, setDefaultTimeout }) {
    Given('I choose to moderate members of the community before', () => {
        return utils.pressButton("#acceptBefore");
    });

    Given('I choose to moderate members of the community after', () => {
        return utils.pressButton("#acceptAfter");
    });

    When('I save the community', () => {
        return utils.pressButton(".save-community");
    });

    Given('I press button leave community', () => {
        utils.pressButton("profile-join .actions .profile-actions .leave");
        return browser.waitForAngular();
    });

    Given('I press button join community', () => {
        return utils.pressButton("profile-join .actions .profile-actions .join");
    });

    Given('I prepare community to run tests', () => {
        return utils.goTo("adminuser").then(() => {
            return utils.destroy("e2e-community");
        }).then(() => {
            return browser.get('/myprofile/adminuser');
        }).then( () => {
            browser.waitForAngular();
            return utils.pressButton('ul li .communities');
        }).then( () => {
            return utils.pressButton('.create-community');
        }).then( () => {
            return element(by.css('#name')).sendKeys('E2e community');
        }).then( () => {
            return utils.pressButton('#acceptAfter');
        }).then( () => {
            return utils.pressButton('.save-community');
        }).then( () => {
            return utils.goTo("e2e-community");
        });
    });
    Then('I should see join community button', () => {
        return expect(element(by.css("profile-join .actions .profile-actions .join")).isPresent()).to.eventually.equal(true);
    });
});
开发者ID:vfcosta,项目名称:angular-theme,代码行数:46,代码来源:community.steps.ts


示例2: require

import { browser } from 'protractor';
import { CalculatorPageObject } from '../pages/test.page';
import { defineSupportCode } from 'cucumber';
let chai = require('chai').use(require('chai-as-promised'));
let expect = chai.expect;

defineSupportCode(({Given, When, Then}) => {

  let calc: CalculatorPageObject = new CalculatorPageObject();

  Given(/^The calculator component is present$/, () => {
    browser.waitForAngular();
    return expect(browser.getTitle()).to.eventually.equal('My App');
  });

  When(/^I type two numbers "(.*?)" "(.*?)"$/, (num1: string, num2: string) => {
    calc.valueA.sendKeys(num1);
    return calc.valueB.sendKeys(num2);
  });

  Then(/^the correct result should be displayed "(.*?)"$/, (result: string) => {
    return expect(calc.result.getText()).to.eventually.equal(result);
  });
});
开发者ID:eontool,项目名称:angularjs-typescript-starter,代码行数:24,代码来源:test.steps.ts


示例3: defineSupportCode

import { expect } from 'chai';
import { defineSupportCode } from 'cucumber';
import { AppPage } from './app.po';

defineSupportCode(({Given, When, Then, Before}) => {
  let app: AppPage;

  Before(() => {
    app = new AppPage();
  });

  Given('I am on the angular.io site',
    () => app.navigateTo());

  When('I type {string} into the search input field',
    (text: string) => app.enterSearchInput(text));

  Then('I should see some results in the search overlay',
    () => app.getSearchResultItems()
      .then(elems => expect(elems.length).to.be.greaterThan(0)));

});
开发者ID:alexrun,项目名称:angular-protractor-cucumber,代码行数:22,代码来源:search.steps.ts


示例4: defineSupportCode

defineSupportCode(function ({ Given, Then, When, setDefaultTimeout }) {
    setDefaultTimeout(50000);

    Given('I go to the homepage', () => {
        return browser.get('/');
    });

    Then('I should be on the homepage', () => {
        return expect(browser.getCurrentUrl()).to.eventually.equal('http://localhost:49152/');
    });

    Then('I should be on {stringInDoubleQuotes}', (stringInDoubleQuotes) => {
        browser.waitForAngular();
        return expect(browser.getCurrentUrl()).to.eventually.equal(`http://localhost:49152${stringInDoubleQuotes}`);
    });

    Given('I follow {stringInDoubleQuotes}', (stringInDoubleQuotes) => {
        return utils.pressButton(stringInDoubleQuotes);
    });

    Given('I fill in the following:', (table, callback) => {
        for (const line of table.raw()) {
            element(by.css(line[0])).sendKeys(line[1]);
        };
        callback();
    });

    Given('I pause', (callback) => {
        browser.pause();
    });

    When('I press {stringInDoubleQuotes}', (stringInDoubleQuotes) => {
        return utils.pressButton(stringInDoubleQuotes);
    });

    When('I press first {stringInDoubleQuotes}', (stringInDoubleQuotes) => {
        return element.all(by.css(stringInDoubleQuotes)).first().click();
    });

    Then('I should be logged in as {stringInDoubleQuotes}', (stringInDoubleQuotes) => {
        return expect(element(by.css('#navbar .profile-link .truncated-profile-name')).getText()).to.eventually.equal(stringInDoubleQuotes);
    });

    Given('I login with {stringInDoubleQuotes}, {stringInDoubleQuotes}', (user: string, password: string) => {
        return utils.pressButton('#navbar .login').then(() => {
            return element(by.css(".modal-dialog #email")).sendKeys(user);
        }).then(() => {
            return element(by.css(".modal-dialog #passwd")).sendKeys(password);
        }).then(() => {
            return utils.pressButton(".btn-login");
        });
    });

    Given('I go to {stringInDoubleQuotes} profile', (profile) => {
        browser.waitForAngular();
        return browser.driver.get(`http://localhost:49152/${profile}`);
    });

    Given('I go to {stringInDoubleQuotes}', (page) => {
        browser.waitForAngular();
        return browser.driver.get(`http://localhost:49152${page}`);
    });

    Given('I enter in edit mode', () => {
        return utils.pressButton(".button-edit-mode");
    });

    Given('I enter in profile setup', () => {
        return utils.pressButton(".open-setup");
    });

    Given('I enter members menu', () => {
        return utils.pressButton("ul li .members");
    });

    Given('I upload {stringInDoubleQuotes} to {stringInDoubleQuotes}', (file, selector) => {
        return element(by.css(selector)).sendKeys(path.resolve(__dirname, `../../assets/${file}`));
    });

    Then('I see {stringInDoubleQuotes} as top image', (image) => {
        return expect(element(by.css('noosfero-profile-header .profile-header')).getCssValue('background-image')).to.eventually.contain(image);
    });

    Given('I am logged out', () => {
        return element(by.css("#navbar .profile-menu > .profile-link")).isPresent().then((present) => {
            if (present) {
                return utils.pressButton("#navbar .profile-menu > .profile-link").then(() => {
                    return utils.pressButton("#navbar .btn-logout");
                });
            }
        });
    });

    When('I change layout to {stringInDoubleQuotes}', (stringInDoubleQuotes) => {
        return utils.pressButton("#layout-config-btn").then(() => {
            return utils.pressButton(`.layout-config .dropdown-menu .layout-${stringInDoubleQuotes} a.dropdown-item`);
        });
    });

    Then('I see {stringInDoubleQuotes} {int} times', (selector, amount) => {
//.........这里部分代码省略.........
开发者ID:vfcosta,项目名称:angular-theme,代码行数:101,代码来源:steps.ts


示例5: require

import { browser } from 'protractor';
import { CalculatorPageObject } from '../pages/calcPage';
import { defineSupportCode } from 'cucumber';
let chai = require('chai').use(require('chai-as-promised'));
let expect = chai.expect;
/*
StepDefinition files act as the glue code between config and feature files
They drive the feature files from the background
**/
defineSupportCode(({Given, When, Then}) => {
  let calc: CalculatorPageObject = new CalculatorPageObject();

  Given(/^I am on ng1 calculator page$/, () => {
    return expect(browser.getTitle()).to.eventually.equal('Super Calculator');
  });

  When(/^I calculate "(.*?)" "(.*?)" "(.*?)"$/, (num1: string, optor: string, num2: string) => {
    calc.first_operand.sendKeys(num1);
    calc.operator(optor).click();
    calc.second_operand.sendKeys(num2);
    return calc.go_button.click();
  });

  Then(/^the result "(.*?)" should be displayed$/, (result: string) => {
    return expect(calc.result.getText()).to.eventually.equal(result);
  });
})

开发者ID:angular,项目名称:protractor-cookbook,代码行数:27,代码来源:calcSteps.ts


示例6: defineSupportCode

defineSupportCode(function ({registerHandler, After }) {

  registerHandler('BeforeFeature', (event) => {
    return browser.get(`http://127.0.0.1:9000/`);
  });

  After((scenario, callback) => {

    if (scenario.failureException) {

      browser.driver.takeScreenshot().then(
        (image) => {

          const decodedImage = new Buffer(image, `base64`);
          scenario.attach(decodedImage, `image/png`);
          callback();

        }
      );

    } else {

      browser.driver.takeScreenshot().then(
        (image) => {

          const decodedImage = new Buffer(image, `base64`);
          scenario.attach(decodedImage, `image/png`);
          callback();

        }
      );

    }

  });

});
开发者ID:eontool,项目名称:angularjs-typescript-starter,代码行数:37,代码来源:hooks.ts


示例7: defineSupportCode

import { defineSupportCode } from 'cucumber';
import { browser, by, element } from 'protractor';
import * as chai from 'chai';
import * as cap from 'chai-as-promised';
chai.use(cap);
const expect = chai.expect;

defineSupportCode(async ({ Before, Given, Then }) => {
  Before({ timeout: 30000 }, async function() {
    browser.ignoreSynchronization = true;
    await browser.get(browser.baseUrl);
  });

  Given(/^he is on "([^"]*)"$/, async function(url: string): Promise<void> {
    const currentUrl = await browser.getCurrentUrl();
    expect(currentUrl).to.equal(`${browser.baseUrl}${url}`);
  });

  Then(/^he get title "([^"]*)"$/, async function(title: string): Promise<void> {
    const currentTitle = await browser.getTitle();
    expect(currentTitle).to.equal(title);
  });
});
开发者ID:garlictech,项目名称:generator-garlic-webapp,代码行数:23,代码来源:homepage.ts


示例8: defineSupportCode

/*jslint node: true*/
import { browser } from 'protractor';
import { defineSupportCode } from "cucumber";
import * as fs from 'fs';
/*
Hooks help us follow DRY principle, all the utility functions go here
BeforeScenario, Features and screenshot hooks example provided here
**/
defineSupportCode(function ({registerHandler, After}) {

  registerHandler('BeforeFeature', (event) => {
    return browser.get('/ng1/calculator');
  });

  After((scenario, done) => {
    if (scenario.isFailed()) {
      return browser.takeScreenshot().then(function (base64png) {
        let decodedImage = new Buffer(base64png, 'base64').toString('binary');
        scenario.attach(decodedImage, 'image/png');
      }, (err) => {
        done(err);
      });
    } else {
      done();
    }
  });
})
开发者ID:angular,项目名称:protractor-cookbook,代码行数:27,代码来源:hooks.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript cucumber.setDefaultTimeout函数代码示例发布时间:2022-05-25
下一篇:
TypeScript cucumber.When函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap