How to use doEnrollment method in Appium Xcuitest Driver

Best JavaScript code snippet using appium-xcuitest-driver

gpindex_enroller.js

Source:gpindex_enroller.js Github

copy

Full Screen

...372 groupinfo.creator = msg.from.id;373 groupinfo.created_time = Date.now()374 delete session[msg.from.id];375 comlib.unsetLock(msg.from.id);376 var ret = await comlib.doEnrollment(groupinfo);377 if (ret == 'new_public_queue') {378 try {379 await bot.answerCallbackQuery({380 callback_query_id: msg.id,381 text: langres['dialogPubDone'],382 show_alert: true383 })384 return await bot.editMessageText(langres['infoPubDoneGCD'], {385 chat_id: msg.message.chat.id,386 message_id: msg.message.message_id387 })388 } catch (e) {389 errorProcess(msg.message, bot, e);390 }391 } else if (ret == 'new_private_queue') {392 try {393 await bot.answerCallbackQuery({394 callback_query_id: msg.id,395 text: langres['dialogPrivDone'],396 show_alert: true397 })398 return await bot.editMessageText(langres['infoPrivDoneGCD'], {399 chat_id: msg.message.chat.id,400 message_id: msg.message.message_id401 })402 } catch (e) {403 errorProcess(msg.message, bot, e);404 }405 }406 }407}408async function enrollerCancel(msg, bot) {409 delete session[msg.from.id];410 comlib.unsetLock(msg.from.id);411 return bot.editMessageText(langres['infoSessionCleared'], {412 chat_id: msg.message.chat.id,413 message_id: msg.message.message_id414 });415}416async function displayChannelManual(msg, bot) {417 bot.answerCallbackQuery({418 callback_query_id: msg.id,419 text: ''420 })421 return bot.sendMessage(msg.from.id, langres['infoHowToIndexChannel'])422}423async function processCallbackButton(msg, type, bot) {424 switch (msg.data) {425 case "enroller_confirm_enroll":426 return enrollerConfirmEnroll(msg, bot)427 case "enroller_cancel":428 return enrollerCancel(msg, bot)429 case 'enroller_usecurrentdesc':430 bot.answerCallbackQuery({431 callback_query_id: msg.id,432 text: ''433 })434 return processEnrollUseCurrentDesc(msg, bot)435 case 'enroller_manual_channel':436 return displayChannelManual(msg, bot)437 case 'enroller:enroll':438 return redirectToPrivateEnrollState(msg, bot)439 }440 // common with param441 const [operator, param] = msg.data.split(':')442 if (operator == 'upd') {443 let [category, gid] = param.split('&')444 gid = parseInt(gid)445 switch (category) {446 case 'common':447 case 'desc':448 case 'tag':449 case 'link':450 case 'ref':451 }452 }453}454// Resource Included455function generateUpdateDialog_MainPage(record) {456 let ret = {457 text: '',458 reply_markup: {}459 }460 switch (record.type) {461 case 'group':462 ret.text += '群组'463 break464 case 'supergroup':465 ret.text += '超级群组'466 break467 case 'channel':468 ret.text += '频道'469 break470 }471 ret.text += ` ${record.title}\n`472 ret.text += `类别:${record.is_public ? '公开' : '私有'}\n`473 if (record.is_public)474 ret.text += `标识:@${record.username}\n`475 else476 ret.text += `链接:${record.invite_link}\n`477 if (record.member_count)478 ret.text += `成员数:${record.member_count}\n`479 ret.text += `当前分类:#${record.tag}\n`480 ret.text += `当前简介:\n${record.desc}\n\n`481 if (record.extag && Object.keys(record.extag).length > 0) {482 ret.text += `当前启用特性:\n`483 for (let feat of Object.keys(record.extag)) {484 if (!feat.match(/^feature:/)) continue485 if (record.extag[feat]) {486 ret.text += `${feat}\n`487 }488 }489 }490 ret.text += `请选择操作:`491 let buttons = []492 if (record.is_public) {493 buttons.push([{494 text: '更新数据',495 callback_data: `upd:common&${record.id}`496 },497 {498 text: '变更分类',499 callback_data: `upd:tag&${record.id}`500 }501 ], [{502 text: '变更简介',503 callback_data: `upd:desc&${record.id}`504 },505 {506 text: '管理功能说明',507 url: 'https://wfjsw.gitbooks.io/tgcn-groupindex-reference/content/administration-functions.html'508 }509 ])510 } else {511 buttons.push([{512 text: '更新数据',513 callback_data: `upd:common&${record.id}`514 },515 {516 text: '变更分类',517 callback_data: `upd:tag&${record.id}`518 }519 ], [{520 text: '变更简介',521 callback_data: `upd:desc&${record.id}`522 },523 {524 text: '变更邀请链接',525 callback_data: `upd:link&${record.id}`526 }527 ], [{528 text: '管理功能说明',529 url: 'https://wfjsw.gitbooks.io/tgcn-groupindex-reference/content/administration-functions.html'530 }])531 }532 buttons.push([{533 text: '刷新',534 callback_data: `upd:ref&${record.id}`535 }])536 ret.reply_markup = {537 inline_keyboard: buttons538 }539 return ret540}541// End Resource Included542async function pushUpdateDialogPM(msg, result, bot) {543 try {544 const gid = parseInt(result[1])545 const uid = msg.from.id546 const record = await comlib.getRecord(gid)547 if (!record) return548 if (record.creator != uid) return549 let dialog = generateUpdateDialog_MainPage(record)550 return await bot.sendMessage(msg.chat.id, dialog.text, {551 reply_markup: dialog.reply_markup,552 disable_web_page_preview: true553 })554 } catch (e) {555 console.error(e.stack)556 return bot.sendMessage(msg.chat.id, '无法发送控制面板。')557 }558}559async function pushUpdateDialogGroup(msg, result, bot) {560 const gid = msg.chat.id561 const uid = msg.from.id562 const record = await comlib.getRecord(gid)563 if (!record) return564 if (record.creator != uid) return565 let dialog = generateUpdateDialog_MainPage(record)566 try {567 await bot.sendMessage(uid, dialog.text, {568 reply_markup: dialog.reply_markup,569 disable_web_page_preview: true570 })571 return await bot.sendMessage(gid, '控制面板已经私聊给你了。')572 } catch (e) {573 console.error(e.stack)574 return bot.sendMessage(gid, '无法发送控制面板。请检查您是否已将本机器人屏蔽。')575 }576}577async function updatePrivateLink(msg, result, bot) {578 if (msg.chat.id < 0) {579 var updatenotify = {580 id: msg.chat.id,581 invite_link: result[1],582 is_update: true583 }584 try {585 let record = await comlib.getRecord(msg.chat.id)586 if (record) {587 if (record.creator != msg.from.id) throw 'errorNotCreator'588 if (updatenotify.invite_link == record.invite_link) throw 'errorNoChanges'589 else if (!record.is_public && !msg.chat.username) {590 updatenotify.title = record.title591 return comlib.doEnrollment(updatenotify)592 } else if (!record.is_public && msg.chat.username) throw 'errorPrivToPub'593 else if (record.is_public && !msg.chat.username) {594 updatenotify.title = record.title595 updatenotify.is_public = false596 bot.sendMessage(msg.chat.id, langres['infoPubToPrivDone'])597 return comlib.doEnrollment(updatenotify)598 }599 } else {600 throw 'errorNotIndexed'601 }602 await bot.sendMessage(msg.chat.id, langres['infoPrivDone']);603 } catch (e) {604 var replymark = {605 reply_to_message_id: msg.message_id606 }607 if (e == 'errorNotCreator') return //bot.sendMessage(msg.chat.id, langres['errorNotCreator'], replymark);608 else if (e == 'errorNotIndexed') bot.sendMessage(msg.chat.id, langres['errorNotIndexed'], replymark);609 else if (e == 'errorNoChanges') bot.sendMessage(msg.chat.id, langres['errorNoChanges'], replymark);610 else if (e == 'errorPrivToPub') bot.sendMessage(msg.chat.id, langres['errorPrivToPub'], replymark);611 else errorProcess(msg, bot, e);612 } // To be continued613 } else {614 bot.sendMessage(msg.chat.id, langres['errorNotInGroup']);615 }616}617function updateInfo(msg, result, bot) {618 if (msg.chat.id < 0) {619 var old_stat;620 comlib.getRecord(msg.chat.id)621 .then(ret => {622 old_stat = ret;623 if (ret)624 if (ret.creator != msg.from.id) throw 'errorNotCreator';625 else return _e.bot.getChat(msg.chat.id);626 else throw 'errorNotIndexed';627 })628 .then(ret => {629 var updatenotify = {630 id: ret.id,631 title: ret.title,632 is_update: true633 };634 if (ret.username) {635 updatenotify.username = ret.username;636 updatenotify.is_public = true;637 if (old_stat.extag) {638 updatenotify.is_silent = old_stat.extag['silent'] || 0639 }640 } else if (old_stat.is_public == true) {641 throw 'errorPubToPriv'642 } else {643 updatenotify.is_public = false;644 }645 if (old_stat.title == updatenotify.title && old_stat.username == updatenotify.username && old_stat.is_public == updatenotify.is_public)646 throw 'errorNoChanges';647 else648 return comlib.doEnrollment(updatenotify);649 })650 .then(ret => {651 // Process Response652 if (ret == 'new_public_queue') {653 delete session[msg.from.id];654 bot.sendMessage(msg.chat.id, langres['infoPubDone']);655 } else if (ret == 'new_private_queue') {656 delete session[msg.from.id];657 bot.sendMessage(msg.chat.id, langres['infoPrivDone']);658 }659 }).catch((e) => {660 var replymark = {661 reply_to_message_id: msg.message_id662 }663 if (e == 'errorNotCreator') return // bot.sendMessage(msg.chat.id, langres['errorNotCreator'], replymark);664 else if (e == 'errorNotIndexed') bot.sendMessage(msg.chat.id, langres['errorNotIndexed'], replymark);665 else if (e == 'errorNoChanges') bot.sendMessage(msg.chat.id, langres['errorNoChanges'], replymark);666 else if (e == 'errorPubToPriv') bot.sendMessage(msg.chat.id, langres['errorPubToPriv'], replymark);667 else errorProcess(msg, bot, e);668 })669 } else {670 bot.sendMessage(msg.chat.id, langres['errorNotInGroup']);671 }672}673async function enrollmentOptOut(msg, result, bot) {674 if (msg.chat.id > 0) return bot.sendMessage(msg.chat.id, langres['errorNotInGroup'])675 if (session[msg.chat.id] == 'optout') {676 try {677 let record = await comlib.getRecord(msg.chat.id)678 if (!record) throw 'errorNotIndexed'679 if (record.creator != msg.from.id) throw 'errorNotCreator'680 await comlib.doRemoval(msg.chat.id)681 await bot.sendMessage(msg.chat.id, langres['infoRemoved'])682 comlib.event.emit('group_removal', msg.chat.id)683 delete session[msg.chat.id]684 } catch (e) {685 if (e == 'errorNotCreator') return // bot.sendMessage(msg.chat.id, langres['errorNotCreator'])686 else if (e == 'errorNotIndexed') bot.sendMessage(msg.chat.id, langres['errorNotIndexed'])687 else errorProcess(msg, bot, e)688 }689 } else {690 try {691 let record = await comlib.getRecord(msg.chat.id)692 if (record) {693 if (record.creator != msg.from.id) throw 'errorNotCreator'694 else {695 session[msg.chat.id] = 'optout'696 return await bot.sendMessage(msg.chat.id, langres['promptRemoveConfirm'])697 }698 } else throw 'errorNotIndexed'699 } catch (e) {700 if (e == 'errorNotCreator') return // bot.sendMessage(msg.chat.id, langres['errorNotCreator'])701 else if (e == 'errorNotIndexed') bot.sendMessage(msg.chat.id, langres['errorNotIndexed'])702 else errorProcess(msg, bot, e)703 }704 }705}706function processText(msg, type, bot) {707 var input = msg.text;708 if (msg.chat.id < 0) return709 if (msg.text.match(/^\/cancel/)) return710 try {711 if (session[msg.from.id]) {712 if (session[msg.from.id].status == 'waitfortag' && tags.indexOf(input) > -1) {713 var newinfo = session[msg.from.id].argu;714 newinfo['tag'] = input;715 processEnrollWaitDescription(msg.from.id, newinfo, msg, bot);716 } else if (session[msg.from.id].status == 'waitfortag' && tags.indexOf(input) == -1) {717 bot.sendMessage(msg.chat.id, util.format(langres['errorInvalidTag'], tags.join('\n')));718 } else if (session[msg.from.id].status == 'waitfordesc') {719 var newinfo = session[msg.from.id].argu;720 newinfo['desc'] = input;721 if (newinfo.username) processEnrollPublic(msg.from.id, newinfo, msg, bot); // is public group722 else processEnrollPrivateWaitLink(msg.from.id, newinfo, msg, bot); // is private group723 }724 } else if (msg.forward_from_chat) {725 return checkChannelEnrollCondition(msg, bot)726 }727 } catch (e) {728 errorProcess(msg, bot, e);729 }730}731function updateTag(msg, result, bot) {732 if (msg.chat.id < 0) {733 var old_stat;734 var tag = result[1];735 if (tags.indexOf(tag) > -1) {736 comlib.getRecord(msg.chat.id)737 .then(ret => {738 if (ret)739 if (ret.creator != msg.from.id) throw 'errorNotCreator';740 else {741 old_stat = ret742 return _e.bot.getChat(msg.chat.id)743 }744 else throw 'errorNotIndexed';745 })746 .then(ret => {747 var updatenotify = {748 id: ret.id,749 tag: tag,750 is_update: true751 };752 if (ret.username) {753 updatenotify.username = ret.username;754 updatenotify.is_public = true;755 } else {756 updatenotify.is_public = false;757 }758 if (old_stat.tag == updatenotify.tag && old_stat.is_public == updatenotify.is_public)759 throw 'errorNoChanges';760 else761 return comlib.doEnrollment(updatenotify);762 })763 .then(ret => {764 // Process Response765 if (ret == 'new_public_queue') {766 delete session[msg.from.id];767 bot.sendMessage(msg.chat.id, langres['infoPubDone']);768 } else if (ret == 'new_private_queue') {769 delete session[msg.from.id];770 bot.sendMessage(msg.chat.id, langres['infoPrivDone']);771 }772 }).catch((e) => {773 if (e == 'errorNotCreator') return //bot.sendMessage(msg.chat.id, langres['errorNotCreator']);774 else if (e == 'errorNotIndexed') bot.sendMessage(msg.chat.id, langres['errorNotIndexed']);775 else if (e == 'errorNoChanges') bot.sendMessage(msg.chat.id, langres['errorNoChanges']);776 else errorProcess(msg, bot, e);777 })778 } else {779 bot.sendMessage(msg.chat.id, util.format(langres['errorInvalidTag'], tags.join('\n')));780 }781 } else {782 bot.sendMessage(msg.chat.id, langres['errorNotInGroup']);783 }784}785function updateDesc(msg, result, bot) {786 if (msg.chat.id < 0) {787 var old_stat;788 var desc = result[1];789 comlib.getRecord(msg.chat.id)790 .then(ret => {791 old_stat = ret;792 if (ret)793 if (ret.creator != msg.from.id) throw 'errorNotCreator';794 else return _e.bot.getChat(msg.chat.id);795 else throw 'errorNotIndexed';796 })797 .then(ret => {798 var updatenotify = {799 id: ret.id,800 desc: desc,801 is_update: true802 };803 if (ret.username) {804 updatenotify.username = ret.username;805 updatenotify.is_public = true;806 } else {807 updatenotify.is_public = false;808 }809 if (old_stat.tag == updatenotify.tag && old_stat.is_public == updatenotify.is_public)810 throw 'errorNoChanges';811 else812 return comlib.doEnrollment(updatenotify);813 })814 .then(ret => {815 // Process Response816 if (ret == 'new_public_queue') {817 delete session[msg.from.id];818 bot.sendMessage(msg.chat.id, langres['infoPubDone']);819 } else if (ret == 'new_private_queue') {820 delete session[msg.from.id];821 bot.sendMessage(msg.chat.id, langres['infoPrivDone']);822 }823 }).catch((e) => {824 if (e == 'errorNotCreator') return //bot.sendMessage(msg.chat.id, langres['errorNotCreator']);825 else if (e == 'errorNotIndexed') bot.sendMessage(msg.chat.id, langres['errorNotIndexed']);826 else if (e == 'errorNoChanges') bot.sendMessage(msg.chat.id, langres['errorNoChanges']);...

Full Screen

Full Screen

threeds.js

Source:threeds.js Github

copy

Full Screen

...151 console.log('Merchant received a message:', data);152 if (data !== undefined && data.Status) {153 console.log('Songbird ran DF successfully');154 // Initiate enrollment process155 doEnrollment();156 } else {157 console.log('Message from different type.');158 }159 } else {160 console.log('Message from different origin.');161 }162 }, false);163}164function createChallengeValidatedEventLiestener() {165 console.log('createChallengeValidatedEvent:');166 var challengeIframe = document.getElementById("step-up-iframe");167 challengeIframe.addEventListener("click", function (event) {168 console.log('Event:');169 console.log(event);170 }, false);171}172function doEnrollment() {173 console.log("doEnrollment.");174 175 var authenticationData = JSON.stringify(getAuthenticationData());176 177 console.log("Data sent to erollment:");178 console.log(authenticationData);179 var settings = {180 "async": false,181 "crossDomain": true,182 "url": "http://localhost:5000/doEnrollment",183 "method": "POST",184 "headers": {185 "Content-Type": "application/json",186 "Accept": "*/*",...

Full Screen

Full Screen

enroll_lib.test.js

Source:enroll_lib.test.js Github

copy

Full Screen

...246 expectBlock: (done) => {247 const enroll_request = JSON.parse(JSON.stringify(ca_objects.enroll_request));248 enroll_request.profile = 'profile';249 enroll_request.attr_reqs = [];250 enroll_lib.doEnrollment(enroll_request, ca_objects.csr, (err, resp) => {251 expect(err).to.equal(null);252 expect(JSON.stringify(resp)).to.equal(JSON.stringify(ca_objects.enroll_response));253 done();254 });255 }256 },257 {258 itStatement: 'should return the expected enroll response - valid request passed - body is an object test_id=spqfhr',259 callFunction: () => {260 tools.stubs.doEnrollment.restore();261 tools.stubs.request.callsArgWith(1, null, ca_objects.do_enrollment_response_body_is_object);262 },263 expectBlock: (done) => {264 enroll_lib.doEnrollment(ca_objects.enroll_request, ca_objects.csr, (err, resp) => {265 expect(err).to.equal(null);266 expect(JSON.stringify(resp)).to.equal(JSON.stringify(ca_objects.enroll_response_body_is_object));267 done();268 });269 }270 },271 {272 itStatement: 'should return an error - error code passed into request stub test_id=pldgdy',273 callFunction: () => {274 const response = JSON.parse(JSON.stringify(ca_objects.do_enrollment_response));275 response.statusCode = 500;276 tools.stubs.doEnrollment.restore();277 tools.stubs.request.callsArgWith(1, null, response);278 },279 expectBlock: (done) => {280 const enroll_request = JSON.parse(JSON.stringify(ca_objects.enroll_request));281 enroll_request.profile = 'profile';282 enroll_request.attr_reqs = [];283 enroll_lib.doEnrollment(enroll_request, ca_objects.csr, (err) => {284 expect(err.statusCode).to.equal(500);285 expect(JSON.stringify(JSON.parse(err.msg))).to.equal(JSON.stringify(ca_objects.enrollment_results));286 done();287 });288 }289 },290 {291 itStatement: 'should return an error - Buffer.from cannot parse the cert passed in test_id=ijsbvf',292 callFunction: () => {293 const response = JSON.parse(JSON.stringify(ca_objects.do_enrollment_response));294 const body = JSON.parse(response.body);295 body.result.Cert = 1;296 response.body = JSON.stringify(body);297 tools.stubs.doEnrollment.restore();298 tools.stubs.request.callsArgWith(1, null, response);299 },300 expectBlock: (done) => {301 const enroll_request = JSON.parse(JSON.stringify(ca_objects.enroll_request));302 enroll_request.profile = 'profile';303 enroll_request.attr_reqs = [];304 enroll_lib.doEnrollment(enroll_request, ca_objects.csr, (err) => {305 expect(err.statusCode).to.equal(500);306 expect(err.msg).to.equal(ca_objects.enrollment_result2);307 done();308 });309 }310 },311 {312 itStatement: 'should return an error - Buffer.from cannot parse the ServerInfo.CAChain passed in test_id=vbwbqo',313 callFunction: () => {314 const response = JSON.parse(JSON.stringify(ca_objects.do_enrollment_response));315 const body = JSON.parse(response.body);316 body.result.ServerInfo.CAChain = 1;317 response.body = JSON.stringify(body);318 tools.stubs.doEnrollment.restore();319 tools.stubs.request.callsArgWith(1, null, response);320 },321 expectBlock: (done) => {322 const enroll_request = JSON.parse(JSON.stringify(ca_objects.enroll_request));323 enroll_request.profile = 'profile';324 enroll_request.attr_reqs = [];325 enroll_lib.doEnrollment(enroll_request, ca_objects.csr, (err) => {326 expect(err.statusCode).to.equal(500);327 expect(err.msg).to.equal(ca_objects.enrollment_result3);328 done();329 });330 }331 },332 {333 itStatement: 'should return an error - passed error through the request stub test_id=vohrpz',334 callFunction: () => {335 const err = {};336 err.statusCode = 500;337 err.msg = 'problem enrolling identity';338 tools.stubs.doEnrollment.restore();339 tools.stubs.request.callsArgWith(1, err);340 },341 expectBlock: (done) => {342 enroll_lib.doEnrollment(ca_objects.enroll_request, ca_objects.csr, (err, resp) => {343 expect(err.statusCode).to.equal(500);344 expect(err.msg).to.equal('could not make request to enroll');345 expect(resp).to.equal(undefined);346 done();347 });348 }349 },350 {351 itStatement: 'should return an error - no body in request passed to the request stub test_id=sihaxm',352 callFunction: () => {353 const do_enrollment = JSON.parse(JSON.stringify(ca_objects.do_enrollment_response));354 delete do_enrollment.body;355 tools.stubs.doEnrollment.restore();356 tools.stubs.request.callsArgWith(1, null, do_enrollment);357 },358 expectBlock: (done) => {359 enroll_lib.doEnrollment(ca_objects.enroll_request, ca_objects.csr, (err, resp) => {360 expect(err.statusCode).to.equal(500);361 expect(err.msg).to.equal('problem enrolling identity, missing response');362 expect(resp).to.equal(undefined);363 done();364 });365 }366 }367 ]368 }369 ]370 }371 ];372 // call main test function to run this test collection373 common.mainTestFunction(testCollection, path_to_current_file);...

Full Screen

Full Screen

gpindex_common.js

Source:gpindex_common.js Github

copy

Full Screen

...194 }195 let results = await (await req.run(db_conn)).toArray()196 return results197}198async function doEnrollment(groupinfo) {199 if (groupinfo.is_public) {200 queue.public.push(groupinfo);201 event.emit('new_public_queue', groupinfo);202 return 'new_public_queue';203 } else {204 if (groupinfo.is_update) queue.private_update[groupinfo.id] = groupinfo;205 else queue.private[groupinfo.id] = groupinfo;206 event.emit('new_private_queue', groupinfo);207 return 'new_private_queue';208 }209}210async function doRemoval(group) {211 try {212 var gid = parseInt(group)...

Full Screen

Full Screen

enroll_lib.js

Source:enroll_lib.js Github

copy

Full Screen

...79 if (csr && csr.statusCode && csr.statusCode === 500) {80 return cb(csr);81 }82 // actually do the enrollment83 exports.doEnrollment(req, csr, (err_enroll, resp_enroll) => {84 if (err_enroll) {85 return cb(err_enroll);86 }87 // return the enrollment object88 return cb(null, {89 pvtkey: { _key: privateKey },90 public_key: { _key: publicKey },91 pubKey: { _key: publicKey },92 certificate: resp_enroll.enrollmentCert93 });94 });95 });96 }97 };...

Full Screen

Full Screen

touch-id-e2e-specs.js

Source:touch-id-e2e-specs.js Github

copy

Full Screen

...38 driver = await initSession(TOUCHIDAPP_CAPS);39 await B.delay(2000); // Give the app a couple seconds to open40 });41 it('should not support touchID if not enrolled', async function () {42 if (await doEnrollment(false)) {43 let authenticateButton = await driver.elementByName(' Authenticate with Touch ID');44 await authenticateButton.click();45 await driver.elementByName('TouchID not supported').should.eventually.exist;46 }47 });48 it('should accept matching fingerprint if touchID is enrolled or it should not be supported if phone does not support touchID', async function () {49 if (await doEnrollment()) {50 let authenticateButton = await driver.elementByName(' Authenticate with Touch ID');51 await authenticateButton.click();52 await driver.touchId(true);53 try {54 await driver.elementByName('Authenticated Successfully').should.eventually.exist;55 } catch (ign) {56 await driver.elementByName('TouchID not supported').should.eventually.exist;57 }58 }59 });60 it('should reject not matching fingerprint if touchID is enrolled or it should not be supported if phone does not support touchID', async function () {61 if (await doEnrollment()) {62 let authenticateButton = await driver.elementByName(' Authenticate with Touch ID');63 await authenticateButton.click();64 await driver.touchId(false);65 try {66 await driver.elementByName('Try Again').should.eventually.exist;67 } catch (ign) {68 await driver.elementByName('TouchID not supported').should.eventually.exist;69 }70 }71 });72 it('should enroll touchID and accept matching fingerprints then unenroll touchID and not be supported', async function () {73 //Unenroll74 if (!await doEnrollment(false)) {75 return;76 }77 let authenticateButton = await driver.elementByName(' Authenticate with Touch ID');78 await authenticateButton.click();79 await driver.elementByName('TouchID not supported').should.eventually.exist;80 let okButton = await driver.elementByName('OK');81 await okButton.click();82 await B.delay(1000);83 // Re-enroll84 await doEnrollment();85 await authenticateButton.click();86 await driver.touchId(true);87 try {88 await driver.elementByName('Authenticated Successfully').should.eventually.exist;89 } catch (ign) {90 return await driver.elementByName('TouchID not supported').should.eventually.exist;91 }92 okButton = await driver.elementByName('OK');93 await okButton.click();94 await B.delay(1000);95 // Unenroll again96 await doEnrollment(false);97 authenticateButton = await driver.elementByName(' Authenticate with Touch ID');98 await authenticateButton.click();99 await driver.elementByName('TouchID not supported').should.eventually.exist;100 });101 });102 });...

Full Screen

Full Screen

invitation.js

Source:invitation.js Github

copy

Full Screen

1/**2 * Eliademy.com3 *4 * @copyright CBTec Oy5 * @license All rights reserved6 */ 7define(["app/tools/servicecalls", "backbone"],8 function (SC)9{10 return Backbone.Model.extend(11 {12 sync: function (method, model, options)13 {14 if (method == "read") {15 16 $.ajax({ url: MoodleDir + "theme/monorail/ext/ajax_check_invite.php", data: {code: model.id}, dataType: "json", success: function (data)17 {18 19 model.set("userid", parseInt(data.userid));20 model.set("active", parseInt(data.active));21 model.set("found", true);22 model.set({courseId: parseInt(data.courseid), courseCode: data.coursecode});23 model.view.updateText();24 },25 error: function (data)26 {27 28 model.set("userid", 0);29 model.set("active", 0);30 model.set("found", false);31 model.set("courseId", 0);32 model.view.updateText();33 }});34 }35 return this;36 },37 doEnrollment: function(model) {38 39 params = [{40 rolename: 'student',41 inviteid: model.get("id"),42 courseid: model.get("courseId"),43 userid: model.get("userid")44 }];45 46 thisThis = this;47 48 SC.call("local_monorailservices_enrol_users", { enrolments: params },49 function (data)50 {51 require(["app/models/user"], function (UserModel) {52 // add course to user enrolled courses list53 var enrolledcourseslist = UserModel.get("enrolledcourseslist");54 enrolledcourseslist.push(model.get("courseId"));55 UserModel.set('enrolledcourseslist', enrolledcourseslist);56 window.location = RootDir + "courses/" + model.get("courseCode");57 });58 59 }, this,60 function (data)61 {62 // error63 model.set('found', false);64 model.view.updateText();65 }66 );67 },68 defaults: function ()69 {70 return {71 id: null,72 userid: null,73 active: null,74 found: false,75 courseId: null,76 courseCode: ""77 };78 }79 });...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

...32 targets.forEach((target) => {33 const userId = target.getAttribute('data-user-id');34 const courseId = target.getAttribute('data-course-id');35 target.addEventListener('click', ()=> {36 doEnrollment(userId, courseId);37 });38 });39});...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const webdriverio = require('webdriverio');2const opts = {3 desiredCapabilities: {4 }5};6async function main() {7 const client = await webdriverio.remote(opts);8 .init()9 .doEnrollment({10 });11 await client.end();12}13main();14commands.doEnrollment = async function (opts = {}) {15 const { enrollUser, enrollPassword, lockDevice, lockPassword } = opts;16 if (enrollUser) {17 await this.setBiometricEnrollment(true);18 }19 if (lockDevice) {20 await this.lock(lockPassword);21 }22 if (enrollPassword) {23 await this.setAuthenticationPassword(enrollPassword);24 }25};26commands.setBiometricEnrollment = async function (enroll) {27 await this.execute('mobile: enrollBiometric', { enroll });28};29commands.lock = async function (password) {30 const cmd = `mobile: lock`;31 const args = [{ password }];32 await this.execute(cmd, args);33};34commands.setAuthenticationPassword = async function (password) {35 const cmd = `mobile: setAuthenticationPassword`;36 const args = [{ password }];37 await this.execute(cmd, args);38};39commands.execute = async function (cmd, args = []) {40 const endpoint = '/wda/execute';41 const data = { script: cmd, args };42 return await this.proxyCommand(endpoint, 'POST', data);43};44commands.proxyCommand = async function (url, method, body = null) {45 return await this.proxyCommandTo(url, method, body, this.sessionId);46};

Full Screen

Using AI Code Generation

copy

Full Screen

1const { XCUITestDriver } = require('appium-xcuitest-driver');2const { doEnrollment } = require('appium-xcuitest-driver/lib/commands/recordscreen');3const { getDriver } = require('appium-xcuitest-driver/lib/driver');4const driver = getDriver();5const xDriver = new XCUITestDriver();6const opts = {7};8xDriver.createSession(opts);9doEnrollment(xDriver, { enroll: true });10xDriver.deleteSession();11async function doEnrollment (driver, opts = {}) {12 const { enroll } = opts;13 const { udid } = driver.opts;14 const proc = await simctl.enrollSimDevice(udid, enroll);15 await proc;16}17async function enrollSimDevice (udid, enroll = true) {18 const args = ['simctl', 'io', udid, (enroll ? 'enroll' : 'unenroll')];19 return await exec(args);20}21async function exec (cmd, opts = {}) {22 const { stdout, stderr } = await execSubProcess(cmd, opts);23 return stdout;24}

Full Screen

Using AI Code Generation

copy

Full Screen

1var desired = {2};3var driver = wd.promiseChainRemote('localhost', 4723);4 .init(desired)5 .then(function () {6 return driver.execute('mobile: doEnrollment', {enrollmentId: 'myEnrollmentId'});7 })8 .then(function () {9 })10 .fin(function () { return driver.quit(); })11 .done();

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var xcode = require('appium-xcode');3var xcodeVersion = xcode.getVersion(true);4var xcodeBuildVersion = xcode.getBuildVersion(true);5var caps = {6};7var driver = wd.promiseChainRemote('localhost', 4723);8 .init(caps)9 .then(function () {10 return driver.setImplicitWaitTimeout(5000);11 })12 .then(function () {13 return driver.execute('mobile: doEnrollment', {enroll: true});14 })15 .then(function () {16 return driver.quit();17 })18 .catch(function (err) {19 console.log(err);20 });21const exec = require('teen_process').exec;22const log = require('./logger').getLogger('Xcode');23const B = require('bluebird');24const _ = require('lodash');25const path = require('path');26const plist = require('plist');27const fs = require('fs');28const xcodeDir = path.resolve('/Applications', 'Xcode.app');29const xcodebuildPath = path.resolve(xcodeDir, 'Contents', 'Developer', 'usr', 'bin', 'xcodebuild');30const xcodeSelectPath = path.resolve('/usr', 'bin', 'xcode-select');31const DEFAULT_TIMEOUT = 10000;32const xcodeVersionRegex = /Xcode (\d+\.\d+)/;33const xcodeBuildVersionRegex = /Build version (\d+\.\d+)/;34async function getVersion (useCache = true) {35 if (!useCache || !this.version) {36 this.version = await getVersionWithoutCache();37 }

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Appium Xcuitest Driver automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Sign up Free
_

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful