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


TypeScript testcafe.Selector函数代码示例

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


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

示例1: test

test(`Canvas width and height should equal to the container`, async t => {
    const demo = Selector('#instance1 .demo');
    const canvas = Selector('#instance1 .demo canvas');
    const open = Selector('#instance1 .btn-primary');
    const pasue = Selector('#instance1 .btn-danger');

    function testWH() {
        return new Promise(async resolve => {
            const dw: string = await demo.getStyleProperty('width').then(value => value);
            const dh: string = await demo.getStyleProperty('height').then(value => value);
            const cw: string = await canvas.getStyleProperty('width').then(value => value);
            const ch: string = await canvas.getStyleProperty('height').then(value => value);

            await t.expect(parseInt(cw)).eql(parseInt(dw));
            await t.expect(parseInt(ch)).eql(parseInt(dh));

            resolve();
        });
    }

    await testWH();
    await t.resizeWindow(1000, 400);
    await testWH();

    await t.click(open).click(pasue);
});
开发者ID:Barrior,项目名称:Particleground.js,代码行数:26,代码来源:particle.ts

示例2: test

test('Showing and hiding with buttons and window history', async t => {
  const goBack = ClientFunction(() => window.history.back());
  const goForward = ClientFunction(() => window.history.forward());

  // Ensures that the page loads before we start messing with history. Otherwise
  // Edge will click "back" right off of the page.
  await map.root();

  await t.click(Selector('a.btn'));
  await t.expect(map.leafletMap.exists).ok();

  await goBack();
  await t.expect(map.leafletMap.exists).notOk();

  await goForward();
  await t.expect(map.leafletMap.exists).ok();

  await t.click(map.modalCloseButton);
  await t.expect(map.leafletMap.exists).notOk();

  // Regression to ensure that the close button clears out the hash, otherwise
  // pressing the button won't cause a hashchange event.
  await t.click(Selector('a.btn'));
  await t.expect(map.leafletMap.exists).ok();
});
开发者ID:CityOfBoston,项目名称:cob-patterns,代码行数:25,代码来源:map.testcafe.ts

示例3: test

test('show "Thank you" message after submitting contact form', async t => {
  const nameInput = Selector('input[aria-label="Name"]');
  const emailInput = Selector('input[aria-label="Email"]');
  const messageInput = Selector('textarea[aria-label="Message"]');
  const submit = Selector('input[type="submit"]').withAttribute(
    'data-testid',
    'Send Message',
  );
  await t
    .typeText(nameInput, 'Me')
    .typeText(emailInput, 'test@example.com')
    .typeText(messageInput, 'lorem ipsum')
    .click(submit)
    .expect(Selector('[aria-label="Thank you"]').exists)
    .ok();
});
开发者ID:screendriver,项目名称:echooff.de,代码行数:16,代码来源:contact.test.ts

示例4: test

test('set input form elements', async (t) => {
  const email: string = 'userdive@example.com'
  const el = Selector('.form-group:first-of-type .form-controll')

  await t
    .typeText(el, email)
    .expect(el.value).eql(email)
})
开发者ID:uncovertruth,项目名称:examples,代码行数:8,代码来源:example.test.ts

示例5: test

test('Trump Card has 5 PP', async t => {
    await t.click('[name="close"]')
        .click('[value="teambuilder"]')
        .click('[name="newTop"]')
        .click('[name="addPokemon"]')
        // Eevee (e e v), Trump Card (t c)
        .pressKey('e e v enter enter enter t c')
        .expect(Selector('.hover .pplabelcol').textContent).eql('PP5');
});
开发者ID:mehrab2603,项目名称:Pokemon-Showdown-Client,代码行数:9,代码来源:test.ts

示例6: test

test('Chart updates when an item in drop down is selected', async t => {
  // Currently, our charts only support having one select option,
  // so we find and return the one 'select' element within cob-chart.
  const selectElem = Selector('select');
  const selectOptions = chartSelect.getSelectOptions();
  await selectOptions();

  await t
    .click(selectElem)
    .click(selectOptions.withText('Education'))
    .expect(selectElem.value)
    .eql('Education');

  // After selecting an item from the dropdown, we get the number of
  // bars on the chart again.
  const bars = chartSelect.getBars();
  await bars();
  // Check to make sure there are now 2 bars.
  await t.expect(bars.count).eql(2);
});
开发者ID:CityOfBoston,项目名称:cob-patterns,代码行数:20,代码来源:chart.testcafe.ts

示例7: test

test('keywords', async t => {
  await t
    .expect(Selector('meta[name="keywords"]').getAttribute('content'))
    .eql('TypeScript,JavaScript,HTML,CSS,Node.js,React,Vue');
});
开发者ID:screendriver,项目名称:echooff.de,代码行数:5,代码来源:seo.test.ts


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