How to use the testcafe.t.setTestSpeed function in testcafe

To help you get started, we’ve selected a few testcafe examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hdorgeval / testcafe-starter / steps / i-enter-my-name.ts View on Github external
export default async (): Promise => {
  // get the config that was injected into the fixture/test context by the feature
  const config: Config = getCurrentConfig(t);

  // get the page object model that was injected in the context
  const inputData = t.ctx.inputData as PageModel;

  const value = inputData.name || '';

  await t
    .setTestSpeed(config.testSpeed)
    .hover(selector.userNameInputBox)
    .expect(selector.userNameInputBox.hasAttribute('disabled'))
    .notOk()
    .click(selector.userNameInputBox)
    .typeText(selector.userNameInputBox, value, { replace: true })
    .pressKey('tab');
};
github hdorgeval / testcafe-starter / steps / i-send-my-feedback-on-testcafe.ts View on Github external
export default async (): Promise => {
  // get the config that was injected into the fixture/test context by the feature
  const config: Config = getCurrentConfig(t);

  await t
    .setTestSpeed(config.testSpeed)
    .hover(selector.submitButton)
    .expect(selector.submitButton.hasAttribute('disabled'))
    .notOk({ timeout: config.timeout.longTimeout })
    .click(selector.submitButton);
};
github hdorgeval / testcafe-starter / step-templates / basic-template-step.ts View on Github external
const config: Config = getCurrentConfig(t);

  // get the page object model that was injected in the test context
  const inputData = t.ctx.inputData as PageModel;

  // extract the value embedded in the step name
  // by convention this value is prefixed and postfixed by a single quote
  const value = firstMatch(/'.*'/g, stepName);
  if (value === null) {
    throw new Error(`Cannot extract value from the step name "${stepName}"`);
  }

  // you may use the Visual Studio Code Extension Testcafe Snippets
  // to help you write your tests

  await t
    .setTestSpeed(config.testSpeed)
    .hover(selector.firstInputBox)
    .expect(selector.firstInputBox.hasAttribute('disabled'))
    .notOk({ timeout: config.timeout.longTimeout })
    .typeText(selector.firstInputBox, value, { replace: true })
    .pressKey('tab');

  if (inputData.name) {
    await t
      .setTestSpeed(config.testSpeed)
      .hover(selector.secondInputBox)
      .expect(selector.secondInputBox.hasAttribute('disabled'))
      .notOk({ timeout: config.timeout.longTimeout })
      .typeText(selector.secondInputBox, inputData.name, { replace: true })
      .pressKey('tab');
  }
github hdorgeval / testcafe-starter / steps / i-do-something-specific.ts View on Github external
const config: IConfig = getCurrentConfig(t);

  // get the page object model that was injected in the test context
  const inputData = t.ctx.inputData as IPageModel;

  // extract the value embedded in the step name
  // by convention this value is prefixed and postfixed by a single quote
  const value = firstMatch(/'.*'/g, stepName);
  if (value === null) {
    throw new Error(`Cannot extract value from the step name "${stepName}"`);
  }

  // you may use the Visual Studio Code Extension Testcafe Snippets
  // to help you write your tests

  await t
    .setTestSpeed(config.testSpeed)
    .hover(selector.firstInputBox)
    .expect(selector.firstInputBox.hasAttribute('disabled'))
    .notOk({ timeout: config.timeout.longTimeout })
    .typeText(selector.firstInputBox, value, { replace: true })
    .pressKey('tab');

  if (inputData.name) {
    await t
      .setTestSpeed(config.testSpeed)
      .hover(selector.secondInputBox)
      .expect(selector.secondInputBox.hasAttribute('disabled'))
      .notOk({ timeout: config.timeout.longTimeout })
      .typeText(selector.secondInputBox, inputData.name, { replace: true })
      .pressKey('tab');
  }