How to use hey method in Testcafe

Best JavaScript code snippet using testcafe

rewrites.js

Source:rewrites.js Github

copy

Full Screen

1/* @flow */2import { toPageHref, toAsUrl } from '../rewrites';3const peekKeysFromCurrentRoute = ['lng', 'fn', 'version', 'editor', 'host'];4// const pages = [''];5const rewrites = [6 {7 path: '/products/:productId',8 page: 'product',9 },10 // custom pages rewrite rule example11 {12 path: '/:customPageId?',13 exclude: {14 // do transform for pages except15 // here should be glob('pages/*.js')16 customPageId: ['lalala', 'fn_*'],17 },18 page: 'custom',19 },20 // global rewrite rule21 {22 path: '/fn_:fn',23 page: '',24 },25];26/*27test('custom page rewrite rule', () => {28 expect(toPageHref(rewrites, '/hello')).toEqual({});29});30*/31test('toAsUrl custom simple', () => {32 expect(33 toAsUrl(34 rewrites,35 peekKeysFromCurrentRoute,36 {37 pathname: '/custom',38 query: {39 customPageId: 'hello',40 },41 },42 { pathname: '/', query: {} }43 )44 ).toEqual({45 as: '/hello',46 href: {47 pathname: '/custom',48 query: {49 customPageId: 'hello',50 },51 },52 });53});54test('toAsUrl custom with global rule', () => {55 expect(56 toAsUrl(57 rewrites,58 peekKeysFromCurrentRoute,59 {60 pathname: '/custom',61 query: {62 customPageId: 'hello',63 },64 },65 {66 pathname: '/',67 query: {68 fn: 'callME',69 },70 }71 )72 ).toEqual({73 as: '/fn_callME/hello',74 href: {75 pathname: '/custom',76 query: {77 customPageId: 'hello',78 fn: 'callME',79 },80 },81 });82});83test('toAsUrl custom with global rule and subpath', () => {84 expect(85 toAsUrl(86 rewrites,87 peekKeysFromCurrentRoute,88 {89 pathname: '/custom/tee',90 query: {91 customPageId: 'hello',92 },93 },94 {95 pathname: '/',96 query: {97 fn: 'callME',98 },99 }100 )101 ).toEqual({102 as: '/fn_callME/hello/tee',103 href: {104 pathname: '/custom/tee',105 query: {106 customPageId: 'hello',107 fn: 'callME',108 },109 },110 });111});112test('toAsUrl global rule found', () => {113 expect(114 toAsUrl(115 rewrites,116 peekKeysFromCurrentRoute,117 {118 pathname: '/product',119 query: {120 productId: 'hey',121 },122 },123 { pathname: '/', query: { fn: 'hellofn' } }124 )125 ).toEqual({126 as: '/fn_hellofn/products/hey',127 href: {128 pathname: '/product',129 query: {130 fn: 'hellofn',131 productId: 'hey',132 },133 },134 });135});136test('toAsUrl only global rule found', () => {137 expect(138 toAsUrl(139 rewrites,140 peekKeysFromCurrentRoute,141 {142 pathname: '/about',143 query: {},144 },145 { pathname: '/', query: { fn: 'hellofn' } }146 )147 ).toEqual({148 as: '/fn_hellofn/about',149 href: {150 pathname: '/about',151 query: {152 fn: 'hellofn',153 },154 },155 });156});157test('toAsUrl rule found', () => {158 expect(159 toAsUrl(160 rewrites,161 peekKeysFromCurrentRoute,162 {163 pathname: '/product',164 query: {165 productId: 'hey',166 },167 },168 { pathname: '/' }169 )170 ).toEqual({171 as: '/products/hey',172 href: {173 pathname: '/product',174 query: {175 productId: 'hey',176 },177 },178 });179});180test('toAsUrl rule found and additional vars exists', () => {181 expect(182 toAsUrl(183 rewrites,184 peekKeysFromCurrentRoute,185 {186 pathname: '/product',187 query: {188 productId: 'hey',189 someNonRuleVar: 'hi',190 },191 },192 { pathname: '/' }193 )194 ).toEqual({195 as: '/products/hey?someNonRuleVar=hi',196 href: {197 pathname: '/product',198 query: {199 productId: 'hey',200 someNonRuleVar: 'hi',201 },202 },203 });204});205test('toAsUrl rule not found', () => {206 expect(207 toAsUrl(208 rewrites,209 peekKeysFromCurrentRoute,210 {211 pathname: '/hello',212 query: {213 productId: 'hey',214 },215 },216 { pathname: '/' }217 )218 ).toEqual({219 as: '/hello?productId=hey',220 href: {221 pathname: '/hello',222 query: {223 productId: 'hey',224 },225 },226 });227});228test('toAsUrl preserves peekKeysFromCurrentRoute keys from current route', () => {229 expect(230 toAsUrl(231 rewrites,232 peekKeysFromCurrentRoute,233 {234 pathname: '/hello',235 query: {236 productId: 'hey',237 },238 },239 { pathname: '/', query: { lng: 'fr', not_in_preserved: 'hi' } }240 )241 ).toEqual({242 as: '/hello?lng=fr&productId=hey',243 href: {244 pathname: '/hello',245 query: {246 lng: 'fr',247 productId: 'hey',248 },249 },250 });251});252test('toAsUrl overrides preserved keys', () => {253 expect(254 toAsUrl(255 rewrites,256 peekKeysFromCurrentRoute,257 {258 pathname: '/hello',259 query: {260 lng: 'en',261 productId: 'hey',262 },263 },264 { pathname: '/', query: { lng: 'fr', not_in_preserved: 'hi' } }265 )266 ).toEqual({267 as: '/hello?lng=en&productId=hey',268 href: {269 pathname: '/hello',270 query: {271 lng: 'en',272 productId: 'hey',273 },274 },275 });276});277test('toAsUrl allows remove preseved key', () => {278 expect(279 toAsUrl(280 rewrites,281 peekKeysFromCurrentRoute,282 {283 pathname: '/hello',284 query: {285 productId: 'hey',286 lng: null, // <-- remove287 },288 },289 { pathname: '/', query: { lng: 'fr', not_in_preserved: 'hi' } }290 )291 ).toEqual({292 as: '/hello?productId=hey',293 href: {294 pathname: '/hello',295 query: {296 productId: 'hey',297 },298 },299 });300});301test('toPageHref custom not excluded', () => {302 expect(toPageHref(rewrites, '/some-not-excluded')).toEqual({303 pathname: '/custom',304 query: {305 customPageId: 'some-not-excluded',306 },307 });308});309test('toPageHref custom not excluded with subpath', () => {310 expect(toPageHref(rewrites, '/some-not-excluded/tee')).toEqual({311 pathname: '/custom/tee',312 query: {313 customPageId: 'some-not-excluded',314 },315 });316});317test('toPageHref custom not excluded with subpath and fn_', () => {318 expect(toPageHref(rewrites, '/fn_func/some-not-excluded/tee')).toEqual({319 pathname: '/custom/tee',320 query: {321 customPageId: 'some-not-excluded',322 fn: 'func',323 },324 });325});326test('toPageHref unknown', () => {327 expect(toPageHref(rewrites, '/fn_hello/lalala')).toEqual({328 pathname: '/lalala',329 query: {330 fn: 'hello',331 },332 });333 expect(toPageHref(rewrites, '/fn_hello/lalala/la')).toEqual({334 pathname: '/lalala/la',335 query: {336 fn: 'hello',337 },338 });339 // we don't need a special processing for such paths340 expect(toPageHref(rewrites, '/lalala')).toEqual(null);341});342test('toPageHref base', () => {343 expect(toPageHref(rewrites, '/fn_hello/products/hey')).toEqual({344 pathname: '/product',345 query: {346 fn: 'hello',347 productId: 'hey',348 },349 });350 expect(toPageHref(rewrites, '/products/hey')).toEqual({351 pathname: '/product',352 query: {353 productId: 'hey',354 },355 });356});357test('toPageHref root', () => {358 expect(toPageHref(rewrites, '/')).toEqual({359 pathname: '/custom',360 query: {361 customPageId: '',362 },363 });364 expect(toPageHref(rewrites, '/fn_hello')).toEqual({365 pathname: '/custom',366 query: {367 customPageId: '',368 fn: 'hello',369 },370 });371 expect(toPageHref(rewrites, '/fn_hello/')).toEqual({372 pathname: '/custom',373 query: {374 customPageId: '',375 fn: 'hello',376 },377 });378});379test('toAsUrl root', () => {380 expect(381 toAsUrl(382 rewrites,383 peekKeysFromCurrentRoute,384 {385 pathname: '/custom',386 query: {387 customPageId: '',388 lng: 'en',389 },390 },391 {392 pathname: '/custom',393 query: {394 customPageId: '',395 lng: 'fr',396 },397 }398 )399 ).toEqual({400 as: '/?lng=en',401 href: {402 pathname: '/custom',403 query: {404 lng: 'en',405 customPageId: '',406 },407 },408 });...

Full Screen

Full Screen

auto_link_test.js

Source:auto_link_test.js Github

copy

Full Screen

1module("wysihtml5.dom.autoLink", {2 equal: function(actual, expected, message) {3 return wysihtml5.assert.htmlEqual(actual, expected, message);4 },5 6 autoLink: function(html) {7 var container = wysihtml5.dom.getAsDom(html);8 return wysihtml5.dom.autoLink(container).innerHTML;9 } 10});11test("Basic test", function() {12 ok(wysihtml5.dom.autoLink.URL_REG_EXP, "URL reg exp is revealed to be access globally");13 14 this.equal(15 this.autoLink("hey check out this search engine http://www.google.com"),16 "hey check out this search engine <a href=\"http://www.google.com\">http://www.google.com</a>",17 "Urls starting with http:// are correctly linked"18 );19 20 this.equal(21 this.autoLink("hey check out this search engine https://www.google.com"),22 "hey check out this search engine <a href=\"https://www.google.com\">https://www.google.com</a>",23 "Urls starting with https:// are correctly linked"24 );25 26 this.equal(27 this.autoLink("hey check out this search engine www.google.com"),28 "hey check out this search engine <a href=\"http://www.google.com\">www.google.com</a>",29 "Urls starting with www. are correctly linked"30 );31 32 this.equal(33 this.autoLink("hey check out this mail christopher.blum@xing.com"),34 "hey check out this mail christopher.blum@xing.com",35 "E-Mails are not linked"36 );37 38 this.equal(39 this.autoLink("http://google.de"),40 "<a href=\"http://google.de\">http://google.de</a>",41 "Single url without www. but with http:// is auto linked"42 );43 44 this.equal(45 this.autoLink("hey check out this search engine <a href=\"http://www.google.com\">www.google.com</a>"),46 "hey check out this search engine <a href=\"http://www.google.com\">www.google.com</a>",47 "Already auto-linked stuff isn't causing a relinking"48 );49 50 this.equal(51 this.autoLink("hey check out this search engine <code><span>http://www.google.com</span></code>"),52 "hey check out this search engine <code><span>http://www.google.com</span></code>",53 "Urls inside 'code' elements are not auto linked"54 );55 56 this.equal(57 this.autoLink("hey check out this search engine <pre>http://www.google.com</pre>"),58 "hey check out this search engine <pre>http://www.google.com</pre>",59 "Urls inside 'pre' elements are not auto linked"60 );61 62 this.equal(63 this.autoLink("hey check out this search engine (http://www.google.com)"),64 "hey check out this search engine (<a href=\"http://www.google.com\">http://www.google.com</a>)",65 "Parenthesis around url are not part of url #1"66 );67 68 this.equal(69 this.autoLink("hey check out this search engine (http://www.google.com?q=hello(spencer))"),70 "hey check out this search engine (<a href=\"http://www.google.com?q=hello(spencer)\">http://www.google.com?q=hello(spencer)</a>)",71 "Parenthesis around url are not part of url #2"72 );73 74 this.equal(75 this.autoLink("hey check out this search engine <span>http://www.google.com?q=hello(spencer)</span>"),76 "hey check out this search engine <span><a href=\"http://www.google.com?q=hello(spencer)\">http://www.google.com?q=hello(spencer)</a></span>",77 "Urls in tags are correctly auto linked"78 );79 80 this.equal(81 this.autoLink("http://google.de and http://yahoo.com as well as <span>http://de.finance.yahoo.com</span> <a href=\"http://google.com\" class=\"more\">http://google.com</a>"),82 "<a href=\"http://google.de\">http://google.de</a> and <a href=\"http://yahoo.com\">http://yahoo.com</a> as well as <span><a href=\"http://de.finance.yahoo.com\">http://de.finance.yahoo.com</a></span> <a href=\"http://google.com\" class=\"more\">http://google.com</a>",83 "Multiple urls are correctly auto linked"84 );85 86 this.equal(87 this.autoLink("<script>http://google.de</script>"),88 "<script>http://google.de</script>",89 "Urls in SCRIPT elements are not touched"90 );91 92 this.equal(93 this.autoLink("<script>http://google.de</script>"),94 "<script>http://google.de</script>",95 "Urls in SCRIPT elements are not touched"96 );97 98 this.equal(99 this.autoLink(" http://www.google.de"),100 " <a href=\"http://www.google.de\">http://www.google.de</a>",101 "Check if white space in front of url is preserved"102 );...

Full Screen

Full Screen

sweetalert.init.js

Source:sweetalert.init.js Github

copy

Full Screen

1document.querySelector('.sweet-wrong').onclick = function(){2 sweetAlert("Oops...", "Something went wrong !!", "error");3};4document.querySelector('.sweet-message').onclick = function(){5 swal("Hey, Here's a message !!")6};7document.querySelector('.sweet-text').onclick = function(){8 swal("Hey, Here's a message !!", "It's pretty, isn't it?")9};10document.querySelector('.sweet-success').onclick = function(){11 swal("Hey, Good job !!", "You clicked the button !!", "success")12};13document.querySelector('.sweet-confirm').onclick = function(){14 swal({15 title: "Are you sure to delete ?",16 text: "You will not be able to recover this imaginary file !!",17 type: "warning",18 showCancelButton: true,19 confirmButtonColor: "#DD6B55",20 confirmButtonText: "Yes, delete it !!",21 closeOnConfirm: false22 },23 function(){24 swal("Deleted !!", "Hey, your imaginary file has been deleted !!", "success");25 });26};27document.querySelector('.sweet-success-cancel').onclick = function(){28 swal({29 title: "Are you sure to delete ?",30 text: "You will not be able to recover this imaginary file !!",31 type: "warning",32 showCancelButton: true,33 confirmButtonColor: "#DD6B55",34 confirmButtonText: "Yes, delete it !!",35 cancelButtonText: "No, cancel it !!",36 closeOnConfirm: false,37 closeOnCancel: false38 },39 function(isConfirm){40 if (isConfirm) {41 swal("Deleted !!", "Hey, your imaginary file has been deleted !!", "success");42 }43 else {44 swal("Cancelled !!", "Hey, your imaginary file is safe !!", "error");45 }46 });47};48document.querySelector('.sweet-image-message').onclick = function(){49 swal({50 title: "Sweet !!",51 text: "Hey, Here's a custom image !!",52 imageUrl: "assets/images/hand.jpg"53 });54};55document.querySelector('.sweet-html').onclick = function(){56 swal({57 title: "Sweet !!",58 text: "<span style='color:#ff0000'>Hey, you are using HTML !!<span>",59 html: true60 });61};62document.querySelector('.sweet-auto').onclick = function(){63 swal({64 title: "Sweet auto close alert !!",65 text: "Hey, i will close in 2 seconds !!",66 timer: 2000,67 showConfirmButton: false68 });69};70document.querySelector('.sweet-prompt').onclick = function(){71 swal({72 title: "Enter an input !!",73 text: "Write something interesting !!",74 type: "input",75 showCancelButton: true,76 closeOnConfirm: false,77 animation: "slide-from-top",78 inputPlaceholder: "Write something"79 },80 function(inputValue){81 if (inputValue === false) return false;82 if (inputValue === "") {83 swal.showInputError("You need to write something!");84 return false85 }86 swal("Hey !!", "You wrote: " + inputValue, "success");87 });88};89document.querySelector('.sweet-ajax').onclick = function(){90 swal({91 title: "Sweet ajax request !!",92 text: "Submit to run ajax request !!",93 type: "info",94 showCancelButton: true,95 closeOnConfirm: false,96 showLoaderOnConfirm: true,97 },98 function(){99 setTimeout(function(){100 swal("Hey, your ajax request finished !!");101 }, 2000);102 });...

Full Screen

Full Screen

bob.spec.js

Source:bob.spec.js Github

copy

Full Screen

1var Bob = require("./bob.js")2describe("Bob", function() {3 var bob = new Bob()4 it("stating something", function() {5 var result = bob.hey("Tom-ay-to, tom-aaaah-to.")6 expect(result).toEqual("Whatever.")7 })8 it("shouting", function() {9 var result = bob.hey("WATCH OUT!")10 expect(result).toEqual("Whoa, chill out!")11 })12 it("shouting gibberish", function() {13 var result = bob.hey("FCECDFCAAB")14 expect(result).toEqual("Whoa, chill out!")15 })16 it("asking a question", function() {17 var result = bob.hey("Does this cryogenic chamber make me look fat?")18 expect(result).toEqual("Sure.")19 })20 it("asking a numeric question", function() {21 var result = bob.hey("You are, what, like 15?")22 expect(result).toEqual("Sure.")23 })24 it("asking gibberish", function() {25 var result = bob.hey("fffbbcbeab?")26 expect(result).toEqual("Sure.")27 })28 it("talking forcefully", function() {29 var result = bob.hey("Let's go make out behind the gym!")30 expect(result).toEqual("Whatever.")31 })32 it("using acronyms in regular speech", function() {33 var result = bob.hey("It's OK if you don't want to go to the DMV.")34 expect(result).toEqual("Whatever.")35 })36 it("forceful questions", function() {37 var result = bob.hey("WHAT THE HELL WERE YOU THINKING?")38 expect(result).toEqual("Calm down, I know what I'm doing!")39 })40 it("shouting numbers", function() {41 var result = bob.hey("1, 2, 3 GO!")42 expect(result).toEqual("Whoa, chill out!")43 })44 it("only numbers", function() {45 var result = bob.hey("1, 2, 3")46 expect(result).toEqual("Whatever.")47 })48 it("question with only numbers", function() {49 var result = bob.hey("4?")50 expect(result).toEqual("Sure.")51 })52 it("shouting with special characters", function() {53 var result = bob.hey("ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!")54 expect(result).toEqual("Whoa, chill out!")55 })56 it("shouting with no exclamation mark", function() {57 var result = bob.hey("I HATE YOU")58 expect(result).toEqual("Whoa, chill out!")59 })60 it("statement containing question mark", function() {61 var result = bob.hey("Ending with a ? means a question.")62 expect(result).toEqual("Whatever.")63 })64 it("prattling on", function() {65 var result = bob.hey("Wait! Hang on. Are you going to be OK?")66 expect(result).toEqual("Sure.")67 })68 it("silence", function() {69 var result = bob.hey("")70 expect(result).toEqual("Fine. Be that way!")71 })72 it("prolonged silence", function() {73 var result = bob.hey(" ")74 expect(result).toEqual("Fine. Be that way!")75 })76 it("alternate silence", function() {77 var result = bob.hey("\t\t\t\t\t\t\t\t\t\t")78 expect(result).toEqual("Fine. Be that way!")79 })80 it("multiple line question", function() {81 var result = bob.hey("\nDoes this cryogenic chamber make me look fat?\nno")82 expect(result).toEqual("Whatever.")83 })84 it("starting with whitespace", function() {85 var result = bob.hey(" hmmmmmmm...")86 expect(result).toEqual("Whatever.")87 })88 it("ending with whitespace", function() {89 var result = bob.hey("Okay if like my spacebar quite a bit? ")90 expect(result).toEqual("Sure.")91 })92 it("other whitespace", function() {93 var result = bob.hey("\n\r \t")94 expect(result).toEqual("Fine. Be that way!")95 })96 it("non-question ending with whitespace", function() {97 var result = bob.hey("This is a statement ending with whitespace ")98 expect(result).toEqual("Whatever.")99 })...

Full Screen

Full Screen

hey-there.js

Source:hey-there.js Github

copy

Full Screen

1import * as React from 'react';2import * as heyThereStyles from './hey-there.module.scss';3import {HeyThereQuery} from "../../../assets/hey-there-query";4import * as serviceStyles from "../service-list.module.scss";5const HeyThere = (props) => {6 const {7 wpPage: {8 heyThere: {9 heyThereTitle,10 heyThereCopy,11 heyThereBackgroundColor,12 heyThereSignature,13 heyThereJobTitle,14 heyThereImage: {15 sourceUrl16 },17 heyThereGraphicOne,18 heyThereGraphicTwo,19 heyThereSecondServiceGraphic20 }21 }22 } = HeyThereQuery();23 const image1 = heyThereGraphicOne ? <div className={heyThereStyles.imageContainer}><img src={heyThereGraphicOne.sourceUrl} alt=""/></div> : null;24 const image2 = heyThereGraphicTwo ? <div className={heyThereStyles.imageContainer}><img src={heyThereGraphicTwo.sourceUrl} alt=""/></div> : null;25 const secondServiceImage = heyThereSecondServiceGraphic ? <div className={heyThereStyles.secondServiceGraphic}><img src={heyThereSecondServiceGraphic.sourceUrl} alt=""/></div> : null;26 const subCopyStyle = {27 textAlign: 'center',28 fontSize: '26px',29 fontWeight: 600,30 fontStyle: 'italic',31 color:' rgb(102, 75, 43)'32 }33 let content;34 if(props.isService) {35 content = (36 <>37 <div id={props.anchor} className={heyThereStyles.heyThereContainer} style={{backgroundColor: heyThereBackgroundColor}}>38 <div className={heyThereStyles.heyThereContent}>39 <div>40 <h2 style={{color: '#9b7963', textAlign: 'center'}}>{props.serviceTitle}</h2>41 <p style={subCopyStyle}>{props.serviceTitleSubcopy}</p>42 <div className={serviceStyles.serviceList} dangerouslySetInnerHTML={{__html: props.serviceContent}}/>43 {props.servicesPartnership ? (<div style={{textAlign: 'center'}} dangerouslySetInnerHTML={{__html: props.servicesPartnership}}/>) : null}44 </div>45 </div>46 {props.secondService ? null : image1}47 {props.secondService ? secondServiceImage : image2}48 </div>49 </>50 )51 } else {52 content = (53 <div id={'about'} className={heyThereStyles.heyThereContainer} style={{backgroundColor: heyThereBackgroundColor}}>54 <div className={heyThereStyles.heyThereContent}>55 <div style={{padding: '0 30px'}}>56 <img src={sourceUrl} alt=""/>57 </div>58 <div>59 <h2 style={{color: '#9b7963'}}>{heyThereTitle}</h2>60 <div dangerouslySetInnerHTML={{__html: heyThereCopy}}/>61 <p className={heyThereStyles.heyThereSignature}>{heyThereSignature}<br/><span>- {heyThereJobTitle}</span></p>62 </div>63 </div>64 {image1}65 {image2}66 </div>67 )68 }69 return (70 <>71 {content}72 </>73 )74}...

Full Screen

Full Screen

saga.test.js

Source:saga.test.js Github

copy

Full Screen

1import WS from "jest-websocket-mock";2import makeStore from "../store";3import { actions } from "../store/reducer";4let ws, store;5beforeEach(async () => {6 ws = new WS("ws://localhost:8080");7 store = makeStore();8 await ws.connected;9 ws.send("Hello there");10});11afterEach(() => {12 WS.clean();13});14describe("The saga", () => {15 it("connects to the websocket server", () => {16 expect(store.getState().messages).toEqual([17 { side: "received", text: "Hello there" },18 ]);19 });20 it("stores new messages", () => {21 ws.send("how you doin?");22 expect(store.getState().messages).toEqual([23 { side: "received", text: "Hello there" },24 { side: "received", text: "how you doin?" },25 ]);26 });27 it("stores new messages received shortly one after the other", () => {28 ws.send("hey");29 ws.send("hey?");30 ws.send("hey??");31 ws.send("hey???");32 expect(store.getState().messages).toEqual([33 { side: "received", text: "Hello there" },34 { side: "received", text: "hey" },35 { side: "received", text: "hey?" },36 { side: "received", text: "hey??" },37 { side: "received", text: "hey???" },38 ]);39 });40 it("sends messages", async () => {41 store.dispatch(actions.send("oh hi Mark"));42 await expect(ws).toReceiveMessage("oh hi Mark");43 expect(ws).toHaveReceivedMessages(["oh hi Mark"]);44 expect(store.getState().messages).toEqual([45 { side: "received", text: "Hello there" },46 { side: "sent", text: "oh hi Mark" },47 ]);48 });49 it("sends messages in a quick succession", async () => {50 store.dispatch(actions.send("hey"));51 store.dispatch(actions.send("hey?"));52 store.dispatch(actions.send("hey??"));53 store.dispatch(actions.send("hey???"));54 await expect(ws).toReceiveMessage("hey");55 await expect(ws).toReceiveMessage("hey?");56 await expect(ws).toReceiveMessage("hey??");57 await expect(ws).toReceiveMessage("hey???");58 expect(ws).toHaveReceivedMessages(["hey", "hey?", "hey??", "hey???"]);59 expect(store.getState().messages).toEqual([60 { side: "received", text: "Hello there" },61 { side: "sent", text: "hey" },62 { side: "sent", text: "hey?" },63 { side: "sent", text: "hey??" },64 { side: "sent", text: "hey???" },65 ]);66 });67 it("marks the connection as active when it successfully connects to the ws server", () => {68 expect(store.getState().connected).toBe(true);69 });70 it("marks the connection as inactive after a disconnect", async () => {71 ws.close();72 await ws.closed;73 expect(store.getState().connected).toBe(false);74 });75 it("marks the connection as inactive after a connection error", async () => {76 ws.error();77 await ws.closed;78 expect(store.getState().connected).toBe(false);79 });80 it("reconnects after losing the ws connection", async () => {81 // We cannot use jest.useFakeTimers because mock-socket has to work around timing issues82 jest.spyOn(window, "setTimeout");83 ws.error();84 await ws.closed;85 expect(store.getState().connected).toBe(false);86 // Trigger our delayed reconnection87 window.setTimeout.mock.calls.forEach(([cb, , ...args]) => cb(...args));88 await ws.connected; // reconnected!89 expect(store.getState().connected).toBe(true);90 window.setTimeout.mockRestore();91 });...

Full Screen

Full Screen

templateStrings.js

Source:templateStrings.js Github

copy

Full Screen

1// |reftest| skip-if(!xulRuntime.shell)2function test() {3// template strings4assertStringExpr("`hey there`", literal("hey there"));5assertStringExpr("`hey\nthere`", literal("hey\nthere"));6assertExpr("`hey${\"there\"}`", templateLit([lit("hey"), lit("there"), lit("")]));7assertExpr("`hey${\"there\"}mine`", templateLit([lit("hey"), lit("there"), lit("mine")]));8assertExpr("`hey${a == 5}mine`", templateLit([lit("hey"), binExpr("==", ident("a"), lit(5)), lit("mine")]));9assertExpr("func`hey\\x`", taggedTemplate(ident("func"), template(["hey\\x"], [void 0])));10assertExpr("func`hey${4}\\x`", taggedTemplate(ident("func"), template(["hey","\\x"], ["hey",void 0], lit(4))));11assertExpr("`hey${`there${\"how\"}`}mine`", templateLit([lit("hey"),12 templateLit([lit("there"), lit("how"), lit("")]), lit("mine")]));13assertExpr("func`hey`", taggedTemplate(ident("func"), template(["hey"], ["hey"])));14assertExpr("func`hey${\"4\"}there`", taggedTemplate(ident("func"),15 template(["hey", "there"], ["hey", "there"], lit("4"))));16assertExpr("func`hey${\"4\"}there${5}`", taggedTemplate(ident("func"),17 template(["hey", "there", ""], ["hey", "there", ""],18 lit("4"), lit(5))));19assertExpr("func`hey\r\n`", taggedTemplate(ident("func"), template(["hey\n"], ["hey\n"])));20assertExpr("func`hey${4}``${5}there``mine`",21 taggedTemplate(taggedTemplate(taggedTemplate(22 ident("func"), template(["hey", ""], ["hey", ""], lit(4))),23 template(["", "there"], ["", "there"], lit(5))),24 template(["mine"], ["mine"])));25// multi-line template string - line numbers26var node = Reflect.parse("`\n\n ${2}\n\n\n`");27Pattern({loc:{start:{line:1, column:0}, end:{line:6, column:1}, source:null}, type:"Program",28body:[{loc:{start:{line:1, column:0}, end:{line:6, column:1}, source:null},29type:"ExpressionStatement", expression:{loc:{start:{line:1, column:0}, end:{line:6, column:1},30source:null}, type:"TemplateLiteral", elements:[{loc:{start:{line:1, column:0}, end:{line:3,31column:5}, source:null}, type:"Literal", value:"\n\n "}, {loc:{start:{line:3, column:5},32end:{line:3, column:6}, source:null}, type:"Literal", value:2}, {loc:{start:{line:3, column:6},33end:{line:6, column:1}, source:null}, type:"Literal", value:"\n\n\n"}]}}]}).match(node);34assertStringExpr("\"hey there\"", literal("hey there"));35}...

Full Screen

Full Screen

Child.js

Source:Child.js Github

copy

Full Screen

1import React from "react"2const Child = ({ person, name, lastName }) => {3 // console.log("synchronous hey")4 // console.log("synchronous hey")5 // console.log("synchronous hey")6 // console.log("synchronous hey")7 new Promise(() => {console.log("first hey")})8 .then(() => {9 console.log("second hey")10 return "third hey, but from second promise"11 })12 .then((hey) => console.log(hey))13 // console.log("synchronous hey")14 // console.log("synchronous hey")15 // console.log("synchronous hey")16 // console.log("synchronous hey")17 // console.log("synchronous hey")18 // console.log("synchronous hey")19 return (20 <div>21 {person}22 {name}23 {lastName}24 </div>25 )26}...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#submit-button')5 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');6});7TestCafe is released under the [MIT](

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#submit-button')5 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');6});7* [Release Notes](

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#submit-button')5 .wait(2000)6 .takeScreenshot()7 .click('#tried-test-cafe')8 .click('#remote-testing')9 .click('#continuous-integration-embedding')10 .click('#background-parallel-testing')11 .click('#reusing-js-code')12 .click('#traffic-markup-analysis')13 .click('#windows')14 .click('#test-on-the-cloud')15 .click('#continuous-integration-embedding')16 .click('#background-parallel-testing')17 .click('#reusing-js-code')18 .click('#traffic-markup-analysis')19 .click('#windows')20 .click('#test-on-the-cloud')21 .click('#continuous-integration-embedding')22 .click('#background-parallel-testing')23 .click('#reusing-js-code')24 .click('#traffic-markup-analysis')25 .click('#windows')26 .click('#test-on-the-cloud')27 .click('#continuous-integration-embedding')28 .click('#background-parallel-testing')29 .click('#reusing-js-code')30 .click('#traffic-markup-analysis')31 .click('#windows')32 .click('#test-on-the-cloud')33 .click('#continuous-integration-embedding')34 .click('#background-parallel-testing')35 .click('#reusing-js-code')36 .click('#traffic-markup-analysis')37 .click('#windows')38 .click('#test-on-the-cloud')39 .click('#continuous-integration-embedding')40 .click('#background-parallel-testing')41 .click('#reusing-js-code')42 .click('#traffic-markup-analysis')43 .click('#windows')44 .click('#test-on-the-cloud')45 .click('#continuous-integration-embedding')46 .click('#background-parallel-testing')47 .click('#reusing-js-code')48 .click('#traffic-markup-analysis')49 .click('#windows')50 .click('#test-on-the-cloud')51 .click('#continuous-integration-embedding')52 .click('#background-parallel-testing')53 .click('#reusing-js-code')54 .click('#traffic-markup-analysis')55 .click('#windows

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#submit-button');5});6test('My second test', async t => {7 .typeText('#developer-name', 'John Smith')8 .click('#submit-button');9});10import { Selector } from 'testcafe';11test('My first test', async t => {12 .typeText('#developer-name', 'John Smith')13 .click('#submit-button');14});15test('My second test', async t => {16 .typeText('#developer-name', 'John Smith')17 .click('#submit-button');18});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#submit-button')5 .wait(5000);6});7import { Selector } from 'testcafe';8test('My first test', async t => {9 .typeText('#developer-name', 'John Smith')10 .click('#submit-button')11 .wait(5000);12});13import { Selector } from 'testcafe';14test('My first test', async t => {15 .typeText('#developer-name', 'John Smith')16 .click('#submit-button')17 .wait(5000);18});19import { Selector } from 'testcafe';20test('My first test', async t => {21 .typeText('#developer-name', 'John Smith')22 .click('#submit-button')23 .wait(5000);24});25import { Selector } from 'testcafe';26test('My first test', async t => {27 .typeText('#developer-name', 'John Smith')28 .click('#submit-button')29 .wait(5000);30});31import { Selector

Full Screen

Using AI Code Generation

copy

Full Screen

1import {Selector} from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#submit-button');5 const articleHeader = await Selector('.result-content').find('h1');6 let headerText = await articleHeader.innerText;7});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#submit-button')5 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');6});7import { Selector } from 'testcafe';8test('My first test', async t => {9 .typeText('#developer-name', 'John Smith')10 .click('#submit-button')11 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');12});13import { Selector } from 'testcafe';14test('My first test', async t => {15 .typeText('#developer-name', 'John Smith')16 .click('#submit-button')17 .expect(Selector('#article-header').innerText).notEql('Thank you, John Smith!');18});19import { Selector } from 'testcafe';20test('My first test', async t => {21 .typeText('#developer-name', 'John Smith')22 .click('#submit-button')23 .expect(Selector('#article-header').exists).ok();24});25import { Selector } from 'testcafe';26test('My first test', async t => {27 .typeText('#developer-name', 'John Smith

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 Testcafe automation tests on LambdaTest cloud grid

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

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful