How to use el1.text method in Appium Xcuitest Driver

Best JavaScript code snippet using appium-xcuitest-driver

sample_steps.js

Source:sample_steps.js Github

copy

Full Screen

...9495await delay(2000);96let el1 = await driver.elementByXPath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View/android.view.View[1]/android.view.View/android.view.View/android.view.View/android.view.View[2]/android.view.View/android.view.View/android.view.View/android.view.View/android.view.View");9798//console.log(await el1.text());99100//try{101assert.equal(await el1.text(), text);102//}103//catch(error){104105//console.log("expected = " + text +" Actual = " +await el1.text());106107//}108109});110111112When('the contant should equal to {string}', async function (value) {113 // Write code here that turns the phrase above into concrete actions114115 let driver = await wd.promiseChainRemote('localhost',4723)116117118119120//const wd = require('wd');121//const driver = wd.promiseChainRemote('localhost',4723)122123124125126var desiredCaps = {127 deviceName: 'Bader',128 platformName: 'Android',129 platformVersion: '5.0.2',130 app:'//Users//Shared//Jenkins//Home//workspace//Install_dependencies//platforms//android//app//build//outputs//apk//debug//app-debug.apk',131 appPackage:'io.ionic.starter',132 autoGrantPermissions:true,133 unicodeKeyboard:true,134 resetKeyboard:true135};136 137 138await driver.init(desiredCaps);139await delay(5000);140141142//await driver.setImplicitWaitTimeout(10000);143144//let el1 = await driver.elementById('parid');145//let element = await driver.elements("id", "paridd");146//let elementsOne = await driver.elementsByName("elementpar");147//let el1 = await driver.findElements(By.id("io.ionic.starter:id/parid"))148let el1 = await driver.elementById("parid");149//let elementsOne = await driver.elementByXpath('/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View/android.view.View/android.view.View/android.view.View[2]/android.view.View/android.view.View');150151console.log(await el1.text());152assert.equal(await el1.text(), value);153154 155156});157158Given('the contant', async function () {159160 let driver = await wd.promiseChainRemote('localhost',4722)161162 // Write code here that turns the phrase above into concrete actions163164165var desiredCaps = {166 deviceName: 'Nokia 6.1',167 platformName: 'Android',168 platformVersion: '9',169 app:'//Users//Shared//Jenkins//Home//workspace//Install_dependencies//platforms//android//app//build//outputs//apk//debug//app-debug.apk',170 appPackage:'io.ionic.starter',171 autoGrantPermissions:true,172 unicodeKeyboard:true,173 resetKeyboard:true174};175 176 177await driver.init(desiredCaps);178await delay(10000);179//await driver.setImplicitWaitTimeout(10000);180181//let el1 = await driver.elementById('parid');182//let element = await driver.elements("id", "paridd");183//let elementsOne = await driver.elementsByName("elementpar");184//let el1 = await driver.findElements(By.id("io.ionic.starter:id/parid"))185//let el1 = await driver.elementById("parid");186//let elementsOne = await driver.elementByXpath('/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View/android.view.View/android.view.View/android.view.View[2]/android.view.View/android.view.View');187188//console.log(await el1.text());189//assert.equal(await el1.text(), value);190191 192193});194195196Given('the contant should equal II to {string}', async function (value) {197 // Write code here that turns the phrase above into concrete actions198 var assert= require ('assert')199 var x = "Hello CICDD";200 assert.equal(x, value);201202203});

Full Screen

Full Screen

functions.js

Source:functions.js Github

copy

Full Screen

1function validateForm() {2 var nombre = document.forms["form-bvirtual"]["nombre"].value;3 var apellidos = document.forms["form-bvirtual"]["apellidos"].value;4 var email = document.forms["form-bvirtual"]["email"].value;5 var repeat_email = document.forms["form-bvirtual"]["repeat-email"].value;6 var dni = document.forms["form-bvirtual"]["dni"].value;7 var movil = document.forms["form-bvirtual"]["movil"].value;8 var flag_error = false;9 //nombre10 if (nombre == "") {11 const el = document.querySelector('#nombre');12 if (!el.classList.contains("error-input")) {13 el.classList.add("error-input");14 }15 const el1 = document.querySelector('#error-nombre');16 el1.textContent = "Nombre no puede estar en blanco.";17 flag_error = true;18 } else {19 const el = document.querySelector('#nombre');20 if (el.classList.contains("error-input")) {21 el.classList.remove("error-input");22 }23 const el1 = document.querySelector('#error-nombre');24 el1.textContent = "";25 }26 //apellidos27 if (apellidos == "") {28 el = document.querySelector('#apellidos');29 if (!el.classList.contains("error-input")) {30 el.classList.add("error-input");31 }32 el1 = document.querySelector('#error-apellidos');33 el1.textContent = "Apellidos no puede estar en blanco.";34 flag_error = false;35 } else {36 el = document.querySelector('#apellidos');37 if (el.classList.contains("error-input")) {38 el.classList.remove("error-input");39 }40 el1 = document.querySelector('#error-apellidos');41 el1.textContent = "";42 }43 //email44 if ((email == "" || repeat_email == "") || email != repeat_email) {45 el = document.querySelector('#email');46 if (!el.classList.contains("error-input")) {47 el.classList.add("error-input");48 }49 el1 = document.querySelector('#repeat-email');50 if (!el1.classList.contains("error-input")) {51 el1.classList.add("error-input");52 }53 var f = false;54 if (email == "") {55 el2 = document.querySelector('#error-email');56 el2.textContent = "Email no puede estar en blanco.";57 f = true;58 }59 if (repeat_email == "") {60 el3 = document.querySelector('#error-repeat-email');61 el3.textContent = "La repetición del email no puede estar en blanco.";62 f = true;63 }64 if ((email != repeat_email) && f == false) {65 el2 = document.querySelector('#error-email');66 el2.textContent = "El email y la repetición tienen que coincidir.";67 el3 = document.querySelector('#error-repeat-email');68 el3.textContent = "";69 }70 flag_error = true;71 } else {72 var emailRegex = /^[-\w.%+]{1,64}@(?:[A-Z0-9-]{1,63}\.){1,125}[A-Z]{2,63}$/i;73 if (!emailRegex.test(email)) {74 el2 = document.querySelector('#error-email');75 el2.textContent = "El email y la repetición tienen que llevar @ y .xxx.";76 el3 = document.querySelector('#error-repeat-email');77 el3.textContent = "";78 flag_error = true;79 } else {80 el = document.querySelector('#email');81 if (el.classList.contains("error-input")) {82 el.classList.remove("error-input");83 }84 el1 = document.querySelector('#repeat-email');85 if (el1.classList.contains("error-input")) {86 el1.classList.remove("error-input");87 }88 el2 = document.querySelector('#error-email');89 el2.textContent = "";90 el3 = document.querySelector('#error-repeat-email');91 el3.textContent = "";92 }93 }94 //dni95 if (dni == "") {96 const el = document.querySelector('#dni');97 if (!el.classList.contains("error-input")) {98 el.classList.add("error-input");99 }100 const el1 = document.querySelector('#error-dni');101 el1.textContent = "Dni no puede estar en blanco.";102 flag_error = true;103 } else {104 var result = nif(dni);105 if (result != "") {106 const el = document.querySelector('#dni');107 if (!el.classList.contains("error-input")) {108 el.classList.add("error-input");109 }110 const el1 = document.querySelector('#error-dni');111 el1.textContent = result;112 flag_error = true;113 } else {114 el1 = document.querySelector('#dni');115 if (el1.classList.contains("error-input")) {116 el1.classList.remove("error-input");117 }118 el2 = document.querySelector('#error-dni');119 el2.textContent = "";120 }121 }122 //movil123 if (movil == "") {124 const el = document.querySelector('#movil');125 if (!el.classList.contains("error-input")) {126 el.classList.add("error-input");127 }128 const el1 = document.querySelector('#error-movil');129 el1.textContent = "Movil no puede estar en blanco.";130 flag_error = true;131 } else {132 var expresion_regular_movil = /^[6-7]{1}[0-9]{8}$/;133 if(expresion_regular_movil.test(movil) == true){134 el1 = document.querySelector('#movil');135 if (el1.classList.contains("error-input")) {136 el1.classList.remove("error-input");137 }138 el2 = document.querySelector('#error-movil');139 el2.textContent = "";140 } else {141 const el = document.querySelector('#movil');142 if (!el.classList.contains("error-input")) {143 el.classList.add("error-input");144 }145 const el1 = document.querySelector('#error-movil');146 el1.textContent = "Movil no válido, tiene que ser 9 dígitos y empezar por 6 o 7.";147 flag_error = true;148 }149 }150 //Comprobar que hay error para mostrarlo por pantalla y que no cambie de pantalla.151 if (flag_error == true) {152 return false;153 }154 //ajax155 if (flag_error == false) {156 var request = new XMLHttpRequest();157 request.open('POST', '/', true);158 request.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');159 request.onreadystatechange = function() {160 if (xhr.readyState == XMLHttpRequest.DONE) {161 // Peticion terminada.162 if (request.status == 200) {163 // Todo salio bien164 console.log(request.response);165 } else {166 // Hubo un problema167 }168 }169 }170 var formData = new FormData(document.getElementById('form-bvirtual'));171 request.send(formData);172 }173}174function nif(dni) {175 var numero176 var letr177 var letra178 var expresion_regular_dni179 180 expresion_regular_dni = /^\d{8}[a-zA-Z]$/;181 182 if(expresion_regular_dni.test (dni) == true){183 numero = dni.substr(0,dni.length-1);184 letr = dni.substr(dni.length-1,1);185 numero = numero % 23;186 letra='TRWAGMYFPDXBNJZSQVHLCKET';187 letra=letra.substring(numero,numero+1);188 if (letra!=letr.toUpperCase()) {189 return 'Dni erroneo, la letra del NIF no se corresponde';190 }else{191 return "";192 }193 }else{194 return 'Dni erroneo, formato no válido';195 }...

Full Screen

Full Screen

Template.test.js

Source:Template.test.js Github

copy

Full Screen

1let NodeType = require('nelm-parser').NodeType;2let Template = require('../dist/Template').default;3test('simple template', () => {4 expect(new Template(`5 #block16 b {7 'text'8 }9 `).render()).toBe('<b>text</b>');10});11test('element name', () => {12 expect(new Template(`13 #block114 b/el1 {15 'text'16 }17 `).render()).toBe('<b class="block1__el1">text</b>');18});19test('multiple element names', () => {20 expect(new Template(`21 #block122 b/name1, name223 `).render()).toBe('<b class="block1__name1 block1__name2"></b>');24});25test('multiple element names (2)', () => {26 expect(new Template(`27 #block128 b/, name1, name229 `).render()).toBe('<b class="block1__name1 block1__name2"></b>');30});31test('override element tagName', () => {32 let t1 = new Template(`33 #block134 b/el1 {35 'text'36 }37 br38 `);39 expect(t1.extend(`40 #block1-x41 i/el1 {42 'text'43 }44 `).render()).toBe('<i class="block1-x__el1 block1__el1">text</i><br>');45});46test('override element content', () => {47 let t1 = new Template(`48 #block149 b/el1 {50 'text'51 }52 br53 `);54 expect(t1.extend(`55 #block1-x56 b/el1 {57 'other text'58 }59 `).render()).toBe('<b class="block1-x__el1 block1__el1">other text</b><br>');60});61test('tagName super', () => {62 let t1 = new Template(`63 #block164 b/el165 `);66 expect(t1.extend(`67 #block1-x68 /el1 {69 'text'70 }71 `).render()).toBe('<b class="block1-x__el1 block1__el1">text</b>');72});73test('tagName super super', () => {74 let t1 = new Template(`75 #block176 b/el177 `);78 let t2 = t1.extend('#block1-x');79 expect(t2.extend(`80 #block1-x-x81 /el1 {82 'text'83 }84 `).render()).toBe('<b class="block1-x-x__el1 block1-x__el1 block1__el1">text</b>');85});86test('attributes super', () => {87 let t1 = new Template(`88 #block189 b/el1 (attr1=value1, attr2=value2)90 `);91 expect(t1.extend(`92 #block1-x93 /el1 (super!)94 `).render()).toBe('<b class="block1-x__el1 block1__el1" attr1="value1" attr2="value2"></b>');95});96test('attributes super (2)', () => {97 let t1 = new Template(`98 #block199 b/el1 (attr1=value1, attr2=value2)100 `);101 expect(t1.extend(`102 #block1-x103 /el1 (super!, attr1=value0, attr3=value3)104 `).render()).toBe('<b class="block1-x__el1 block1__el1" attr1="value0" attr2="value2" attr3="value3"></b>');105});106test('class attribute super', () => {107 let t1 = new Template(`108 #block1109 b/el1 (class=_mod1)110 `);111 expect(t1.extend(`112 #block1-x113 /el1 (super!)114 `).render()).toBe('<b class="block1-x__el1 block1__el1 _mod1"></b>');115});116test('attributes super super', () => {117 let t1 = new Template(`118 #block1119 b/el1 (attr1=value1, attr2=value2)120 `);121 let t2 = t1.extend('#block1-x');122 expect(t2.extend(`123 #block1-x-x124 /el1 (super!)125 `).render()).toBe('<b class="block1-x-x__el1 block1-x__el1 block1__el1" attr1="value1" attr2="value2"></b>');126});127test('attributes super.name!', () => {128 let t1 = new Template(`129 #block1130 b/el1 (class=_mod1, attr1=value1, attr2=value2)131 b/el2 (attr3=value3, attr4=value4)132 `);133 expect(t1.extend(`134 #block1-x135 /el1 (super.el2!, class=_mod2)136 /el2 (super.el1!, class=_mod1)137 `).render()).toBe(138 '<b attr3="value3" attr4="value4" class="block1-x__el1 block1__el1 _mod2"></b><b class="block1-x__el2 block1__el2 _mod1" attr1="value1" attr2="value2"></b>'139 );140});141test('content super', () => {142 let t1 = new Template(`143 #block1144 b/el1 {145 'text'146 }147 `);148 expect(t1.extend(`149 #block1-x150 u/el1 {151 b {152 super!153 }154 }155 `).render()).toBe('<u class="block1-x__el1 block1__el1"><b>text</b></u>');156});157test('content super (2)', () => {158 let t1 = new Template(`159 #block1160 b/el1161 b/el2162 `);163 expect(t1.extend(`164 #block1-x165 i/el2 {166 super!167 }168 `).render()).toBe('<b class="block1-x__el1 block1__el1"></b><i class="block1-x__el2 block1__el2"></i>');169});170test('content super super', () => {171 let t1 = new Template(`172 #block1173 b/el1 {174 'text'175 }176 `);177 let t2 = t1.extend('#block1-x');178 expect(t2.extend(`179 #block1-x-x180 u/el1 {181 b {182 super!183 }184 }185 `).render()).toBe('<u class="block1-x-x__el1 block1-x__el1 block1__el1"><b>text</b></u>');186});187test('content super.name', () => {188 let t1 = new Template(`189 #block1190 b/el1 {191 'text'192 }193 `);194 expect(t1.extend(`195 #block1-x196 u/el1 {197 b/el2 {198 super.el1!199 }200 }201 `).render()).toBe(202 '<u class="block1-x__el1 block1__el1"><b class="block1-x__el2 block1__el2">text</b></u>'203 );204});205test('comment in attributes', () => {206 expect(new Template(`207 #block1208 b (/* comment */)209 b (attr1/* comment */=1)210 b (/* comment */attr1)211 b (attr1/* comment */, attr2)212 b (213 attr1, // comment214 /* comment */215 attr2=1216 // comment217 )218 `).render()).toBe(219 '<b></b><b attr1="1"></b><b attr1=""></b><b attr1="" attr2=""></b><b attr1="" attr2="1"></b>'220 );221});222test('helper', () => {223 Template.helpers.test = el => {224 return [225 { nodeType: NodeType.TEXT, value: '1' },226 { nodeType: NodeType.TEXT, value: '2' },227 { nodeType: NodeType.TEXT, value: '3' }228 ];229 };230 expect(new Template(`231 #block1232 b {233 @test234 }235 `).render()).toBe('<b>123</b>');236});237test('helper (2)', () => {238 Template.helpers.test = el => {239 return [240 { nodeType: NodeType.TEXT, value: '[' },241 ...el.content,242 { nodeType: NodeType.TEXT, value: ']' }243 ];244 };245 expect(new Template(`246 #block1247 b {248 @test {249 i250 }251 }252 `).render()).toBe('<b>[<i></i>]</b>');253});254test('helper super', () => {255 Template.helpers.test = el => {256 return [{257 nodeType: NodeType.ELEMENT,258 isHelper: false,259 tagName: 'b',260 names: el.names && el.names[0] ? ['$' + el.names[0], ...el.names] : el.names,261 attributes: el.attributes,262 content: null263 }];264 };265 let t1 = new Template(`266 #block1267 @test/test (attr1=value1)268 `);269 expect(t1.extend(`270 #block1-x271 @/test (super!, attr2=value2)272 `).render()).toBe(273 '<b class="block1-x__$test block1__$test block1-x__test block1__test" attr1="value1" attr2="value2"></b>'274 );275});276test('helper content super', () => {277 let t1 = new Template(`278 #block1279 @section/inner {280 b281 }282 `);283 expect(t1.extend(`284 #block1-x285 @/inner {286 u {287 super!288 }289 }290 `).render()).toBe('<u><b></b></u>');291});292test('escape sequences', () => {293 expect(new Template(`294 '_\\t_\\x20_\\u0020_'295 `).render()).toBe('_\t_\x20_\u0020_');296});297test('empty', () => {298 expect(new Template('').render()).toBe('');...

Full Screen

Full Screen

script.js

Source:script.js Github

copy

Full Screen

1"use strict";2// Selecting Elements3const payerTotalScoreEl0 = document.querySelector(".playerPointsTotal-0");4const payerTotalScoreEl1 = document.querySelector(".playerPointsTotal-1");5const playerCurrentScoreEl0 = document.querySelector(".playerPointsCurrent-0")6const playerCurrentScoreEl1 = document.querySelector(".playerPointsCurrent-1")7const newGame = document.querySelector(".new-game");8const rollDice = document.querySelector(".roll-dice");9const holdPoints = document.querySelector(".hold");10const diceImg = document.getElementById("diceImg");11const playerWontTxt0 = document.querySelector(".playerWon0");12const playerWontTxt1 = document.querySelector(".playerWon1");13const infoTextBox = document.querySelector(".info-box");14const infoTextBoxBtn = document.querySelector(".info-button");15const background = document.querySelector("body");16// Start conditions17payerTotalScoreEl0.textContent = 0;18payerTotalScoreEl1.textContent = 0;19let currentPlayer = 0;20let playerPointsCurrent0 = 0;21let playerPointsCurrent1 = 0;22let playerPointsTotal0 = 0;23let playerPointsTotal1 = 0;24let playerIsPlaying = true;25// Hiding Elements when website opened26diceImg.classList.add("hidden");27playerWontTxt0.classList.add("hidden");28playerWontTxt1.classList.add("hidden");29infoTextBox.classList.add("hidden");30// Changing player function and background of the current playing player31const changingPlayer = function () {32 currentPlayer === 0 ? currentPlayer = 1 : currentPlayer = 0;33}34const changingColor = function () {35 if (currentPlayer === 0) {36 document.querySelector(".player-box0").style.backgroundColor = "#ff7b5c"37 document.querySelector(".player-box1").style.backgroundColor = "#fab1a0"38 } else {39 document.querySelector(".player-box0").style.backgroundColor = "#fab1a0"40 document.querySelector(".player-box1").style.backgroundColor = "#ff7b5c"41 }42}43// Function for the information how to play this game44infoTextBoxBtn.addEventListener("click", function () {45 // Toggles the info box when button is clicked46 infoTextBox.classList.toggle("hidden");47})48// Function to close the InfoWindow if any key gets pressed49document.addEventListener("keydown", function () {50 infoTextBox.classList.add("hidden");51})52// Function roll the dice button53rollDice.addEventListener('click', function () {54 if (playerIsPlaying) {55 // Rolls a random number between one and six56 const randomNumber = Math.trunc(Math.random() * 6) + 1;57 // Displays the dice with the equal to the random number58 diceImg.classList.remove("hidden");59 diceImg.src = `../images/dice-${randomNumber}.png`;60 // If number smaller than 1 current score = 061 if (randomNumber === 1) {62 // Resetting the current points of the player to zero63 currentPlayer === 0 ? playerPointsCurrent0 = 0 : playerPointsCurrent1 = 0;64 // Displaying the current points of zero to the player65 currentPlayer === 0 ? playerCurrentScoreEl0.textContent = 0 : playerCurrentScoreEl1.textContent = 0;66 // Change the player and the background of the of the current playing player67 changingColor();68 // Changing to the next player69 changingPlayer();70 }71 // Else current score = current score72 if (randomNumber > 1) {73 // Evaluating the current points to the current player74 currentPlayer === 0 ? playerPointsCurrent0 += randomNumber : playerPointsCurrent1 += randomNumber;75 // Displaying the correct number to the players interface76 currentPlayer === 0 ? playerCurrentScoreEl0.textContent = playerPointsCurrent077 : playerCurrentScoreEl1.textContent = playerPointsCurrent178 }79 }80})81// Function to Hold the current points82holdPoints.addEventListener('click', function () {83 if (playerIsPlaying) {84 // Checking player0 or player1 is playing and adding current points to total points85 currentPlayer === 0 ? playerPointsTotal0 += playerPointsCurrent0 : playerPointsTotal1 += playerPointsCurrent1;86 // Displaying the total score87 currentPlayer === 0 ? payerTotalScoreEl0.textContent = playerPointsTotal088 : payerTotalScoreEl1.textContent = playerPointsTotal1;89 // Resetting the current points90 playerPointsCurrent0 = 0;91 playerPointsCurrent1 = 0;92 // Displaying the current score93 currentPlayer === 0 ? playerCurrentScoreEl0.textContent = playerPointsCurrent094 : playerCurrentScoreEl1.textContent = playerPointsCurrent1;95 // If current points more than 100 then the players win96 //need to add after win players cant play anymore97 if (playerPointsTotal0 > 99 || playerPointsTotal1 > 99) {98 playerIsPlaying = false;99 document.querySelector(`.player-box${currentPlayer}`).style.backgroundColor = "#191e1e"100 document.querySelector(`.playerWon${currentPlayer}`).classList.remove("hidden");101 } else {102 // Changing color103 changingColor();104 // Changing player105 changingPlayer();106 }107 }108})109// Function for the button for a now game110newGame.addEventListener("click", function () {111 // Resetting all values112 payerTotalScoreEl0.textContent = 0;113 payerTotalScoreEl1.textContent = 0;114 //Making sure the player which lost can roll now at first115 changingColor();116 changingPlayer();117 playerPointsCurrent0 = 0;118 playerPointsCurrent1 = 0;119 playerPointsTotal0 = 0;120 playerPointsTotal1 = 0;121 diceImg.classList.add("hidden");122 playerWontTxt0.classList.add("hidden");123 playerWontTxt1.classList.add("hidden");124 playerIsPlaying = true;...

Full Screen

Full Screen

custom.js

Source:custom.js Github

copy

Full Screen

1window.onload = function() {2 setGuests()3 setCounter()4}5function setGuests() {6 var guestId = +window.location.search.substr(4)7 var guests = guestArr[guestId] || guestArr[0]8 var dearEl = document.getElementById('dear')9 var guestEl1 = document.getElementById('guest1')10 var guestEl2 = document.getElementById('guest2')11 var guestEl3 = document.getElementById('guest3')12 var delim1 = document.getElementById('delim1')13 var delim2 = document.getElementById('delim2')14 if (guests.names.length > 1) {15 dearEl.textContent = 'Дорогие'16 for (var j=0; j < guests.names.length; j++) {17 if (j == 0 && guests.names.length === 1) {18 guestEl1.textContent = ''19 guestEl2.textContent = ''20 guestEl3.textContent = guests.names[j]21 } else if (j == 0 && guests.names.length === 2) {22 guestEl1.textContent = ''23 guestEl2.textContent = guests.names[j]24 delim2.textContent = 'и'25 } else if (j == 0 && guests.names.length === 3) {26 guestEl1.textContent = guests.names[j]27 delim1.textContent = ','28 } else if (j === 1 && guests.names.length === 2) {29 guestEl3.textContent = guests.names[j]30 } else if (j === 1 && guests.names.length === 3) {31 guestEl2.textContent = guests.names[j]32 delim2.textContent = 'и'33 } else if (j === 2) {34 guestEl3.textContent = guests.names[j]35 }36 }37 } else {38 if (guests.names[0] == 'Лера' ||39 guests.names[0] == 'Аня' ||40 guests.names[0] == 'Оля' ||41 guests.names[0] == 'Маша' ||42 guests.names[0] == 'Александра') {43 dearEl.textContent = 'Дорогая'44 } else if (guests.names[0] == 'Вова' ||45 guests.names[0] == 'Коля' ||46 guests.names[0] == 'Максим' ||47 guests.names[0] == 'дедушка Ваня') {48 dearEl.textContent = 'Дорогой'49 } else {50 dearEl.textContent = 'Дорогие'51 }52 guestEl1.textContent = ''53 guestEl2.textContent = ''54 guestEl3.textContent = guests.names[0]55 }56}57function setCounter() {58 var wdDate = new Date('Sat Jan 20 2018 17:30:00 GMT+0300 (FET)')59 dayCalc(wdDate)60 setInterval(function() {61 dayCalc(wdDate)62 }, 30000)63 64 setInterval(function() {65 var colons = document.getElementsByClassName('first-table-colon')66 for (var i = 0; i < colons.length; i ++) {67 if (colons[i].textContent === ':') colons[i].textContent = ''68 else colons[i].textContent = ':'69 }70 }, 1000)71}72function dayCalc(wdDate) {73 var currDate = new Date()74 var timeDiff = Math.abs(wdDate.getTime() - currDate.getTime())75 var dateDiff = Math.floor(timeDiff / (1000 * 3600 * 24))76 var hourDiff = Math.floor(timeDiff / (1000 * 3600)) % 2477 var minDiff = Math.floor(timeDiff / (1000 * 60)) % 6078 HTMLUpdate(dateDiff, hourDiff, minDiff)79}80function HTMLUpdate(dateDiff, hourDiff, minDiff) {81 var dayDesc = ''82 if (dateDiff % 10 > 4 || dateDiff % 10 === 0) dayDesc = 'Дней'83 else if (dateDiff % 10 > 1) dayDesc = 'Дня'84 else dayDesc = 'День'85 document.getElementById('day-desc').textContent = dayDesc86 var hourDesc = ''87 if (hourDiff % 10 > 4 || hourDiff % 10 === 0) hourDesc = 'Часов'88 else if (hourDiff % 10 > 1) hourDesc = 'Часа'89 else hourDesc = 'Час'90 document.getElementById('hour-desc').textContent = hourDesc91 var minDesc = ''92 if (minDiff % 10 > 4 || minDiff % 10 === 0) minDesc = 'Минут'93 else if (minDiff % 10 > 1) minDesc = 'Минуты'94 else minDesc = 'Минута'95 document.getElementById('min-desc').textContent = minDesc96 document.getElementById('day').textContent = '' + dateDiff97 document.getElementById('hour').textContent = '' + hourDiff98 document.getElementById('min').textContent = '' + minDiff...

Full Screen

Full Screen

withThemes.test.js

Source:withThemes.test.js Github

copy

Full Screen

1import React from 'react';2import { render, screen } from '@testing-library/react';3import ThemeContext from './themeContext';4import withThemes from './withThemes';5describe('withThemes', () => {6 const ThemeableComponent = ({ theme }) => (7 <div>8 <span data-testid={theme.testClass}>Foo</span>9 <span data-testid={theme.testClass2}>Bar</span>10 </div>11 );12 const testThemes = {13 default: {14 testClass: 'default__testClass__01234',15 testClass2: 'default__testClass2___ghjkl',16 },17 theme1: {18 testClass: 'theme1__testClass__12345',19 testClass2: 'theme1__testClass2___asdfg',20 },21 theme2: {22 testClass: 'theme2__testClass__34567',23 testClass2: 'theme2__testClass2___qwert',24 },25 };26 const ThemedComponent = withThemes('Foo', testThemes)(ThemeableComponent);27 const ThemedComponentComposes = withThemes('Foo', testThemes, true)(ThemeableComponent);28 it('Should use the default theme if no theme is specified', () => {29 render(<ThemedComponent />);30 const el1 = screen.getByTestId('default__testClass__01234');31 const el2 = screen.getByTestId('default__testClass2___ghjkl');32 expect(el1.textContent).toBe('Foo');33 expect(el2.textContent).toBe('Bar');34 });35 it('Should get a `contextThemes` value from context and provide the specified theme to the component as a prop', () => {36 render(37 <ThemeContext.Provider value={{ Foo: 'theme1' }}>38 <ThemedComponent />39 </ThemeContext.Provider>40 );41 const el1 = screen.getByTestId('theme1__testClass__12345');42 const el2 = screen.getByTestId('theme1__testClass2___asdfg');43 expect(el1.textContent).toBe('Foo');44 expect(el2.textContent).toBe('Bar');45 });46 it('Should render a component with a theme provided directly to the `themeName` prop', () => {47 render(<ThemedComponent themeName="theme2" />);48 const el1 = screen.getByTestId('theme2__testClass__34567');49 const el2 = screen.getByTestId('theme2__testClass2___qwert');50 expect(el1.textContent).toBe('Foo');51 expect(el2.textContent).toBe('Bar');52 });53 it('Should combine classNames of provided theme and default if `composes` is set to `true`', () => {54 render(<ThemedComponentComposes themeName="theme1" />);55 const el1 = screen.getByTestId(56 'default__testClass__01234 theme1__testClass__12345'57 );58 const el2 = screen.getByTestId(59 'default__testClass2___ghjkl theme1__testClass2___asdfg'60 );61 expect(el1.textContent).toBe('Foo');62 expect(el2.textContent).toBe('Bar');63 });64 it('Should utilize a theme provided directly via a `theme` prop first instead of any theme derived from context or `themeName`', () => {65 render(66 <ThemedComponent67 themeName="theme1"68 theme={{69 testClass: 'default__testClass__56789',70 testClass2: 'default__testClass2___lalala',71 }}72 />73 );74 const el1 = screen.getByTestId('default__testClass__56789');75 const el2 = screen.getByTestId('default__testClass2___lalala');76 expect(el1.textContent).toBe('Foo');77 expect(el2.textContent).toBe('Bar');78 });...

Full Screen

Full Screen

app.js

Source:app.js Github

copy

Full Screen

1'use strict';2let hours=['6am','7am','8am','9am','10am','11am','12pm','1pm','2pm','3pm','4pm','5pm','6pm','7pm','total'];3let tableID=document.getElementById('test');4let arrTotal=[0,0,0,0,0,0,0,0,0,0,0,0,0,0];5let totals=0;6//random value generator7function randomValue(min,max){8 return Math.floor(Math.random()*(max-min+1)+min);9}10function Store(location,minCust,maxCust,avgCook){11 this.location=location;12 this.minCust=minCust;13 this.maxCust=maxCust;14 this.avgCook=avgCook;15 this.custPerHour=[];16 this.cook=[];17 this.total=0;18}19//cust per hour20Store.prototype.calccustPerHour=function(){21 for(let i=0;i<hours.length-1;i++){22 this.custPerHour.push(randomValue(this.minCust,this.maxCust));23 }24};25//calcuate the cookie per hour26Store.prototype.calccookPerhour=function(){27 for(let i=0;i<hours.length-1;i++){28 this.cook.push(this.custPerHour[i]*Math.floor(this.avgCook));29 this.total=this.total+this.cook[i];30 arrTotal[i]=arrTotal[i]+this.cook[i];31 }32 this.cook[this.cook.length]=this.total;33 totals+=this.total;34};35//build table36Store.prototype.createElement=function(){37 let tableRow=document.createElement('tr');38 tableID.appendChild(tableRow);39 let tdEl1=document.createElement('td');40 tableRow.appendChild(tdEl1);41 tdEl1.textContent=this.location;42 let tdEl;43 for (let i=0;i<this.cook.length;i++){44 tdEl=document.createElement('td');45 tableRow.appendChild(tdEl);46 tdEl.textContent=this.cook[i];47 }48};49//creat heading50function heading(){51 let thead=document.createElement('thead');52 tableID.appendChild(thead);53 let tableRow=document.createElement('tr');54 thead.appendChild(tableRow);55 let tdEl1=document.createElement('td');56 tableRow.appendChild(tdEl1);57 tdEl1.textContent='stores';58 let thEl;59 for (let i=0;i<hours.length;i++){60 thEl=document.createElement('th');61 tableRow.appendChild(thEl);62 thEl.textContent=hours[i];63 }64}65//creat footer66function footers(){67 let footer=document.createElement('tfoot');68 tableID.appendChild(footer);69 let tableRow=document.createElement('tr');70 footer.appendChild(tableRow);71 let tdEl1=document.createElement('td');72 tableRow.appendChild(tdEl1);73 tdEl1.textContent='total';74 let tdEl;75 for (let i=0;i<hours.length-1;i++){76 tdEl=document.createElement('td');77 tableRow.appendChild(tdEl);78 tdEl.textContent=`${arrTotal[i]}`;79 }80 tdEl=document.createElement('td');81 tableRow.appendChild(tdEl);82 tdEl.textContent=`${totals}`;83}84heading();85//call the elements of objects to the table86let seattle=new Store('seattle',23,65,6.3);87seattle.calccustPerHour();88seattle.calccookPerhour();89seattle.createElement();90let tokyo=new Store('tokyo',3,24,1.2);91tokyo.calccustPerHour();92tokyo.calccookPerhour();93tokyo.createElement();94let dubai=new Store('Dubai',11,38,3.7);95dubai.calccustPerHour();96dubai.calccookPerhour();97dubai.createElement();98let paris=new Store('Paris',20,38,2.3);99paris.calccustPerHour();100paris.calccookPerhour();101paris.createElement();102let lima=new Store('lima',2,16,4.6);103lima.calccustPerHour();104lima.calccookPerhour();105lima.createElement();...

Full Screen

Full Screen

dados.js

Source:dados.js Github

copy

Full Screen

1/* VARIÁVEIS */2var nome = 'Gabriel'3var sobrenome = 'Ribeiro de Araújo'4var classRedCSS = 'red'5var classGreenCSS = 'green'6var classBlackCSS = 'black'7var date = new Date()8var colors = new Array('Green', 'Black', 'White')9var msg = '<p><b>Page title: </b>' + document.title + '<br>'10msg += '<b>Page adress: </b>' + document.URL + '<br>'11msg += '<b>Last modified: </b>' + document.lastModified + '</p>'12var elMsg = document.getElementById('info')13elMsg.innerHTML = msg14var el = document.getElementById('nome')15el.textContent += nome16var el2 = document.getElementById('sobrenome')17el2.innerHTML += sobrenome18/* colors */19var color = document.getElementById('color')20color.innerHTML += colors[0]21color.className = classGreenCSS22/* date */23var elDate1 = document.getElementById('date1')24elDate1.textContent += date.getDate()25var elDate2 = document.getElementById('date2')26elDate2.textContent += date.toDateString()27var elDate3 = document.getElementById('date3')28elDate3.textContent += date.getFullYear()29/* FUNÇÕES */30function mudaCaixaAlta(){31 var el1 = document.getElementById('nome')32 el1.textContent = el1.textContent.toUpperCase()33 var el2 = document.getElementById('sobrenome')34 el2.textContent = el2.textContent.toUpperCase()35}36function mudaCaixaBaixa(){37 var el1 = document.getElementById('nome')38 el1.textContent = el1.textContent.toLocaleLowerCase()39 var el2 = document.getElementById('sobrenome')40 el2.textContent = el2.textContent.toLocaleLowerCase()41}42function red(){43 var el1 = document.getElementById('nome')44 el1.className = classRedCSS45 var el2 = document.getElementById('sobrenome')46 el2.className = classRedCSS47}48function green(){49 var el1 = document.getElementById('nome')50 el1.className = classGreenCSS51 var el2 = document.getElementById('sobrenome')52 el2.className = classGreenCSS53}54function black(){55 var el1 = document.getElementById('nome')56 el1.className = classBlackCSS57 var el2 = document.getElementById('sobrenome')58 el2.className = classBlackCSS59}60function recolherPerfil(){61 var el = document.getElementById('perfil')62 el.className = 'recolhe'63}64function recolherColors(){65 var el = document.getElementById('colors')66 el.className = 'recolhe' 67}68function recolherWebSiteInfo(){69 var el = document.getElementById('info')70 el.className = 'recolhe' 71}72function recolherDate(){73 var el = document.getElementById('date')74 el.className = 'recolhe' 75}76function extenderPerfil(){77 var el = document.getElementById('perfil')78 el.className = 'extende'79}80function extenderColors(){81 var el = document.getElementById('colors')82 el.className = 'extende'83}84function extenderWebSiteInfo(){85 var el = document.getElementById('info')86 el.className = 'extende' 87}88function extenderDate(){89 var el = document.getElementById('date')90 el.className = 'extende' ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1await driver.elementByAccessibilityId('el1').text().should.become('text1');2await driver.elementByAccessibilityId('el2').text().should.become('text2');3await driver.elementByAccessibilityId('el3').text().should.become('text3');4await driver.elementByAccessibilityId('el4').text().should.become('text4');5await driver.elementByAccessibilityId('el5').text().should.become('text5');6await driver.elementByAccessibilityId('el6').text().should.become('text6');7await driver.elementByAccessibilityId('el7').text().should.become('text7');8await driver.elementByAccessibilityId('el8').text().should.become('text8');9await driver.elementByAccessibilityId('el9').text().should.become('text9');10await driver.elementByAccessibilityId('el10').text().should.become('text10');11await driver.elementByAccessibilityId('el11').text().should.become('text11');12await driver.elementByAccessibilityId('el12').text().should.become('text12');13await driver.elementByAccessibilityId('el13').text().should.become('text13');14await driver.elementByAccessibilityId('el14').text().should.become('text14');

Full Screen

Using AI Code Generation

copy

Full Screen

1var el1 = driver.elementByAccessibilityId("test-Username");2el1.text().then(function(text){3console.log(text);4});5var el1 = driver.elementByAccessibilityId("test-Username");6el1.getText().then(function(text){7console.log(text);8});

Full Screen

Using AI Code Generation

copy

Full Screen

1const el1 = await driver.$('XCUIElementTypeStaticText');2await el1.click();3await el1.clearText();4await el1.setText('test');5await el2.click();6await el2.clearText();7await el2.setText('test');8const el3 = await driver.$('~test');9await el3.click();10await el3.clearText();11await el3.setText('test');12const el4 = await driver.$('-ios predicate string:type == "XCUIElementTypeStaticText" AND name == "test"');13await el4.click();14await el4.clearText();15await el4.setText('test');16const el5 = await driver.$('-ios class chain:**/XCUIElementTypeStaticText[`name == "test"`]');17await el5.click();18await el5.clearText();19await el5.setText('test');20const el6 = await driver.$('-ios class chain:**/XCUIElementTypeStaticText[`label == "test"`]');21await el6.click();22await el6.clearText();23await el6.setText('test');24const el7 = await driver.$('-ios class chain:**/XCUIElementTypeStaticText[`value == "test"`]');25await el7.click();26await el7.clearText();27await el7.setText('test');28const el8 = await driver.$('-ios class chain:**/XCUIElementTypeStaticText[`name == "test" AND label == "test"`]');29await el8.click();30await el8.clearText();31await el8.setText('test');32const el9 = await driver.$('-ios class chain:**/XCUIElementTypeStaticText[`name == "test" AND value == "test"`]');33await el9.click();34await el9.clearText();35await el9.setText('

Full Screen

Using AI Code Generation

copy

Full Screen

1var el1 = driver.findElementByAccessibilityId("Alert Views");2el1.text().then(function(text) {3 console.log(text);4});5var el1 = driver.findElementByAccessibilityId("Alert Views");6el1.getText().then(function(text) {7 console.log(text);8});9var el1 = driver.findElementByAccessibilityId("Alert Views");10el1.getText().then(function(text) {11 console.log(text);12});13var el1 = driver.findElementByAccessibilityId("Alert Views");14el1.getText().then(function(text) {15 console.log(text);16});17var el1 = driver.findElementByAccessibilityId("Alert Views");18el1.getText().then(function(text) {19 console.log(text);20});21var el1 = driver.findElementByAccessibilityId("Alert Views");22el1.getText().then(function(text) {23 console.log(text);24});25var el1 = driver.findElementByAccessibilityId("Alert Views");26el1.getText().then(function(text) {27 console.log(text);28});29var el1 = driver.findElementByAccessibilityId("Alert Views");30el1.getText().then(function(text) {31 console.log(text);32});33var el1 = driver.findElementByAccessibilityId("Alert Views");34el1.getText().then(function(text) {35 console.log(text);36});37var el1 = driver.findElementByAccessibilityId("Alert Views");38el1.getText().then(function(text) {39 console.log(text);

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