本文整理汇总了TypeScript中protractor/built.browser.executeScript方法的典型用法代码示例。如果您正苦于以下问题:TypeScript browser.executeScript方法的具体用法?TypeScript browser.executeScript怎么用?TypeScript browser.executeScript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类protractor/built.browser
的用法示例。
在下文中一共展示了browser.executeScript方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should not let inviting if other character is already in party', () => {
createParty();
createParty(browser3.instance);
browser.executeScript(`socket.emit("invite_to_party", {char_name: "${TEST_CHAR_NAME3}"});`);
expectText("Cannot invite - invitee is already in a party");
leaveParty();
leaveParty(browser3.instance);
});
示例2: it
it('should discard the invitation after joining once', () => {
createParty(browser3.instance);
joinParty(browser3.instance, browser, TEST_CHAR_NAME3, TEST_CHAR_NAME);
leaveParty(browser);
browser.executeScript(`socket.emit("join_party", {leader_name: "${TEST_CHAR_NAME3}"});`);
expectText("Cannot join - not invited anymore");
leaveParty(browser3.instance);
});
示例3: it
it('should tell me how much gold i picked', () => {
browser.executeScript(`socket.emit("dropped_gold", {amount: 5});`)
getItemId().then(itemId => {
clearLogs();
browser.executeScript(`socket.emit("picked_item", {item_id: "${itemId}"});`)
expectText(`"amount": 5`);
});
});
示例4: it
it('should reflect toggling the value', () => {
page.navigateTo();
return browser.executeScript('window.scrollTo(0, 500);').then(function() {
const el = page.getIonicToggle();
el.click();
expect(page.getToggleOutput()).toEqual('true');
});
});
示例5: it
it('should reflect back the changed value', () => {
page.navigateTo();
return browser.executeScript('window.scrollTo(0, 500);').then(function() {
const btns = page.getSegmentButtons();
btns.chicken.click();
expect(page.getRadioOutputText()).toEqual('chicken');
});
});
示例6: it
it('should not kick member if not party leader', () => {
createParty(browser);
joinParty(browser, browser3.instance, TEST_CHAR_NAME, TEST_CHAR_NAME3);
changeLeader(browser, browser3.instance, TEST_CHAR_NAME3);
browser.executeScript(`socket.emit("kick_from_party", {char_name: "${TEST_CHAR_NAME3}"});`);
expectText("Cannot kick - must be party leader");
leaveParty(browser);
leaveParty(browser3.instance);
});
示例7: getItemId
getItemId().then(itemId => {
clearLogs();
browser.executeScript(`socket.emit("picked_item", {item_id: "${itemId}"});`)
expectText(`"amount": 5`);
leaveParty();
leaveParty(newBrowser.instance);
leaveParty(browser3.instance);
// bring back the gold to the other char
newBrowser.instance.executeScript(`socket.emit("dropped_gold", {amount: 5});`)
expectText(`"amount": -5`, newBrowser.instance);
pickItem();
});