當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。