Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return Role(resolveUrl('/signin'), async() => {
await t.eval(() => window.localStorage.clear());
// Disable "Getting started" modal.
await t.eval(() => window.localStorage.showGettingStarted = 'false');
await page.login(login, password);
});
};
const startAppTestCafe = async (path, typeDefs, resolvers) => {
const stringifiedResolvers = stringify(resolvers)
await t.eval(() => {
if (window.__APOLLO_CLIENT__) {
const parsedResolvers = window.__APOLLO_TEST_TOOLS.parse(stringifiedResolvers)
const schema = window.__APOLLO_TEST_TOOLS.makeExecutableSchema({typeDefs, resolvers: parsedResolvers, resolverValidationOptions: {allowResolversNotInSchema: true}})
window.__APOLLO_TEST_TOOLS.addMockFunctionsToSchema({schema, preserveResolvers: true})
const newNetworkInterface = window.__APOLLO_TEST_TOOLS.mockNetworkInterfaceWithSchema({schema})
Object.assign(window.__APOLLO_CLIENT__.networkInterface, newNetworkInterface)
}
}, {
dependencies: {stringifiedResolvers, typeDefs}
})
return new TestCafeDriver()
}
async scroll_to_element(el, text, time = 1) {
await this.wait_for_ajax();
time = time * 1000;
let selector = `${el}:visible`
if (text) {
selector += `:contains("${text}")`;
}
const value = await t.eval(() => {
const el = $(selector);
if(el.length === 0) {
throw `Could not find element matching ${selector}`
}
return el.offset().top - 150;
}, { dependencies: { selector } });
await this._scroll(value, time);
},