How to use this.getSize method in Appium Xcuitest Driver

Best JavaScript code snippet using appium-xcuitest-driver

LuoBoMainScene.js

Source:LuoBoMainScene.js Github

copy

Full Screen

...17		this.addChild(settingBtn, 20);18		settingBtn.addTouchEventListener(this.settingBtnFunc, this);19		20		var helpBtn    = ccui.Button.create("btn_help_normal.png","btn_help_pressed.png","",ccui.Widget.PLIST_TEXTURE);21		helpBtn.setPosition(cc.p(this.getSize().width - 200, 225));22		this.addChild(helpBtn, 20);23		helpBtn.addTouchEventListener(this.helpBtnFunc, this);24		25		var adventureBtn = ccui.Button.create("btn_adventure_normal_CN.png","btn_adventure_pressed_CN.png","",ccui.Widget.PLIST_TEXTURE);26		adventureBtn.setPosition(cc.p(adventureBtn.width/2+30, 80));27		this.addChild(adventureBtn, 20);28		adventureBtn.addTouchEventListener(this.adventureBtnFunc, this);29		30		{31			var bossModuleBtn = ccui.Button.create("btn_boss_normal_CN.png","btn_boss_pressed_CN.png","",ccui.Widget.PLIST_TEXTURE);32			bossModuleBtn.setPosition(cc.p(this.getSize().width/2, 80));33			this.addChild(bossModuleBtn, 20);34			bossModuleBtn.addTouchEventListener(this.bossModuleBtnFunc, this);35			var lockImage = ccui.ImageView.create("locked.png",ccui.Widget.PLIST_TEXTURE);36			lockImage.setPosition(cc.p(bossModuleBtn.x+bossModuleBtn.width/2-20,bossModuleBtn.y-20));37			this.addChild(lockImage, 20);38		}39		40		{41			var monsterBtn = ccui.Button.create("btn_nest_normal_CN.png","btn_nest_pressed_CN.png","",ccui.Widget.PLIST_TEXTURE);42			monsterBtn.setPosition(cc.p(this.getSize().width - monsterBtn.width/2 - 30, 80));43			this.addChild(monsterBtn, 20);44			monsterBtn.addTouchEventListener(this.monsterBtnFunc, this);45			var lockImage = ccui.ImageView.create("locked.png",ccui.Widget.PLIST_TEXTURE);46			lockImage.setPosition(cc.p(monsterBtn.x+monsterBtn.width/2-20,monsterBtn.y-20));47			this.addChild(lockImage, 20);48		49		}50	51	},52	//monster module scene53	monsterBtnFunc:function(target, state)54	{55		if(state == ccui.Widget.TOUCH_ENDED)56		{57			var monsterLock = new LuoBoLockLayout("monsterHome");58			this.addChild(monsterLock, 100);59		}60	},61	//boss module scene62	bossModuleBtnFunc:function(target, state)63	{64		if(state == ccui.Widget.TOUCH_ENDED)65		{66			var bossLock = new LuoBoLockLayout("boss");67			this.addChild(bossLock, 100);68		}69	},70	//adventure scene71	adventureBtnFunc:function(target, state)72	{73		if(state == ccui.Widget.TOUCH_ENDED)74		{75			var themes = LuoBoThemesScene.createScene();76			cc.director.runScene(cc.TransitionFade.create(changeSceneTime, themes));77		}78	},79	//setting scene80	settingBtnFunc:function(target, state)81	{82		if(state == ccui.Widget.TOUCH_ENDED)83		{84			var set = LuoBoSettingScene.createScene();85			cc.director.runScene(cc.TransitionSlideInB.create(changeSceneTime, set));86		}87	},88	//help scene89	helpBtnFunc:function(target, state)90	{91		if(state == ccui.Widget.TOUCH_ENDED)92		{93			var help = LuoBoHelpScene.createScene();94			cc.director.runScene(cc.TransitionSlideInT.create(changeSceneTime, help));95		}96	},97	//init scene98	zinit:function()99	{100		this.setSize(Default.windowSize());101		cc.spriteFrameCache.addSpriteFrames("res/Themes/scene/mainscene1-hd.plist");102		{103			var bird = cc.Sprite.createWithSpriteFrameName("bird.png");104			bird.setPosition(cc.p(200, this.getSize().height - 150));105			this.addChild(bird, 10);106			//top to down effect107			var move = cc.MoveBy.create(1, cc.p(0, 20));108			var move_ease_inout1 = move.clone().easing(cc.easeInOut(2.0));109			var move_ease_inout_back1 = move_ease_inout1.reverse();110			var delay = cc.DelayTime.create(0.1);111			var seq1 = cc.Sequence.create(move_ease_inout1, delay, move_ease_inout_back1, delay.clone());112			bird.runAction(seq1.repeatForever());113		}114		115		var luobo = cc.Sprite.createWithSpriteFrameName("carrot.png");116		luobo.setAnchorPoint(0.5, 0);117		luobo.setPosition(cc.p(this.getSize().width/2, this.getSize().height/2 + luobo.height/4 -luobo.height/2));118		this.addChild(luobo, 10);119		120		var yunduo = cc.Sprite.createWithSpriteFrameName("cloud1.png");121		yunduo.setPosition(cc.p(this.getSize().width -100, this.getSize().height - 50));122		this.addChild(yunduo, 10);123		124		{125			var yezi = cc.Sprite.createWithSpriteFrameName("leaf-1.png");126			yezi.setAnchorPoint(0.5, 0);127			yezi.setPosition(cc.p(400, this.getSize().height - 150 - yezi.height/2));128			this.addChild(yezi, 5);129			var yezi1 = cc.Sprite.createWithSpriteFrameName("leaf-2.png");130			yezi1.setAnchorPoint(0.5, 0);131			yezi1.setPosition(cc.p(470, this.getSize().height - 130 - yezi1.height/2));132			this.addChild(yezi1, 5);133			var yezi2 = cc.Sprite.createWithSpriteFrameName("leaf-3.png");134			yezi2.setAnchorPoint(0.5, 0);135			yezi2.setPosition(cc.p(550, this.getSize().height - 140 - yezi2.height/2));136			this.addChild(yezi2, 4);137			//rotate effect138			this.schedule(function()139			{140				var rotate = cc.RotateBy.create(0.1, 10, 10);141				var rotater = rotate.reverse();142				var sequence = cc.sequence(rotate, rotater);143				yezi1.runAction(sequence.repeat(3));144				this.scheduleOnce(function()145				{146					var rotate = cc.RotateBy.create(0.1, 10, 10);147					var rotater = rotate.reverse();148					var sequence = cc.sequence(rotate, rotater);149					yezi2.runAction(sequence.repeat(3));150				}, 2);151			}, 6);152		}153		154		{155			luobo.scale = yezi.scale = yezi1.scale = yezi2.scale = 0;156			var scaleTo = cc.ScaleTo.create(0.25, 1.2, 1.2);157			var scaleBy = cc.ScaleBy.create(0.1, 1, 1);158			var sequence = cc.sequence(scaleTo, scaleBy);159			luobo.runAction(sequence);160			yezi.runAction(sequence.clone());161			yezi1.runAction(sequence.clone());162			yezi2.runAction(sequence.clone());163		}164		165		var background = cc.Sprite.createWithSpriteFrameName("mainbg.png");166		background.setPosition(cc.p(this.getSize().width/2, this.getSize().height/2));167		this.addChild(background, 0);168		169		var protectedLuobo = cc.Sprite.createWithSpriteFrameName("mainbg_CN.png");170		protectedLuobo.setPosition(cc.p(this.getSize().width/2, this.getSize().height/2));171		this.addChild(protectedLuobo, 10);172		173		cc.log(this.getSize().width+"  "+this.getSize().height);174	}175});176LuoBoMainScene.createScene = function()177{178	var mains = new LuoBoMainScene();179	var scene = new BaseScene();180	scene.addChild(mains);181	return scene;...

Full Screen

Full Screen

AList.js

Source:AList.js Github

copy

Full Screen

...20  }21  return index;22};23Alist.prototype.addStart = function(digit) {24  for (let index = this.getSize(); index > 0; index--) {25    this.arr[index] = this.arr[index - 1];26  }27  this.arr[0] = digit;28  return this.arr;29};30Alist.prototype.addEnd = function(digit) {31  this.arr[this.getSize()] = digit;32  return this.arr;33};34Alist.prototype.delStart = function() {35  let delstar=this.arr[0];36  for (let i = 0; i < this.getSize() - 1; i++) {37    this.tempar[i] = this.arr[i + 1];38  }39  this.arr = this.tempar;40  this.tempar = [];41  //return this.arr;42  return delstar;43};44Alist.prototype.delEnd = function() {45let delend=this.arr[this.getSize()-1];46  for (let i = 0; i < this.getSize() - 1; i++) {47    this.tempar[i] = this.arr[i];48  }49  this.arr = this.tempar;50  this.tempar = [];51  return delend;52};53Alist.prototype.delPos = function(index) {54  let delpos=this.arr[index];55  if (index == 0) {56    return this.delStart();57  } else if (index == this.getSize() - 1) {58    return this.delEnd();59  } else if (index > this.getSize() - 1) {60    console.log("Thiss Index not array");61    return "Thiss Index not array";62  } else {63    for (let n = 0; n < index; n++) {64      this.tempar1[n] = this.arr[n];65    }66    for (let d = index; d < this.getSize() - 1; d++) {67      this.tempar1[d] = this.arr[d + 1];68    }69    this.arr = this.tempar1;70    this.tempar1 = [];71    return delpos;72  }73};74Alist.prototype.getIndex = function(index) {75  for (let i = 0; i < this.getSize(); i++) {76    if (i == index) {77      return this.arr[index];78    }79  }80  return undefined;81};82Alist.prototype.setIndex = function(index, value) {83  //let temp = [];84  if (index <= this.getSize() - 1) {85    86    87      for (let i= this.getSize(); i  > index; i--) {88        this.arr[i]=this.arr[i-1];89        90      }91      this.arr[index]=value;92    93  } else {94    // // если запись в большую длинну95    // for (let i = 0; i < index + 1; i++) {96    //   if (i < this.getSize()) {97    //     temp[i] = this.arr[i];98    //   } else temp[i] = 0;99    // }100    // temp[index] = value;101    // this.arr = temp;102    return 'error index ';103  }104  return this.arr;105};106Alist.prototype.myToString = function() {107  let mystring = this.arr[0] + "";108  for (let index = 1; index < this.getSize(); index++) {109    mystring += +"" + this.arr[index] + "";110  }111  return mystring;112};113// к заданию не относится114// Alist.prototype.getClear = function() {115//   let element = this.defaultArray[0] + " ";116//   for (let i = 1; typeof this.defaultArray[i]=='number'; i++) {117//     element += +" " + this.defaultArray[i] + " ";118//   }119//   return element;120// };121Alist.prototype.Clear=function(){122  this.arr=[];123  this.arr = this.defaultArray;124  return this.arr;125}126Alist.prototype.getMin = function() {127  let min = this.arr[0];128  for (let i = 1; i < this.getSize(); i++) {129    if (this.arr[i] < min) {130      min = this.arr[i];131    }132  }133  return min;134};135Alist.prototype.getMax = function() {136  let max = this.arr[0];137  for (let i = 1; i < this.getSize(); i++) {138    if (this.arr[i] > max) {139      max = this.arr[i];140    }141  }142  return max;143};144Alist.prototype.sort = function() {145  for (let i = 0; i < this.getSize() - 1; i++) {146    for (let j = i + 1; j < this.getSize(); j++) {147      if (this.arr[i] > this.arr[j]) {148        let temp = this.arr[i];149        this.arr[i] = this.arr[j];150        this.arr[j] = temp;151      }152    }153  }154  return this.arr;155};156Alist.prototype.getMinIndex = function() {157  let min = this.arr[0];158  let index = 0;159  for (let i = 1; i < this.getSize(); i++) {160    if (this.arr[i] < min) {161      min = this.arr[i];162      index = i;163    }164  }165  return index;166};167Alist.prototype.getMaxIndex = function() {168  let max = this.arr[0];169  let index = 0;170  for (let i = 1; i < this.getSize(); i++) {171    if (this.arr[i] > max) {172      max = this.arr[i];173      index = i;174    }175  }176  return index;177};178Alist.prototype.getRevers = function() {179  for (let index = 0; index < parseInt(this.getSize() / 2); index++) {180    let temp = this.arr[index];181    this.arr[index] = this.arr[this.getSize() - index - 1];182    this.arr[this.getSize() - index - 1] = temp;183  }184  return this.arr;185};186Alist.prototype.getHalfRevers = function() {187  for (let i = 0; i < parseInt(this.getSize() / 4); i++) {188    const temp = this.arr[i];189    this.arr[i] = this.arr[parseInt(this.getSize() / 2 - i - 1)];190    this.arr[parseInt(this.getSize() / 2 - i - 1)] = temp;191  }192  let count = 0;193  for (194    let i1 = parseInt(this.getSize() / 2);195    i1 < parseInt(this.getSize() / 2) + parseInt(this.getSize() / 4);196    i1++197  ) {198    if (this.getSize() % 2 == 0) {199      const element = this.arr[i1];200      this.arr[i1] = this.arr[this.getSize() - count - 1];201      this.arr[this.getSize() - count - 1] = element;202      count++;203    } else {204      const element = this.arr[i1 + 1];205      this.arr[i1 + 1] = this.arr[this.getSize() - count - 1];206      this.arr[this.getSize() - count - 1] = element;207      count++;208    }209  }210  return this.arr;211};...

Full Screen

Full Screen

InputDialog.js

Source:InputDialog.js Github

copy

Full Screen

...42        this.textInput.blur();43        super.dismiss(callback);44    }45    renderContent() {46        return <View style={{width: this.mScreenWidth, backgroundColor: '#f8f8f8', marginBottom: this.getSize(0)}}>47            <View style={{48                width: this.mScreenWidth, height: this.getSize(50),49                flexDirection: 'row', paddingLeft: this.getSize(10),50                justifyContent: 'center', alignItems: 'center'51            }}>52                <TouchableOpacity53                    onPress={() => this.dismiss(this.props.onCoverPress)}54                    style={{55                        position: 'absolute', left: this.getSize(10),56                        height: this.getSize(40), flexDirection: 'row',57                        justifyContent: 'center', alignItems: 'center', marginLeft: this.getSize(5)58                    }}>59                    <Text style={{60                        fontSize: this.props.cancelSize,61                        color: this.props.cancelColor,62                        marginLeft: this.getSize(5)63                    }}>{this.props.cancelText}</Text>64                </TouchableOpacity>65                <Text style={{66                    position: 'absolute',67                    fontSize: this.props.titleSize,68                    color: this.props.titleColor,69                    fontWeight: '600'70                }}>{this.props.title}</Text>71            </View>72            <TextInput ref={ref => this.textInput = ref}73                       style={{74                           width: this.getSize(345),75                           marginLeft: this.getSize(15),76                           height: this.getSize(100),77                           color: '#333333',78                           fontSize: this.getSize(14),79                           borderWidth: 1,80                           borderColor: '#E8EEF0',81                           backgroundColor: '#ffffff',82                           borderRadius: this.getSize(4),83                           paddingLeft: this.getSize(15),84                           paddingRight: this.getSize(15),85                           paddingTop: this.getSize(10),86                       }}87                       numberOfLines={4}88                       multiline={true}89                       value={this.state.text}90                       underlineColorAndroid={'transparent'}91                       placeholder={this.props.placeholder}92                       placeholderTextColor='#999999'93                       onChangeText={(text) => {94                           this.inputText = text;95                           this.setState({96                               inputText: text,97                           });98                       }}/>99            <View style={{100                flexDirection: 'row',101                width: this.mScreenWidth,102                height: this.getSize(48),103                paddingRight: this.getSize(15),104                paddingLeft: this.getSize(15),105                marginBottom: this.getSize(30),106                justifyContent: 'space-between',107                alignItems: 'center'108            }}>109                <Text style={{110                    color: this.state.inputText.length > this.props.maxSize ? 'red' : '#999999',111                    fontSize: 14112                }}>{this.state.inputText.length}/{this.props.maxSize}{this.state.inputText.length > this.props.maxSize ? '  最多输入' + this.props.maxSize + '个字符' : ''}</Text>113                <TouchableOpacity114                    onPress={() => this.state.inputText.length <= this.props.maxSize && this.dismiss(() => {115                        this.props.onSubmit && this.props.onSubmit(this.inputText);116                    })}117                    style={{118                        width: this.getSize(60), height: this.getSize(28),119                        justifyContent: 'center', alignItems: 'center',120                        backgroundColor: this.props.btnBgColor, borderRadius: this.getSize(4)121                    }}>122                    <Text style={{123                        fontSize: this.props.btnTextSize,124                        color: this.props.btnTextColor125                    }}>{this.props.btnText}</Text>126                </TouchableOpacity>127            </View>128            <KeyboardSpacer/>129        </View>130    }131}...

Full Screen

Full Screen

canvas.js

Source:canvas.js Github

copy

Full Screen

...23        this.canvas.style.position = "absolute";24        this.ctx = this.canvas.getContext("2d");25        switch (this.options.direction) {26            case 'left':27                this.canvas.style.top = `${this.getSize().top + (this.getSize().height / 2) - (this.canvas.height / 2)}px`;28                this.canvas.style.left = `${this.getSize().left - this.canvas.width}px`;29                this.emitterX = this.canvas.width - 20;30                this.emitterY = this.canvas.height / 2;31                break;32            case 'right':33                this.canvas.style.top = `${this.getSize().top + (this.getSize().height / 2) - (this.canvas.height / 2)}px`;34                this.canvas.style.left = `${this.getSize().left + this.getSize().width}px`;35                this.emitterX = 0;36                this.emitterY = this.canvas.height / 2;37                break;38            case 'top':39            default:40                this.canvas.style.top = `${this.getSize().top - this.canvas.height}px`;41                this.canvas.style.left = `${this.getSize().left + (this.getSize().width / 2) - (this.canvas.width / 2)}px`;42                this.emitterX = this.canvas.width / 2;43                this.emitterY = this.canvas.height - 20;44        }45        this.maxLifeTime = Math.min(5000, (this.canvas.height / (1.5 * 60) * 1000));46        this.minSpawnTime = this.options.minSpawnTime;47        this.onResize = (e) => {48            self.resize(e);49        }50        window.addEventListener('resize', debounce(this.onResize, 200), true);51        document.body.appendChild(this.canvas);52    }53    getCanvas() {54        this.canvas;55    }56    spawn() {57        if (this.options.timeout && (new Date().getTime() > this.startTime + this.options.timeout)) {58            if (!this.parts.length) {59                this.destroy();60            }61            return;62        }63        if (new Date().getTime() > this.lastTime + this.minSpawnTime) {64            this.lastTime = new Date().getTime();65            this.parts.push(new Smoke(this.emitterX, this.emitterY, this.maxLifeTime, this.options.direction));66        }67    }68    render() {69        let self = this;70        var len = this.parts.length;71        this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);72        while (len--) {73            if (this.parts[len].y < 0 || this.parts[len].lifeTime > this.maxLifeTime) {74                this.parts.splice(len, 1);75            } else {76                this.parts[len].update();77                this.ctx.save();78                var offsetX = -this.parts[len].size / 2,79                    offsetY = -this.parts[len].size / 2;80                this.ctx.translate(this.parts[len].x - offsetX, this.parts[len].y - offsetY);81                this.ctx.rotate(this.parts[len].angle / 180 * Math.PI);82                this.ctx.globalAlpha = this.parts[len].alpha;83                this.ctx.drawImage(this.image, offsetX, offsetY, this.parts[len].size, this.parts[len].size);84                this.ctx.restore();85            }86        }87        this.spawn();88        if (len) {89            requestAnimationFrame(() => {90                self.render();91            });92        }93    }94    getSize() {95        return {96            top: this.element.getBoundingClientRect().top + window.scrollY,97            left: this.element.getBoundingClientRect().left + window.scrollX,98            height: this.element.offsetHeight,99            width: this.element.offsetWidth100        }101    }102    resize() {103        console.log('resizing', this.getSize());104        switch (this.options.direction) {105            case 'left':106                this.canvas.style.top = `${this.getSize().top + (this.getSize().height / 2) - (this.canvas.height / 2)}px`;107                this.canvas.style.left = `${this.getSize().left - this.canvas.width}px`;108                break;109            case 'right':110                this.canvas.style.top = `${this.getSize().top + (this.getSize().height / 2) - (this.canvas.height / 2)}px`;111                this.canvas.style.left = `${this.getSize().left + this.getSize().width}px`;112                break;113            case 'top':114            default:115                this.canvas.style.top = `${this.getSize().top - this.canvas.height}px`;116                this.canvas.style.left = `${this.getSize().left + (this.getSize().width / 2) - (this.canvas.width / 2)}px`;117        }118    }119    destroy() {120        document.body.removeChild(this.canvas);121        window.removeEventListener('resize', this.onResize);122    }...

Full Screen

Full Screen

DownloadDialog.js

Source:DownloadDialog.js Github

copy

Full Screen

...36    }37    renderContent() {38        return <Animated.View39            style={{40                width: this.getSize(307),41                backgroundColor: '#ffffff', borderRadius: this.getSize(5),42                marginBottom: this.getSize(30),43            }}>44            <Text style={{45                marginTop: this.getSize(15), marginLeft: this.getSize(15),46                color: this.props.titleColor, fontSize: this.props.titleSize47            }}>{this.props.title}</Text>48            <View style={{49                justifyContent: 'center',50                alignItems: 'center', marginTop: this.getSize(25)51            }}>52                <View style={{ width: this.getSize(280), height: 4, borderRadius: 2, backgroundColor: '#d3d3d3' }} />53                <Animated.View style={{54                    width: this.process.interpolate({55                        inputRange: [0, 1],56                        outputRange: [0, this.getSize(280)]57                    }), height: 4, borderRadius: 2,58                    backgroundColor: '#1097D5',59                    position: 'absolute', left: this.getSize((307 - 280) / 2)60                }} />61            </View>62            <Text style={{63                paddingRight: this.getSize(12), textAlign: 'right', width: this.getSize(307),64                marginTop: this.getSize(5), marginBottom: this.getSize(15),65                color: this.props.totalTextColor, height: this.props.totalTextSize,66                fontSize: this.props.totalTextSize, lineHeight: this.props.totalTextSize67            }}>68                {this.state.total}69            </Text>70            <View style={{ width: this.getSize(307), height: this.mOnePixel, backgroundColor: '#e6e6e6' }} />71            <View style={{72                width: this.getSize(307), height: this.getSize(40),73                justifyContent: 'center', alignItems: 'center',74                flexDirection: 'row',75            }}>76                <TouchableOpacity77                    onPress={() => {78                        if (this.props.active) {79                            this.dismiss(() => {80                                this.process.setValue(0);81                                this.props.active = false;82                                this.props.onAction && this.props.onAction()83                            });84                        }85                    }}86                    style={{87                        width: this.getSize(307), height: this.getSize(40),88                        alignItems: 'center', justifyContent: 'center',89                    }}>90                    <Text style={{ color: '#1097D5', fontSize: this.getSize(16), opacity: this.props.active ? 1 : 0.5 }}>{this.props.actionText}</Text>91                </TouchableOpacity>92            </View>93        </Animated.View >94    }95}...

