Best JavaScript code snippet using cypress
reportico.js
Source: reportico.js
...535 params += "&execute_mode=EXECUTE";536 params += "&" + reportico_jquery(this).prop("name") + "=1";537538 forms = reportico_jquery(this).closest('.swMntForm,.swPrpForm,form');539 if ( jQuery.type(reportico_ajax_script) === 'undefined' || !reportico_ajax_script )540 {541 var ajaxaction = reportico_jquery(forms).prop("action");542 }543 else544 {545 ajaxaction = reportico_ajax_script;546 }547548 var csvpdfoutput = false;549 var htmloutput = false;550551 reportico_report_title = reportico_jquery(this).closest('#reportico_container').find('.swTitle').html();552553 if ( !reportico_jquery(this).hasClass("swPrintBox") )
...
skin.js
Source: skin.js
1/*global module, QoobStorage, QoobController, PageModel, QoobLayout*/2/**3 * Initialize page qoob4 *5 * @version 0.0.16 * @class Qoob7 * @param {Object} options [current page id and {Object} data]8 */9//module.exports.Qoob = Qoob;10function Skin() {11 this.assets = {12 "dev": [13 { "type": "js", "name": "jquery-ui", "src": "js/libs/jquery-ui.js", "min_src": "js/libs/jquery-ui.min.js", "dep": ["jquery"] },14 { "type": "js", "name": "jquery-ui-touch-punch", "src": "js/libs/jquery.ui.touch-punch.js", "min_src": "js/libs/jquery.ui.touch-punch.min.js", "dep": ["jquery-ui"] },15 { "type": "js", "name": "jquery-ui-droppable-iframe", "src": "js/libs/jquery-ui-droppable-iframe.js", "min_src": "js/libs/jquery-ui-droppable-iframe.min.js", "dep": ["jquery-ui"] },16 { "type": "js", "name": "hammer", "src": "js/libs/hammer.js", "min_src": "js/libs/hammer.min.js", "dep": ["jquery"] },17 { "type": "js", "name": "qoob-select", "src": "js/libs/qoob-select.js", "dep": ["jquery"] },18 { "type": "js", "name": "qoob-dropdown", "src": "js/libs/qoob-dropdown.js", "dep": ["jquery"] },19 { "type": "js", "name": "current-device", "src": "js/libs/current-device.js", "min_src": "js/libs/current-device.min.js", "dep": ["jquery"] },20 { "type": "js", "name": "html2canvas", "src": "js/libs/html2canvas.js", "min_src": "js/libs/html2canvas.min.js", "dep": ["jquery"] },21 { "type": "js", "name": "jquery.easing", "src": "js/libs/jquery.easing.js", "min_src": "js/libs/jquery.easing.min.js", "dep": ["jquery"] },22 { "type": "js", "name": "date-time-picker", "src": "js/libs/date-time-picker.js", "min_src": "js/libs/date-time-picker.min.js", "dep": ["jquery"] },23 { "type": "js", "name": "qoob-controller", "src": "js/controllers/qoob-controller.js", "dep": ["backbone"] },24 { "type": "js", "name": "block-model", "src": "js/models/block-model.js", "dep": ["backbone"] },25 { "type": "js", "name": "page-model", "src": "js/models/page-model.js", "dep": ["backbone"] },26 { "type": "js", "name": "qoob-block-view", "src": "js/views/qoob-block-view.js", "dep": ["backbone"] },27 { "type": "js", "name": "qoob-block-wrapper-view", "src": "js/views/qoob-block-wrapper-view.js", "dep": ["backbone"] },28 { "type": "js", "name": "qoob-edit-mode-button-view", "src": "js/views/qoob-edit-mode-button-view.js", "dep": ["backbone"] },29 { "type": "js", "name": "qoob-field-view", "src": "js/views/qoob-field-view.js", "dep": ["backbone"] },30 { "type": "js", "name": "qoob-fields-view", "src": "js/views/qoob-fields-view.js", "dep": ["backbone"] },31 { "type": "js", "name": "qoob-layout", "src": "js/views/qoob-layout.js", "dep": ["backbone"] },32 { "type": "js", "name": "qoob-sidebar-view", "src": "js/views/qoob-sidebar-view.js", "dep": ["backbone"] },33 { "type": "js", "name": "qoob-menu-view", "src": "js/views/qoob-menu-view.js", "dep": ["backbone"] },34 { "type": "js", "name": "qoob-toolbar-view", "src": "js/views/qoob-toolbar-view.js", "dep": ["backbone"] },35 { "type": "js", "name": "qoob-viewport-view", "src": "js/views/qoob-viewport-view.js", "dep": ["backbone"] },36 { "type": "js", "name": "qoob-menu-blocks-preview-view", "src": "js/views/qoob-menu-blocks-preview-view.js", "dep": ["backbone"] },37 { "type": "js", "name": "qoob-menu-groups-view", "src": "js/views/qoob-menu-groups-view.js", "dep": ["backbone"] },38 { "type": "js", "name": "qoob-menu-save-page-view", "src": "js/views/qoob-menu-save-page-template-view.js", "dep": ["backbone"] },39 { "type": "js", "name": "qoob-settings-view", "src": "js/views/qoob-settings-view.js", "dep": ["qoob-fields-view"] },40 { "type": "js", "name": "qoob-import-export-view", "src": "js/views/qoob-import-export-view.js", "dep": ["backbone"] },41 { "type": "js", "name": "qoob-page-templates-view", "src": "js/views/qoob-page-templates-view.js", "dep": ["backbone"] },42 { "type": "js", "name": "field-accordion", "src": "js/views/fields/field-accordion.js", "dep": ["backbone"] },43 { "type": "js", "name": "field-accordion-item", "src": "js/views/fields/field-accordion-item.js", "dep": ["backbone"] },44 { "type": "js", "name": "field-accordion-item-settings", "src": "js/views/fields/field-accordion-item-settings.js", "dep": ["backbone"] },45 { "type": "js", "name": "field-accordion-flip", "src": "js/views/fields/field-accordion-flip.js", "dep": ["backbone"] },46 { "type": "js", "name": "field-accordion-item-flip", "src": "js/views/fields/field-accordion-flip-item.js", "dep": ["backbone"] },47 { "type": "js", "name": "field-accordion-item-flip-settings", "src": "js/views/fields/field-accordion-flip-item-settings.js", "dep": ["backbone"] },48 { "type": "js", "name": "field-checkbox-switch", "src": "js/views/fields/field-checkbox-switch.js", "dep": ["backbone"] },49 { "type": "js", "name": "field-checkbox", "src": "js/views/fields/field-checkbox.js", "dep": ["backbone"] },50 { "type": "js", "name": "field-colorpicker", "src": "js/views/fields/field-colorpicker.js", "dep": ["backbone"] },51 { "type": "js", "name": "field-icon", "src": "js/views/fields/field-icon.js", "dep": ["backbone"] },52 { "type": "js", "name": "field-image", "src": "js/views/fields/field-image.js", "dep": ["backbone"] },53 { "type": "js", "name": "field-select", "src": "js/views/fields/field-select.js", "dep": ["backbone"] },54 { "type": "js", "name": "field-radio", "src": "js/views/fields/field-radio.js", "dep": ["backbone"] },55 { "type": "js", "name": "field-slider", "src": "js/views/fields/field-slider.js", "dep": ["backbone"] },56 { "type": "js", "name": "field-text-autocomplete", "src": "js/views/fields/field-text-autocomplete.js", "dep": ["backbone"] },57 { "type": "js", "name": "field-text", "src": "js/views/fields/field-text.js", "dep": ["backbone"] },58 { "type": "js", "name": "field-textarea", "src": "js/views/fields/field-textarea.js", "dep": ["backbone"] },59 { "type": "js", "name": "field-video", "src": "js/views/fields/field-video.js", "dep": ["backbone"] },60 { "type": "js", "name": "field-datepicker", "src": "js/views/fields/field-datepicker.js", "dep": ["backbone"] },61 { "type": "js", "name": "icon-center-view", "src": "js/views/fields/icon-center-view.js", "dep": ["backbone"] },62 { "type": "js", "name": "image-center-view", "src": "js/views/fields/image-center-view.js", "dep": ["backbone"] },63 { "type": "js", "name": "video-center-view", "src": "js/views/fields/video-center-view.js", "dep": ["backbone"] },64 { "type": "js", "name": "template-adapter-handlebars", "src": "js/extensions/template-adapter-handlebars.js", "dep": ["backbone"] },65 { "type": "js", "name": "template-adapter-underscore", "src": "js/extensions/template-adapter-underscore.js", "dep": ["backbone"] },66 { "type": "js", "name": "qoob-storage", "src": "js/qoob-storage.js", "dep": ["backbone"] },67 { "type": "js", "name": "qoob-utils", "src": "js/qoob-utils.js", "dep": ["backbone"] },68 { "type": "js", "name": "quill", "src": "js/libs/quill/quill.js", "min_src": "js/libs/quill/quill.min.js", "dep": ["jquery"] },69 { "type": "css", "name": "quill.sno.css", "src": "js/libs/quill/quill.snow.css" },70 { "type": "css", "name": "font-awesome.css", "src": "css/font-awesome.css" },71 { "type": "css", "name": "glyphicons.css", "src": "css/glyphicons.css" },72 { "type": "css", "name": "qoob.css", "src": "css/qoob-backend.css", "dep": ["jquery-ui.css"] }73 ],74 "prod": [75 { "type": "css", "name": "font-awesome.min.css", "src": "css/font-awesome.min.css" },76 { "type": "css", "name": "glyphicons.min.css", "src": "css/glyphicons.min.css" },77 { "type": "css", "name": "qoob.min.css", "src": "css/qoob-backend.min.css", "dep": ["jquery-ui.css"] },78 { "type": "js", "name": "skin_assets", "src": "skin.concated.js" }79 ],80 "all": [81 { "type": "css", "name": "jquery-ui.css", "src": "css/jquery-ui.css" },82 { "type": "css", "name": "quill.sno.css", "src": "js/libs/quill/quill.snow.css" },83 { "type": "json", "name": "skin_templates", "src": "tmpl/templates.json" }84 ]85 };86}87/**88 * Activate page qoob89 */90Skin.prototype.activate = function(options) {91 var self = this;92 this.options = {93 blockTemplateAdapter: 'hbs',94 blockPreviewUrl: "preview.png",95 skinUrl: options.skinUrl96 };97 _.extend(this.options, options);98 this.loader = this.options.loader;99 this.storage = new QoobStorage(this.options);100 this.controller = new QoobController();101 this.pageModel = new PageModel();102 this.layout = new QoobLayout({103 "model": this.pageModel,104 "storage": this.storage,105 "controller": this.controller106 });107 this.controller.setLayout(this.layout);108 this.controller.setPageModel(this.pageModel);109 this.controller.setStorage(this.storage);110 //Creating and appending qoob layout111 jQuery(window).resize(function() {112 self.layout.resize();113 });114 //Blocks loaded to viewPort115 self.layout.viewPort.once('blocks_loaded', function() {116 self.loader.trigger('skin_loaded');117 Backbone.history.start({ pushState: false });118 });119 //If iframe ready to load blocks. All libraries css and js have already loaded to iframe120 self.layout.viewPort.once('iframe_loaded', function() {121 var iframe = self.layout.viewPort.getWindowIframe();122 //css is loaded to iframe123 iframe.loader.once('loaded', function() {124 // self.layout.viewPort.getWindowIframe().onbeforeunload = function() {125 // return false;126 // };127 // load default templates128 self.layout.viewPort.createBlankPage();129 //Start loading blocks130 self.controller.load(self.storage.pageData.blocks);131 });132 //add css styles for overlay and drop zone133 iframe.loader.add({ "name": "frontend-qoob-css", "src": self.options.skinUrl + "css/qoob-frontend.css", "type": "css" })134 return;135 });136 //Render layout137 jQuery('body').prepend(self.layout.render().el);138 this.layout.resize();139};140if (typeof(module) != 'undefined' && module.exports) {141 module.exports = Skin;...
jquery.automateaction.js
Source: jquery.automateaction.js
1/**2 * This file is part of WorkESB.3 *4 * WorkESB is free software: you can redistribute it and/or modify5 * it under the terms of the GNU Lesser General Public License as published by6 * the Free Software Foundation, either version 3 of the License, or7 * (at your option) any later version.8 *9 * WorkESB is distributed in the hope that it will be useful,10 * but WITHOUT ANY WARRANTY; without even the implied warranty of11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12 * GNU Lesser General Public License for more details.13 *14 * You should have received a copy of the GNU Lesser General Public License15 * along with WorkESB. If not, see <http://www.gnu.org/licenses/>.16 *17 * Created on: 31 janv. 201218 * Author: Marc Buils (MATIS - http://www.matis-group.com)19 */20;(function($){21var _lastStatus = null;22var _lastDialog = null;23var _notificationTitle = "Information sur l'automate";24var _currentGritterId = -1;25var __AUTOMATE_STATUS__ = "AUTOMATE_STATUS";26var __AUTOMATE_DIALOG__ = "AUTOMATE_DIALOG";27var __AUTOMATE_DIALOG_RETURN__ = "AUTOMATE_DIALOG_RETURN";28$.wesbmessenger.singleton().consumSampling( __AUTOMATE_STATUS__, "string" );29$.wesbmessenger.singleton().consumSampling( __AUTOMATE_DIALOG__, "string" );30$.wesbmessenger.singleton().update( function(){31 var _status = $.wesbmessenger.consumer[__AUTOMATE_STATUS__];32 33 if ( _lastStatus != _status && $('[data-jquery-type="automateaction"][data-waiting]').size() <= 0 ){34 if (_status == "stopped") {35 if ( _lastStatus != null ){36 $.gritter.add({37 image: "img/info.png",38 title: _notificationTitle,39 text: "Arret de l'automate"40 });41 }42 dijit.byNode( $('[data-jquery-type="automateaction"][data-action="start"]').parent().parent().get(0) ).set("disabled", false);43 dijit.byNode( $('[data-jquery-type="automateaction"][data-action="pause"]').parent().parent().get(0) ).set("disabled", true);44 dijit.byNode( $('[data-jquery-type="automateaction"][data-action="pause"]').parent().parent().get(0) ).set("checked", false);45 dijit.byNode( $('[data-jquery-type="automateaction"][data-action="stop"]').parent().parent().get(0) ).set("disabled", true);46 } else if (_status == "started"){47 if ( _lastStatus != null ){48 $.gritter.add({49 image: "img/info.png",50 title: _notificationTitle,51 text: (_lastStatus == "paused" ? "Relance de l'automate" : "Lancement de l'automate")52 });53 }54 dijit.byNode( $('[data-jquery-type="automateaction"][data-action="start"]').parent().parent().get(0) ).set("disabled", true);55 dijit.byNode( $('[data-jquery-type="automateaction"][data-action="pause"]').parent().parent().get(0) ).set("disabled", false);56 dijit.byNode( $('[data-jquery-type="automateaction"][data-action="pause"]').parent().parent().get(0) ).set("checked", false);57 dijit.byNode( $('[data-jquery-type="automateaction"][data-action="stop"]').parent().parent().get(0) ).set("disabled", false);58 } else if (_status == "paused") {59 if ( _lastStatus != null ){60 $.gritter.add({61 image: "img/info.png",62 title: _notificationTitle,63 text: "Pause de l'automate"64 });65 }66 dijit.byNode( $('[data-jquery-type="automateaction"][data-action="start"]').parent().parent().get(0) ).set("disabled", true);67 dijit.byNode( $('[data-jquery-type="automateaction"][data-action="pause"]').parent().parent().get(0) ).set("disabled", false);68 dijit.byNode( $('[data-jquery-type="automateaction"][data-action="pause"]').parent().parent().get(0) ).set("checked", true);69 dijit.byNode( $('[data-jquery-type="automateaction"][data-action="stop"]').parent().parent().get(0) ).set("disabled", false);70 } else {71 if ( _lastStatus != null ){72 $.gritter.add({73 image: "img/info.png",74 title: _notificationTitle,75 text: "Erreur inconnue"76 });77 }78 dijit.byNode( $('[data-jquery-type="automateaction"][data-action="start"]').parent().parent().get(0) ).set("disabled", true);79 dijit.byNode( $('[data-jquery-type="automateaction"][data-action="pause"]').parent().parent().get(0) ).set("disabled", true);80 dijit.byNode( $('[data-jquery-type="automateaction"][data-action="pause"]').parent().parent().get(0) ).set("checked", false);81 dijit.byNode( $('[data-jquery-type="automateaction"][data-action="stop"]').parent().parent().get(0) ).set("disabled", true);82 }83 _lastStatus = _status;84 }85 86 // automate dialogs87 var _dialog;88 if (_status == "started"){89 _dialog = $.wesbmessenger.consumer[__AUTOMATE_DIALOG__];90 }else{91 _dialog = JSON.stringify({type: "none"});92 }93 if (_lastDialog != _dialog){94 _lastDialog = _dialog;95 try {96 _dialog = JSON.parse( _dialog );97 } catch(e){98 _dialog = { type: "none" };99 }100 101 if (_dialog.type == "alert"){102 if ( $('#gritter-item-'+_currentGritterId).size() > 0 ){103 $.gritter.remove(_currentGritterId);104 _currentGritterId = -1;105 }106 107 jAlert( _dialog.text, _dialog.title, function(){108 $.wesbmessenger.singleton().trigger(__AUTOMATE_DIALOG_RETURN__, {109 "type": "alert"110 });111 });112 } else if (_dialog.type == "confirm"){113 if ( $('#gritter-item-'+_currentGritterId).size() > 0 ){114 $.gritter.remove(_currentGritterId);115 _currentGritterId = -1;116 }117 118 jConfirm( _dialog.text, _dialog.title, function(_r){119 $.wesbmessenger.singleton().trigger(__AUTOMATE_DIALOG_RETURN__, {120 "type": "confirm",121 "return": _r122 });123 });124 } else if (_dialog.type == "prompt"){125 if ( $('#gritter-item-'+_currentGritterId).size() > 0 ){126 $.gritter.remove(_currentGritterId);127 _currentGritterId = -1;128 }129 130 jPrompt( _dialog.text, "", _dialog.title, function(_r){131 $.wesbmessenger.singleton().trigger(__AUTOMATE_DIALOG_RETURN__, {132 "type": "prompt",133 "return": _r134 });135 });136 } else if (_dialog.type == "wait"){137 $.alerts._hide();138 139 if ( $('#gritter-item-'+_currentGritterId).size() > 0 ){140 $.gritter.remove(_currentGritterId);141 }142 _currentGritterId = $.gritter.add({143 image: "img/waiting.png",144 sticky: true,145 title: "Automate en attente",146 text: _dialog.text147 });148 $('#gritter-item-'+_currentGritterId+' .gritter-close').remove();149 }else{150 $.alerts._hide();151 if ( $('#gritter-item-'+_currentGritterId).size() > 0 ){152 $.gritter.remove(_currentGritterId);153 _currentGritterId = -1;154 }155 }156 }157});158 159$.fn.automateaction = function(){160 return this.each(function(){161 var $_this = $(this);162 var _action = $_this.attr('data-action');163 $_this.click(function(){164 if ( dijit.byNode( $_this.parent().parent().get(0) ).get('disabled') ){165 return false;166 }167 168 dijit.byNode( $('[data-jquery-type="automateaction"][data-action="start"]').parent().parent().get(0) ).set("disabled", true);169 dijit.byNode( $('[data-jquery-type="automateaction"][data-action="pause"]').parent().parent().get(0) ).set("disabled", true);170 dijit.byNode( $('[data-jquery-type="automateaction"][data-action="stop"]').parent().parent().get(0) ).set("disabled", true);171 172 if ( _action == 'start' ){173 $.wesbmessenger.singleton().call("getAutomates").done(function( _automates ){174 var $_dialog = $( $_this.attr('data-dialog') );175 176 $_dialog177 .tmpl( { automates: _automates } )178 .dialog({179 modal: true,180 title: "Executer un automate",181 buttons: { 182 "Executer": function() { 183 if ( $(this).find('li.ui-selected').size() <= 0 ){184 jAlert( "Selectionnez l'automate a executer" );185 }else if ( $(this).find('li.ui-selected').size() > 1 ){186 jAlert( "Selectionnez un seul automate" );187 }else{188 $_this.attr('data-waiting', '');189 $.wesbmessenger.singleton().call("startAutomate", {190 file: $(this).find('li.ui-selected').attr('data-file')191 }).done(function(_r){192 $_this.removeAttr('data-waiting');193 if (_r.status == 0){194 _lastStatus = null;195 jAlert(_r.error, "Erreur d'automate");196 }197 });198 $(this).dialog("destroy"); 199 }200 },201 "Annuler": function(){202 $(this).dialog("close"); 203 }204 },205 close: function(event, ui) { 206 $_this.removeAttr('data-waiting');207 _lastStatus = null;208 $(this).dialog("destroy"); 209 }210 })211 .pluginautoload();212 });213 } else if (_action == 'pause' ){214 $_this.attr('data-waiting', '');215 if ( $.wesbmessenger.consumer.AUTOMATE_STATUS != "paused" ) { 216 $.wesbmessenger.singleton().call("pauseAutomate").done(function(){217 $_this.removeAttr('data-waiting');218 }); 219 } else { 220 $.wesbmessenger.singleton().call("resumeAutomate").done(function(){221 $_this.removeAttr('data-waiting');222 });223 }224 } else if ( _action == 'stop' ){225 $_this.attr('data-waiting', '');226 $.wesbmessenger.singleton().call("stopAutomate").done(function(){227 $_this.removeAttr('data-waiting');228 }); 229 }230 }); 231 });232};...
type_select.js
Source: type_select.js
1var categoryId;2var typeId;3var typeData;4//é项渲æ5function appendOption($o,text,value){6 //æ°å»ºä¸ä¸ªoption7 var $opt=layui.jquery("<option>").text(text).val(value);8 $opt.appendTo($o);9}10layui.use(['jquery', 'form'], function() {11 var $ = layui.jquery,12 form = layui.form,13 $form = $('#typeForm');14 //ç»å®éæ©äºä»¶15 form.on('select(category)', function(data) {16 categoryEvent(data);17 });18 form.on('select(type)', function(data) {19 typeEvent(data);20 });21 //çå¬ä¸çº§åç±»éæ©äºä»¶22 function categoryEvent(data){23 //äºçº§åç±»åtypeID置空并添å æ示é项24 $('#type').html("");25 typeId=null;26 appendOption($('#type'),"äºçº§åç±»","");27 //å½éæ©çä¸æ¯æ示é项æ¶åéåä¸çº§åç±»28 if(data.value!=""){29 $.each(typeData,function(index,category){30 //å¦ææ¯å½åéæ©çä¸çº§åç±»ä¸ååç±»é空åéåäºçº§åç±»31 if(category.text==data.value && category.children){32 //ä¿®æ¹å
¨å±åécategoryID33 categoryId=category.id;34 $.each(category.children,function(index,type){35 appendOption($('#type'),type.text,type.text);36 });37 }38 });39 //å¦å置空categoryId40 }else{41 categoryId=null;42 }43 //渲æè¡¨æ ¼44 form.render();45 }46 //çå¬äºçº§åç±»éæ©äºä»¶47 function typeEvent(data){48 //å½éæ©çä¸æ¯æ示é项æ¶åéåä¸çº§åç±»49 if(data.value!=""){50 $.each(typeData,function(index,category){51 //å¦ææ¯å½åéæ©çä¸çº§åç±»åéåäºçº§åç±»52 if(category.id==categoryId) {53 $.each(category.children,function(index,type){54 //å¦ææ¯å½åéæ©çäºçº§åç±»åä¿®æ¹å
¨å±åétypeId55 if(type.text==data.value){56 typeId=type.id;57 }58 });59 }60 });61 //å¦å置空typeId62 }else{63 typeId=null;64 }65 }66});67//åå§åä¸çº§åç±»68function initCategoty(categoryId,typeId) {69 //æ¸
空å½åæ°æ®70 layui.jquery("#category").empty();71 layui.jquery("#type").empty();72 categoryId=categoryId;73 typeId=typeId;74 //请æ±æ°æ®75 layui.jquery.ajax({76 url: "/type",77 type: "get",78 dataType: "json",79 success: function (result) {80 typeData = result;81 // æ·»å æ示é项82 appendOption(layui.jquery('#category'),"ä¸çº§åç±»","");83 appendOption(layui.jquery('#type'),"äºçº§åç±»","");84 // éåæ°æ®æ·»å èç¹85 layui.jquery.each(typeData,function(index,category){86 appendOption(layui.jquery('#category'),category.text,category.text);87 //æ ¹æ®ä¼ å
¥çåç±»idæ¹åé»è®¤éæ©çåç±»å¼88 if(categoryId &&category.id==categoryId){89 //模æç¹å»äºä»¶90 layui.jquery('#category').next().find('.layui-select-title input').click();91 setTimeout(function () {92 layui.jquery('#category').next().find('.layui-anim').children('dd[lay-value="'+category.text+'"]').click();93 },10);94 layui.jquery.each(category.children,function(index,type){95 //å¦ææ¯å½åéæ©çäºçº§åç±»åä¿®æ¹96 if(typeId&&type.id==typeId){97 //模æç¹å»äºä»¶98 layui.jquery('#type').next().find('.layui-select-title input').click();99 setTimeout(function () {100 layui.jquery('#type').next().find('.layui-anim').children('dd[lay-value="'+type.text+'"]').click();101 },10);102 }103 });104 }105 });106 layui.form.render();107 }108 });...
jquery.variablelist.js
Source: jquery.variablelist.js
1/**2 * This file is part of WorkESB.3 *4 * WorkESB is free software: you can redistribute it and/or modify5 * it under the terms of the GNU Lesser General Public License as published by6 * the Free Software Foundation, either version 3 of the License, or7 * (at your option) any later version.8 *9 * WorkESB is distributed in the hope that it will be useful,10 * but WITHOUT ANY WARRANTY; without even the implied warranty of11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12 * GNU Lesser General Public License for more details.13 *14 * You should have received a copy of the GNU Lesser General Public License15 * along with WorkESB. If not, see <http://www.gnu.org/licenses/>.16 *17 * Created on: 31 janv. 201218 * Author: Marc Buils (MATIS - http://www.matis-group.com)19 */20;(function($){21 var _getIdByName = function(p_name){22 var _return = "";23 24 $.each(p_name, function(_i,_v){25 if ( _v == ' ' ){26 _return += '_';27 } else if ( (_v >= 'a' && _v <= 'z')28 || (_v >= 'A' && _v <= 'Z')29 || (_v >= '0' && _v <= '9' ) ){30 _return += _v;31 }32 });33 34 return _return;35 };36 37 $.fn.variableList = function(){38 return this.each(function(){39 var $_this = $(this);40 var _list = $($_this.attr('data-tmpl-list'));41 var _removed = $_this.attr('data-sequencer-removed');42 var _consumText = $($_this.attr('data-tmpl-consum-text'));43 var _produceText = $($_this.attr('data-tmpl-produce-text'));44 var _consumQueuingText = $($_this.attr('data-tmpl-consum-queuing-text'));45 var _produceQueuingText = $($_this.attr('data-tmpl-produce-queuing-text'));46 var _call = $($_this.attr('data-tmpl-call'));47 var _bind = $($_this.attr('data-tmpl-bind'));48 var _trigger = $($_this.attr('data-tmpl-trigger'));49 var _eventlist = {};50 51 $.wesbmessenger.singleton().bind('wesbmessenger_pong', function(p_module){52 if ( p_module.name == "IHM" || p_module.name == "SEQUENCEUR D'AUTOMATE"53 || p_module.variable.name == "wesbmessenger_pong" ){54 return;55 }56 57 // add id58 p_module.id = _getIdByName( p_module.name );59 p_module.variable.id = _getIdByName( p_module.variable.name ); 60 61 var _block = $_this.find('ul[data-jquery-type="sortableVariable"][data-name="' + p_module.name + '"]');62 if ( _block.size() <= 063 && ( p_module.variable.com == "consumer" || p_module.variable.com == "producer"64 || p_module.variable.com == "share" || p_module.variable.com == "bind") ){65 _block = _list66 .tmpl({67 name: p_module.name,68 id: p_module.id69 })70 .appendTo( $_this );71 }72 73 if ( $('ul[data-jquery-type="sortableVariable"] li[data-module="'+p_module.name+'"][data-name="'+p_module.variable.name+'"]').size() <= 0 ){74 p_module.variable.type = p_module.variable.type == "string" ? "json" : p_module.variable.type;75 76 if ( p_module.variable.com == "producer" && !p_module.variable.queuing ) {77 _consumText78 .tmpl(p_module)79 .appendTo( _block );80 } else if ( p_module.variable.com == "consumer" && !p_module.variable.queuing ) {81 _produceText82 .tmpl(p_module)83 .appendTo( _block );84 } else if ( p_module.variable.com == "producer" && p_module.variable.queuing ) {85 _consumQueuingText86 .tmpl(p_module)87 .appendTo( _block );88 } else if ( p_module.variable.com == "consumer" && p_module.variable.queuing ) {89 _produceQueuingText90 .tmpl(p_module)91 .appendTo( _block );92 } else if ( p_module.variable.com == "share" ) {93 _call94 .tmpl(p_module)95 .appendTo( _block );96 } else if ( p_module.variable.com == "bind" ) {97 _trigger98 .tmpl(p_module)99 .appendTo( _block );100 }101 }102 103 if ( p_module.variable.com == "trigger" ) {104 if ( typeof( _eventlist[p_module.variable.name] ) == 'undefined' ){105 _eventlist[p_module.variable.name] = true;106 107 $.wesbmessenger.singleton().bind( p_module.variable.name, function(p){108 log( 'trigger "'+p_module.variable.name+'": '+JSON.stringify(p) );109 });110 }111 }112 113 _block114 .parent()115 .pluginautoload();116 });117 118 $.wesbmessenger.singleton().bind(_removed, function(p_module){119 $('ul[data-jquery-type="sortableVariable"] li[data-module="'+p_module.name+'"]').remove();120 $_this.find('ul[data-jquery-type="sortableVariable"][data-name="' + p_module.name + '"]').remove();121 });122 $.wesbmessenger.singleton().trigger('wesbmessenger_ping');123 });124 };...
gallery-yquery.js
Source: gallery-yquery.js
1YUI.add('gallery-yquery', function(Y) {2/**3* YQuery is a widget for YUI3 that simplifies implementing both jQuery and jQuery plugins into your code4*5*6*7*8* Project Home - http://kickballcreative.com/yui/modules/yquery/9* Copyright (c) 2010 Lauren Smith10* YUI BSD - http://developer.yahoo.com/yui/license.html11*12*13*/14var opts = {}, win = window, JQUERY_BASE = 'http://ajax.googleapis.com/ajax/libs/jquery/';15function YQuery( src ) {16 return {17 // Allows for override of the version to use18 version : '1.4.2',19 // Allows for override of autodetection20 autodetect : true,21 // Allows for override to use dev version22 type : 'production',23 24 // Undocumented but allows for override of the setTimeout function; in milliseconds25 timeout : 10000,26 27 // Undocumented but allows for overriding the callback if ever necessary28 callback : null,29 use : function() {30 var queue = Array.prototype.slice.call( arguments, 0 );31 opts.timeout = this.timeout;32 opts.scope = this;33 var type = ( this.type === 'production' ) ? '.min' : '';34 35 if ( Y.Lang.isNull( this.callback ) ) { this.callback = queue.pop(); }36 if ( this.autodetect || Y.Lang.isObject( this.version ) ) {37 if ( Y.Lang.isArray( queue[0] ) ) { queue = queue[0]; }38 if ( typeof( jQuery ) === 'undefined' && this.autodetect && ! Y.Lang.isObject( this.version ) ) {39 queue.unshift( JQUERY_BASE + this.version + '/jquery' + type +'.js' );40 }41 if ( Y.Lang.isObject( this.version ) ) {42 if ( typeof( jQuery) === 'undefined' && this.autodetect ) {43 for( var i = 0; i < this.version.length; i++ ) {44 var url = JQUERY_BASE + this.version[ i ].version + '/jquery' + type + '.js';45 var c = ( queue.length <= 0 && i == ( this.version.length - 1 ) ) ? true : false;46 opts.data = {47 space : this.version[ i ].namespace,48 callback : c49 };50 51 opts.onSuccess = function( d ) {52 if ( ! Y.Lang.isUndefined( d.data.space ) ) { win[d.data.space] = jQuery.noConflict( true ); }53 if ( d.data.callback ) { this.scope._invokeReady(); }54 };55 opts.onTimeout = function( d ) {56 if ( ! Y.Lang.isUndefined( d.data.space ) ) { win[d.data.space] = jQuery.noConflict( true ); }57 if ( d.data.callback ) { this.scope._invokeReady(); }58 };59 Y.Get.script( url, opts );60 }61 }62 }63 if( queue.length > 0 ) {64 opts.onSuccess = function( d ) { this.scope._invokeReady(); };65 opts.onTimeout = function( d ) { this.scope._invokeReady(); };66 Y.Get.script( queue, opts );67 }68 } else {69 70 // This gets fired if jQuery autodetect has been overridden71 this._invokeReady();72 }73 },74 75 _invokeReady : function() {76 Y.on( 'domready', function() { this.callback(); }, this );77 78 }79 };80}81Y.YQuery = YQuery;...
gallery-yquery-debug.js
Source: gallery-yquery-debug.js
1YUI.add('gallery-yquery', function(Y) {2/**3* YQuery is a widget for YUI3 that simplifies implementing both jQuery and jQuery plugins into your code4*5*6*7*8* Project Home - http://kickballcreative.com/yui/modules/yquery/9* Copyright (c) 2010 Lauren Smith10* YUI BSD - http://developer.yahoo.com/yui/license.html11*12*13*/14var opts = {}, win = window, JQUERY_BASE = 'http://ajax.googleapis.com/ajax/libs/jquery/';15function YQuery( src ) {16 return {17 // Allows for override of the version to use18 version : '1.4.2',19 // Allows for override of autodetection20 autodetect : true,21 // Allows for override to use dev version22 type : 'production',23 24 // Undocumented but allows for override of the setTimeout function; in milliseconds25 timeout : 10000,26 27 // Undocumented but allows for overriding the callback if ever necessary28 callback : null,29 use : function() {30 var queue = Array.prototype.slice.call( arguments, 0 );31 opts.timeout = this.timeout;32 opts.scope = this;33 var type = ( this.type === 'production' ) ? '.min' : '';34 35 if ( Y.Lang.isNull( this.callback ) ) { this.callback = queue.pop(); }36 if ( this.autodetect || Y.Lang.isObject( this.version ) ) {37 if ( Y.Lang.isArray( queue[0] ) ) { queue = queue[0]; }38 if ( typeof( jQuery ) === 'undefined' && this.autodetect && ! Y.Lang.isObject( this.version ) ) {39 queue.unshift( JQUERY_BASE + this.version + '/jquery' + type +'.js' );40 }41 if ( Y.Lang.isObject( this.version ) ) {42 if ( typeof( jQuery) === 'undefined' && this.autodetect ) {43 for( var i = 0; i < this.version.length; i++ ) {44 var url = JQUERY_BASE + this.version[ i ].version + '/jquery' + type + '.js';45 var c = ( queue.length <= 0 && i == ( this.version.length - 1 ) ) ? true : false;46 opts.data = {47 space : this.version[ i ].namespace,48 callback : c49 };50 51 opts.onSuccess = function( d ) {52 if ( ! Y.Lang.isUndefined( d.data.space ) ) { win[d.data.space] = jQuery.noConflict( true ); }53 if ( d.data.callback ) { this.scope._invokeReady(); }54 };55 opts.onTimeout = function( d ) {56 if ( ! Y.Lang.isUndefined( d.data.space ) ) { win[d.data.space] = jQuery.noConflict( true ); }57 if ( d.data.callback ) { this.scope._invokeReady(); }58 };59 Y.Get.script( url, opts );60 }61 }62 }63 if( queue.length > 0 ) {64 opts.onSuccess = function( d ) { this.scope._invokeReady(); };65 opts.onTimeout = function( d ) { this.scope._invokeReady(); };66 Y.Get.script( queue, opts );67 }68 } else {69 70 // This gets fired if jQuery autodetect has been overridden71 this._invokeReady();72 }73 },74 75 _invokeReady : function() {76 Y.on( 'domready', function() { this.callback(); }, this );77 78 }79 };80}81Y.YQuery = YQuery;...
yquery.js
Source: yquery.js
1/**2* YQuery is a widget for YUI3 that simplifies implementing both jQuery and jQuery plugins into your code3*4*5*6*7* Project Home - http://kickballcreative.com/yui/modules/yquery/8* Copyright (c) 2010 Lauren Smith9* YUI BSD - http://developer.yahoo.com/yui/license.html10*11*12*/13var opts = {}, win = window, JQUERY_BASE = 'http://ajax.googleapis.com/ajax/libs/jquery/';14function YQuery( src ) {15 return {16 // Allows for override of the version to use17 version : '1.4.2',18 // Allows for override of autodetection19 autodetect : true,20 // Allows for override to use dev version21 type : 'production',22 23 // Undocumented but allows for override of the setTimeout function; in milliseconds24 timeout : 10000,25 26 // Undocumented but allows for overriding the callback if ever necessary27 callback : null,28 use : function() {29 var queue = Array.prototype.slice.call( arguments, 0 );30 opts.timeout = this.timeout;31 opts.scope = this;32 var type = ( this.type === 'production' ) ? '.min' : '';33 34 if ( Y.Lang.isNull( this.callback ) ) { this.callback = queue.pop(); }35 if ( this.autodetect || Y.Lang.isObject( this.version ) ) {36 if ( Y.Lang.isArray( queue[0] ) ) { queue = queue[0]; }37 if ( typeof( jQuery ) === 'undefined' && this.autodetect && ! Y.Lang.isObject( this.version ) ) {38 queue.unshift( JQUERY_BASE + this.version + '/jquery' + type +'.js' );39 }40 if ( Y.Lang.isObject( this.version ) ) {41 if ( typeof( jQuery) === 'undefined' && this.autodetect ) {42 for( var i = 0; i < this.version.length; i++ ) {43 var url = JQUERY_BASE + this.version[ i ].version + '/jquery' + type + '.js';44 var c = ( queue.length <= 0 && i == ( this.version.length - 1 ) ) ? true : false;45 opts.data = {46 space : this.version[ i ].namespace,47 callback : c48 };49 50 opts.onSuccess = function( d ) {51 if ( ! Y.Lang.isUndefined( d.data.space ) ) { win[d.data.space] = jQuery.noConflict( true ); }52 if ( d.data.callback ) { this.scope._invokeReady(); }53 };54 opts.onTimeout = function( d ) {55 if ( ! Y.Lang.isUndefined( d.data.space ) ) { win[d.data.space] = jQuery.noConflict( true ); }56 if ( d.data.callback ) { this.scope._invokeReady(); }57 };58 Y.Get.script( url, opts );59 }60 }61 }62 if( queue.length > 0 ) {63 opts.onSuccess = function( d ) { this.scope._invokeReady(); };64 opts.onTimeout = function( d ) { this.scope._invokeReady(); };65 Y.Get.script( queue, opts );66 }67 } else {68 69 // This gets fired if jQuery autodetect has been overridden70 this._invokeReady();71 }72 },73 74 _invokeReady : function() {75 Y.on( 'domready', function() { this.callback(); }, this );76 77 }78 };79}...
Using AI Code Generation
1describe('My First Test', function() {2 it('Does not do much!', function() {3 expect(true).to.equal(true)4 })5})6describe('My First Test', function() {7 it('Does not do much!', function() {8 expect(true).to.equal(true)9 })10})11describe('My First Test', function() {12 it('Does not do much!', function() {13 expect(true).to.equal(true)14 cy.get('.action-email')15 })16})17describe('My First Test', function() {18 it('Does not do much!', function() {19 expect(true).to.equal(true)20 cy.get('.action-email')21 cy.get('#email1')22 })23})24describe('My First Test', function() {25 it('Does not do much!', function() {26 expect(true).to.equal(true)27 cy.get('.action-email')28 cy.get('#email1')29 cy.get('[data-cy=dataSometing]')30 })31})32describe('My First Test', function() {33 it('Does not do much!', function() {34 expect(true).to.equal(true)35 cy.get('.action-email')36 cy.get('#email1')37 cy.get('[data-cy=dataSometing]')38 cy.get('#email1')39 cy.get('#email2')40 cy.get('[data-cy=dataSometing]')41 })42})43describe('My First Test', function() {44 it('Does not do much!', function() {45 expect(true).to.equal(true)46 cy.get('.action-email')47 cy.get('#email1')48 cy.get('[data-cy=dataSometing]')49 cy.get('#email1')50 cy.get('#email2')51 cy.get('[data-cy=dataSometing]')52 cy.get('#email1')53 cy.get('#email2')
Using AI Code Generation
1describe('jQuery', function() {2 it('jQuery type', function() {3 cy.get('.query-table').find('tr').its('length').should('be.gt', 2)4 })5})6describe('jQuery', function() {7 it('jQuery type', function() {8 cy.get('.query-table').find('tr').its('length').should('be.gt', 2)9 })10})11describe('jQuery', function() {12 it('jQuery type', function() {13 cy.get('.query-table').find('tr').its('length').should('be.gt', 2)14 })15})16describe('jQuery', function() {17 it('jQuery type', function() {18 cy.get('.query-table').find('tr').its('length').should('be.gt', 2)19 })20})21describe('jQuery', function() {22 it('jQuery type', function() {23 cy.get('.query-table').find('tr').its('length').should('be.gt', 2)24 })25})26describe('jQuery', function() {27 it('jQuery type', function() {28 cy.get('.query-table').find('tr').its('length').should('be.gt', 2)29 })30})31describe('jQuery', function() {32 it('jQuery type', function() {33 cy.get('.query-table').find('tr').its('length').should('be.gt', 2)34 })35})
Using AI Code Generation
1describe('jQuery.type method', () => {2 it('jQuery.type method', () => {3 cy.contains('type').click()4 cy.get('.action-email')5 .type('hello')6 .should('have.value', 'hello')7 cy.get('.action-disabled')8 .type('
Using AI Code Generation
1it('should be able to get the type of an element', () => {2 cy.get('.query-table').contains('type').click()3 cy.get('.query-btn').should('have.class', 'btn')4 cy.get('.query-btn').then(($btn) => {5 expect(Cypress.$($btn).type()).to.eq('object')6 })7})
Using AI Code Generation
1describe('Test', () => {2 it('test', () => {3 cy.get('input[name="q"]').type('Cypress')4 cy.get('input[type="submit"]').click()5 const text = Cypress.$.type($a)6 cy.log(text)7 })8 })9})
Using AI Code Generation
1describe('Test', () => {2 it('Test', () => {3 cy.get('input.gLFyf').type('Hello World')4 })5})6{7 "reporterOptions": {},8}9{10 "scripts": {11 },12 "devDependencies": {13 }14}15import './commands'
Using AI Code Generation
1it('test', () => {2 cy.get('.action-email')3 .type('email').should('have.value', 'email')4 .type('{selectall}email').should('have.value', 'email')5 .type('{backspace}').should('have.value', 'emai')6 .type('{leftarrow}{rightarrow}{uparrow}{downarrow}')7 .type('{del}{selectall}{backspace}')8 .type('{cmd}')
Cypress does not always executes click on element
How to get current date using cy.clock()
.type() method in cypress when string is empty
Cypress route function not detecting the network request
How to pass files name in array and then iterating for the file upload functionality in cypress
confused with cy.log in cypress
why is drag drop not working as per expectation in cypress.io?
Failing wait for request in Cypress
How to Populate Input Text Field with Javascript
Is there a reliable way to have Cypress exit as soon as a test fails?
2022 here and tested with cypress version: "6.x.x"
until "10.x.x"
You could use { force: true }
like:
cy.get("YOUR_SELECTOR").click({ force: true });
but this might not solve it ! The problem might be more complex, that's why check below
My solution:
cy.get("YOUR_SELECTOR").trigger("click");
Explanation:
In my case, I needed to watch a bit deeper what's going on. I started by pin the click
action like this:
Then watch the console, and you should see something like:
Now click on line Mouse Events
, it should display a table:
So basically, when Cypress executes the click
function, it triggers all those events but somehow my component behave the way that it is detached the moment where click event
is triggered.
So I just simplified the click by doing:
cy.get("YOUR_SELECTOR").trigger("click");
And it worked ????
Hope this will fix your issue or at least help you debug and understand what's wrong.
Check out the latest blogs from LambdaTest on this topic:
When it comes to web automation testing, the first automation testing framework that comes to mind undoubtedly has to be the Selenium framework. Selenium automation testing has picked up a significant pace since the creation of the framework way back in 2004.
We just raised $45 million in a venture round led by Premji Invest with participation from existing investors. Here’s what we intend to do with the money.
Find element by Text in Selenium is used to locate a web element using its text attribute. The text value is used mostly when the basic element identification properties such as ID or Class are dynamic in nature, making it hard to locate the web element.
We are nearing towards the end of 2019, where we are witnessing the introduction of more aligned JavaScript engines from major browser vendors. Which often strikes a major question in the back of our heads as web-developers or web-testers, and that is, whether cross browser testing is still relevant? If all the major browser would move towards a standardized process while configuring their JavaScript engines or browser engines then the chances of browser compatibility issues are bound to decrease right? But does that mean that we can simply ignore cross browser testing?
Web products of top-notch quality can only be realized when the emphasis is laid on every aspect of the product. This is where web automation testing plays a major role in testing the features of the product inside-out. A majority of the web testing community (including myself) have been using the Selenium test automation framework for realizing different forms of web testing (e.g., cross browser testing, functional testing, etc.).
Cypress is a renowned Javascript-based open-source, easy-to-use end-to-end testing framework primarily used for testing web applications. Cypress is a relatively new player in the automation testing space and has been gaining much traction lately, as evidenced by the number of Forks (2.7K) and Stars (42.1K) for the project. LambdaTest’s Cypress Tutorial covers step-by-step guides that will help you learn from the basics till you run automation tests on LambdaTest.
You can elevate your expertise with end-to-end testing using the Cypress automation framework and stay one step ahead in your career by earning a Cypress certification. Check out our Cypress 101 Certification.
Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.
Get 100 minutes of automation test minutes FREE!!