function postMessage(action, data) { if (window.parent === window.self) { return; } window.parent.postMessage({ action, data, }, '*'); }
const inIframe = () => { try { return window.self !== window.top; } catch ( e ) { return true; } }
async function findClickable(locator, locateFn) { locator = new Locator(locator); if (!locator.isFuzzy()) return locateFn(locator.simplify(), true); if (locator.isAccessibilityId()) return locateFn(withAccessiblitiyLocator.call(this, locator.value), true); let els; const literal = xpathLocator.literal(locator.value); els = await locateFn(Locator.clickable.narrow(literal)); if (els.value.length) return els; els = await locateFn(Locator.clickable.wide(literal)); if (els.value.length) return els; els = await locateFn(Locator.clickable.self(literal)); if (els.value.length) return els; return locateFn(locator.value); // by css or xpath }
/** * Dispatches an event of the specified type from the * reveal DOM element. */ function dispatchEvent( type, args ) { var event = document.createEvent( 'HTMLEvents', 1, 2 ); event.initEvent( type, true, true ); extend( event, args ); dom.wrapper.dispatchEvent( event ); // If we're in an iframe, post each reveal.js event to the // parent window. Used by the notes plugin if( config.postMessageEvents && window.parent !== window.self ) { window.parent.postMessage( JSON.stringify({ namespace: 'reveal', eventName: type, state: getState() }), '*' ); } }
async function findClickable(locator, locateFn) { locator = new Locator(locator); if (locator.isAccessibilityId() && !this.isWeb) return locateFn(locator, true); if (!locator.isFuzzy()) return locateFn(locator, true); let els; const literal = xpathLocator.literal(locator.value); els = await locateFn(Locator.clickable.narrow(literal)); if (els.length) return els; els = await locateFn(Locator.clickable.wide(literal)); if (els.length) return els; els = await locateFn(Locator.clickable.self(literal)); if (els.length) return els; return locateFn(locator.value); // by css or xpath }
async function findClickable(matcher, locator) { if (locator && locator.react) throw new Error('react locators are not yet supported'); locator = new Locator(locator); if (!locator.isFuzzy()) return (await findElements.call(this, matcher, locator)).filterVisible(); let els; // try to use native TestCafe locator els = matcher ? matcher.find('a,button') : createSelector('a,button'); els = await els.withExactText(locator.value).with({ timeout: 0, boundTestRun: this.t }); if (await els.count) return els; const literal = xpathLocator.literal(locator.value); els = (await findElements.call(this, matcher, Locator.clickable.narrow(literal))).filterVisible(); if (await els.count) return els; els = (await findElements.call(this, matcher, Locator.clickable.wide(literal))).filterVisible(); if (await els.count) return els; els = (await findElements.call(this, matcher, Locator.clickable.self(literal))).filterVisible(); if (await els.count) return els; return findElements.call(this, matcher, locator.value); // by css or xpath }
async buildGraphQl () { const options = this.createContentTypeOptions() const { addContentType, addCollection = addContentType } = this.actions this.collection = addCollection(options) for (const item of this.response) { const fields = this.processFields(item.attributes) const relationships = this.processRelationships(item.relationships) const origin = typeof item.links.self === 'object' ? item.links.self.href : item.links.self this.collection.addNode({ title: fields.title || fields.name, date: fields.created || fields.changed, ...fields, ...relationships, id: item.id, internal: { origin } }) } }
async function findClickable(matcher, locator) { locator = new Locator(locator); if (!locator.isFuzzy()) return findElements.call(this, matcher, locator); let els; const literal = xpathLocator.literal(locator.value); els = await findElements.call(this, matcher, Locator.clickable.narrow(literal)); if (els.length) return els; els = await findElements.call(this, matcher, Locator.clickable.wide(literal)); if (els.length) return els; try { els = await findElements.call(this, matcher, Locator.clickable.self(literal)); if (els.length) return els; } catch (err) { // Do nothing } return findElements.call(this, matcher, locator.value); // by css or xpath }
async function findClickable(matcher, locator) { if (locator.react) return findReact(matcher, locator); locator = new Locator(locator); if (!locator.isFuzzy()) return findElements.call(this, matcher, locator); let els; const literal = xpathLocator.literal(locator.value); els = await findElements.call(this, matcher, Locator.clickable.narrow(literal)); if (els.length) return els; els = await findElements.call(this, matcher, Locator.clickable.wide(literal)); if (els.length) return els; try { els = await findElements.call(this, matcher, Locator.clickable.self(literal)); if (els.length) return els; } catch (err) { // Do nothing } return findElements.call(this, matcher, locator.value); // by css or xpath }
freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal ) { root = freeGlobal;
spawnStateless(system, async (msg, ctx) => { console.log(msg); // ping: Pong is a little slow. So I'm giving myself a little handicap :P await delay(500); dispatch(ctx.sender, ctx.name, ctx.self); }, 'ping')
spawn(system, async (state = {}, msg, ctx) => { console.log(msg); if (!state['counter']) { state['counter'] = 1; } console.log('counter ' + state['counter']); if (state['counter'] < 10) { await delay(500); dispatch(ctx.sender, ctx.name, ctx.self); return { ...state, 'counter': state['counter'] + 1 }; } }, 'ping')
function postMessage(action, data) { if (window.parent === window.self) { return; } window.parent.postMessage({ action, data, }, '*'); }
/** * Checks self and top to determine if we are being loaded in an iframe. * Can't use window.frameElement because we are being embedded from a different origin. * * @returns {boolean} Whether this script is loaded in a iframe. */ export function inIframe() { try { return window.self !== window.top; } catch ( e ) { return true; } }
async buildGraphQl () { const options = this.createContentTypeOptions() const { addContentType, addCollection = addContentType } = this.actions this.collection = addCollection(options) for (const item of this.response) { const fields = this.processFields(item.attributes) const relationships = this.processRelationships(item.relationships) const origin = typeof item.links.self === 'object' ? item.links.self.href : item.links.self this.collection.addNode({ title: fields.title || fields.name, date: fields.created || fields.changed, ...fields, ...relationships, id: item.id, internal: { origin } }) } }