Full Screen

Full Screen

SimpleChooseDialog.js

Source:SimpleChooseDialog.js Github

copy

Full Screen

...38                    this.setState({ seleted: index })39                }}40                key={this.key ? item[this.key] : item}41                style={{42                    paddingLeft: this.getSize(20), paddingRight: this.getSize(20),43                    width: this.getSize(307), height: this.getSize(49),44                    justifyContent: 'flex-start', alignItems: 'center', flexDirection: 'row'45                }}>46                <View style={{47                    width: this.props.pointSize, height: this.props.pointSize,48                    justifyContent: 'center', alignItems: 'center', marginRight: this.getSize(20),49                    borderRadius: this.props.pointBorderRadius, borderWidth: 1,50                    borderColor: this.state.seleted == index ? this.props.selectColor : this.props.normalColor,51                }}>52                    {this.state.seleted == index ? <View style={{53                        width: this.props.pointSize * 0.6, height: this.props.pointSize * 0.6,54                        borderRadius: this.props.pointBorderRadius * 0.6,55                        backgroundColor: this.props.selectColor56                    }} /> : null}57                </View>58                <Text style={[this.props.itemStyle, this.state.seleted == index ? { color: this.props.selectColor } : {}]}>{typeof item == 'string' ? item : item[this.props.itemKey]}</Text>59            </TouchableOpacity>60        })61    }62    _getContentPosition() {63        return { justifyContent: 'center', alignItems: 'center' }64    }65    renderContent() {66        return <View style={{ width: this.getSize(307), backgroundColor: '#ffffff', borderRadius: this.getSize(5), alignItems: 'center', paddingTop: this.getSize(10) }}>67            {this.renderItems()}68            <TouchableOpacity69                onPress={() => {70                    this.dismiss(() => {71                        if (this.props.onPress) {72                            this.props.onPress(this.state.seleted != null ? this.state.seleted : -1);73                        }74                    });75                }}76                style={{77                    width: this.getSize(200), height: this.getSize(44),78                    backgroundColor: this.props.confirmBtnColor, borderRadius: this.getSize(5),79                    justifyContent: 'center', alignItems: 'center', marginTop: this.getSize(13), marginBottom: this.getSize(20)80                }}>81                <Text style={{ color: this.props.confirmTextColor, fontSize: this.getSize(16), fontWeight: '400' }}>{this.props.confirmText}</Text>82            </TouchableOpacity>83        </View >84    }85}...

Full Screen

Full Screen

AlertDialog.js

Source:AlertDialog.js Github

copy

Full Screen

...25        return { justifyContent: 'center', alignItems: 'center' }26    }27    renderContent() {28        return <View style={{29            height: this.getSize(150), width: this.getSize(307),30            backgroundColor: '#ffffff', borderRadius: this.getSize(6)31        }}>32            <View style={{33                width: this.getSize(307), flex: 1, paddingLeft: this.getSize(15), paddingRight: this.getSize(15),34                justifyContent: 'center', alignItems: 'center'35            }}>36                <Text style={{37                    fontSize: this.props.messageTextSize, fontWeight: '100', color: this.props.messageTextColor,38                    lineHeight: this.getSize(20), textAlign: 'center',39                }}>{this.props.messageText}</Text>40            </View>41            <View style={{ width: this.getSize(307), height: 0.5, backgroundColor: '#e6e6e6' }} />42            <View style={{43                height: this.getSize(45),44                width: this.getSize(307),45                justifyContent: 'center',46                alignItems: 'center',47                flexDirection: 'row',48            }}>49                <TouchableOpacity50                    onPress={() => {51                        this.dismiss(() => {52                            if (this.props.onPress) {53                                this.props.onPress(true);54                            }55                        });56                    }}57                    style={{58                        flex: 1, height: this.getSize(45),59                        alignItems: 'center', justifyContent: 'center'60                    }}>61                    <Text style={{ color: this.props.positiveColor, fontSize: this.props.positiveSize }}>62                        {this.props.positiveText}63                    </Text>64                </TouchableOpacity>65                <View style={{66                    height: this.getSize(28), width: this.mOnePixel, backgroundColor: '#e6e6e6'67                }} />68                <TouchableOpacity69                    onPress={() => {70                        this.dismiss(() => {71                            if (this.props.onPress) {72                                this.props.onPress(false);73                            }74                        });75                    }}76                    style={{77                        flex: 1, height: this.getSize(45),78                        alignItems: 'center', justifyContent: 'center'79                    }}>80                    <Text style={{ color: this.props.negativeColor, fontSize: this.props.negativeSize }}>{this.props.negativeText}</Text>81                </TouchableOpacity>82            </View>83        </View >84    }85}...

Full Screen

Full Screen

Array.js

Source:Array.js Github

copy

Full Screen

...11	toString() { return this._data; }12	getSize() { return this._data.length; }13	isEmpty() { return !!this._data.length; }14	addFirst(elm) { return this.add(0, elm); }15	addLast(elm) { return this.add(this.getSize(), elm); }16	add(index, elm) {17		const size = this.getSize() + 1;18		if( index < 0 || index >= size ) throw this.error('Add failed. Require index >=0 and index <= size.');19		this._data.splice(index, 0, elm);20	}21	getFirst() { return this.get(0); }22	getLast(){ return this.get(this.getSize() - 1); }23	get(index) {24		const size = this.getSize();25		if( index < 0 || index >= size ) throw this.error('Get failed. Index is illegal.');26		return this._data[index];27	}28	29	set(index, elm) {30		const size = this.getSize();31		if( index < 0 || index >= size ) throw this.error('Set failed. Index is illegal.');32		this._data[index] = elm;33	}34	find(elm) {35		const size = this.getSize();36		for( let i = 0; i < size; i++ ) {37			if( this._data[i] === elm ) return i;38		}39		return -1;40	}41	contains(elm) {42		const size = this.getSize();43		for( let i = 0; i < size; i++ ) {44			if( this._data[i] === elm ) return true;45		}46		return false;47	}48	removeFirst() { return this.remove(0); }49	removeLast() { return this.remove(this.getSize()-1); }50	remove(index) {51		const size = this.getSize();52		if( index < 0 || index >= size ) throw this.error('Remove failed. Index is illegal.');53		return this._data.splice(index, 1);54	}55	removeElement(elm) {56		const index = this.find(elm);57		if( index === -1 ) return false;58		this.remove(index);59		return true;60	}61	swap(i, j) {62		const tmp = this._data[i];63		this._data[i] = this._data[j];64		this._data[j] = tmp;65	}...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const wdio = require('webdriverio');2const assert = require('assert');3const opts = {4    capabilities: {5    }6};7async function main() {8    const client = await wdio.remote(opts);9    await client.pause(2000);10    const size = await client.execute('return this.getSize()');11    console.log(size);12    await client.deleteSession();13}14main();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { remote } = require('webdriverio');2(async () => {3    const browser = await remote({4        capabilities: {5        }6    });7    await browser.url('

Full Screen

Using AI Code Generation

copy

Full Screen

1var size = driver.getSize();2console.log(size);3var size = driver.getSize();4console.log(size);5var size = driver.getSize();6console.log(size);7var size = driver.getSize();8console.log(size);9var size = driver.getSize();10console.log(size);11var size = driver.getSize();12console.log(size);13var size = driver.getSize();14console.log(size);15var size = driver.getSize();16console.log(size);17var size = driver.getSize();18console.log(size);19var size = driver.getSize();20console.log(size);21var size = driver.getSize();22console.log(size);23var size = driver.getSize();24console.log(size);25var size = driver.getSize();26console.log(size);27var size = driver.getSize();28console.log(size);29var size = driver.getSize();30console.log(size);31var size = driver.getSize();32console.log(size);33var size = driver.getSize();34console.log(size);35var size = driver.getSize();36console.log(size);37var size = driver.getSize();38console.log(size);39var size = driver.getSize();40console.log(size);41var size = driver.getSize();42console.log(size);

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var options = {3  desiredCapabilities: {4  }5};6  .remote(options)7  .init()8  .element('accessibility id', 'Your Element')9  .getSize()10  .then(function(size) {11    console.log(size);12  })13  .end();

Full Screen

Using AI Code Generation

copy

Full Screen

1commands.getSize = async function (strategy, selector) {2  const el = await this.findNativeElementOrElements(strategy, selector, false);3  const size = await this.proxyCommand(`/element/${el}/size`, 'GET');4  return size;5};6commands.getSize = async function (strategy, selector) {7  const el = await this.findNativeElementOrElements(strategy, selector, false);8  const size = await this.proxyCommand(`/element/${el}/size`, 'GET');9  return size;10};11commands.getSize = async function (strategy, selector) {12  const el = await this.findNativeElementOrElements(strategy, selector, false);13  const size = await this.proxyCommand(`/element/${el}/size`, 'GET');14  return size;15};16commands.getSize = async function (strategy, selector) {17  const el = await this.findNativeElementOrElements(strategy, selector, false);18  const size = await this.proxyCommand(`/element/${el}/size`, 'GET');19  return size;20};21commands.getSize = async function (strategy, selector) {22  const el = await this.findNativeElementOrElements(strategy, selector, false);23  const size = await this.proxyCommand(`/element/${el}/size`, 'GET');24  return size;25};26commands.getSize = async function (strategy, selector) {27  const el = await this.findNativeElementOrElements(strategy, selector, false);28  const size = await this.proxyCommand(`/element/${el}/size`, 'GET');29  return size;30};31commands.getSize = async function (strategy, selector) {32  const el = await this.findNativeElementOrElements(strategy, selector, false);33  const size = await this.proxyCommand(`/element/${el}/size`, 'GET');34  return size;35};

Full Screen

Using AI Code Generation

copy

Full Screen

1const wd = require('wd');2const assert = require('assert');3const {execSync} = require('child_process');4const {exec} = require('child_process');5const PORT = 4723;6const driver = wd.promiseChainRemote('localhost', PORT);7async function main() {8    try {9        const desiredCaps = {10        };11        await driver.init(desiredCaps);12        await driver.sleep(5000);13        const size = await driver.getSize();14        console.log(size);15    } catch (e) {16        console.log(e);17    }18}19main();20const wd = require('wd');21const assert = require('assert');22const {execSync} = require('child_process');23const {exec} = require('child_process');24const PORT = 4723;25const driver = wd.promiseChainRemote('localhost', PORT);26async function main() {27    try {28        const desiredCaps = {29        };30        await driver.init(desiredCaps);31        await driver.sleep(5000);32        const size = await driver.getSize();33        console.log(size);34    } catch (e) {35        console.log(e);36    }37}38main();

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var config = {4};5var driver = wd.promiseChainRemote('localhost', 4723);6  .init(config)7  .getWindowSize()8  .then(function (size) {9    console.log('width: ' + size.width + ', height: ' + size.height);10  })11  .quit();

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