How to use isAlwaysNotEditableElement method in Testcafe

Best JavaScript code snippet using testcafe

dom-test.js

Source:dom-test.js Github

copy

Full Screen

1var INTERNAL_PROPS = hammerhead.PROCESSING_INSTRUCTIONS.dom.internal_props;2var domUtils = hammerhead.utils.dom;3var browserUtils = hammerhead.utils.browser;4var nativeMethods = hammerhead.nativeMethods;5var Promise = hammerhead.Promise;6module('isCrossDomainWindows', function () {7 test('self', function () {8 ok(!domUtils.isCrossDomainWindows(window, window));9 });10 test('iframe with empty src', function () {11 return createTestIframe({ src: '' })12 .then(function (iframe) {13 ok(!domUtils.isCrossDomainWindows(window, iframe.contentWindow));14 });15 });16 test('iframe with about blank src', function () {17 return createTestIframe({ src: 'about:blank' })18 .then(function (iframe) {19 ok(!domUtils.isCrossDomainWindows(window, iframe.contentWindow));20 });21 });22 test('iframe with cross domain src', function () {23 return createTestIframe({ src: getCrossDomainPageUrl('../../data/cross-domain/get-message.html') })24 .then(function (iframe) {25 ok(domUtils.isCrossDomainWindows(window, iframe.contentWindow));26 });27 });28});29test('isDomElement', function () {30 ok(!domUtils.isDomElement(document));31 ok(domUtils.isDomElement(document.documentElement));32 ok(domUtils.isDomElement(document.body));33 ok(domUtils.isDomElement(document.createElement('span')));34 ok(domUtils.isDomElement(document.createElement('strong')));35 ok(domUtils.isDomElement(document.createElement('a')));36 ok(!domUtils.isDomElement(null));37 ok(!domUtils.isDomElement(document.createTextNode('text')));38 ok(!domUtils.isDomElement(document.createDocumentFragment()));39 //T18480540 var p = Element.prototype;41 do42 ok(!domUtils.isDomElement(p));43 // eslint-disable-next-line no-extra-parens44 while ((p = Object.getPrototypeOf(p)));45 if (window.Proxy)46 ok(!domUtils.isDomElement(new Proxy({}, {})));47});48test('isDomElement for iframe elements', function () {49 return createTestIframe({ src: '' })50 .then(function (iframe) {51 var iframeDocument = iframe.contentDocument;52 ok(!domUtils.isDomElement(iframeDocument));53 ok(domUtils.isDomElement(iframeDocument.documentElement));54 ok(domUtils.isDomElement(iframeDocument.body));55 ok(domUtils.isDomElement(iframeDocument.createElement('span')));56 ok(domUtils.isDomElement(iframeDocument.createElement('strong')));57 ok(domUtils.isDomElement(iframeDocument.createElement('a')));58 ok(!domUtils.isDomElement(iframeDocument.createTextNode('text')));59 ok(!domUtils.isDomElement(iframeDocument.createDocumentFragment()));60 var p = iframe.contentWindow.Element.prototype;61 do62 ok(!domUtils.isDomElement(p));63 // eslint-disable-next-line no-extra-parens64 while ((p = Object.getPrototypeOf(p)));65 if (window.Proxy)66 ok(!domUtils.isDomElement(new Proxy({}, {})));67 });68});69test('isDocumentFragmentNode (GH-1344)', function () {70 ok(domUtils.isDocumentFragmentNode(document.createDocumentFragment()));71 ok(!domUtils.isDocumentFragmentNode(document.createElement('span')));72 ok(!domUtils.isDocumentFragmentNode(document.createElement('strong')));73 ok(!domUtils.isDocumentFragmentNode(document.createElement('a')));74 ok(!domUtils.isDocumentFragmentNode(null));75 ok(!domUtils.isDocumentFragmentNode(document.createTextNode('text')));76 if (window.Proxy)77 ok(!domUtils.isDocumentFragmentNode(new Proxy({}, {})));78});79test('isTextNode (GH-1344)', function () {80 ok(domUtils.isTextNode(document.createTextNode('text')));81 ok(!domUtils.isTextNode(document.createDocumentFragment()));82 ok(!domUtils.isTextNode(document.createElement('span')));83 ok(!domUtils.isTextNode(document.createElement('strong')));84 ok(!domUtils.isTextNode(document.createElement('a')));85 ok(!domUtils.isTextNode(null));86 if (window.Proxy)87 ok(!domUtils.isTextNode(new Proxy({}, {})));88});89test('isProcessingInstructionNode (GH-1344)', function () {90 var doc = new DOMParser().parseFromString('<xml></xml>', 'application/xml');91 var instruction = doc.createProcessingInstruction('xml-stylesheet', 'href="mycss.css" type="text/css"');92 ok(domUtils.isProcessingInstructionNode(instruction));93 ok(!domUtils.isProcessingInstructionNode(document.createDocumentFragment()));94 ok(!domUtils.isProcessingInstructionNode(document.createElement('span')));95 ok(!domUtils.isProcessingInstructionNode(document.createElement('strong')));96 ok(!domUtils.isProcessingInstructionNode(document.createElement('a')));97 ok(!domUtils.isProcessingInstructionNode(null));98 ok(!domUtils.isProcessingInstructionNode(document.createTextNode('text')));99 if (window.Proxy)100 ok(!domUtils.isProcessingInstructionNode(new Proxy({}, {})));101});102test('isCommentNode (GH-1344)', function () {103 ok(domUtils.isCommentNode(document.createComment('comment')));104 ok(!domUtils.isCommentNode(document.createDocumentFragment()));105 ok(!domUtils.isCommentNode(document.createElement('span')));106 ok(!domUtils.isCommentNode(document.createElement('strong')));107 ok(!domUtils.isCommentNode(document.createElement('a')));108 ok(!domUtils.isCommentNode(null));109 ok(!domUtils.isCommentNode(document.createTextNode('text')));110 if (window.Proxy)111 ok(!domUtils.isCommentNode(new Proxy({}, {})));112});113test('isDocument (GH-1344)', function () {114 ok(domUtils.isDocument(document));115 ok(domUtils.isDocument(document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html', null)));116 ok(domUtils.isDocument(document.implementation.createHTMLDocument('title')));117 ok(!domUtils.isDocument(document.createElement('span')));118 ok(!domUtils.isDocument(document.createElement('strong')));119 ok(!domUtils.isDocument(document.createElement('a')));120 ok(!domUtils.isDocument(null));121 ok(!domUtils.isDocument(document.createTextNode('text')));122 ok(!domUtils.isDocument(document.createDocumentFragment()));123 if (window.Proxy)124 ok(!domUtils.isDocument(new Proxy({}, {})));125});126test('isWebSocket', function () {127 var webSocket = new WebSocket('ws://127.0.0.1:2000/');128 ok(domUtils.isWebSocket(webSocket));129 ok(!domUtils.isWebSocket(document));130 ok(!domUtils.isWebSocket({}));131 ok(!domUtils.isWebSocket({ url: 'ws://127.0.0.1:2000/' }));132 ok(!domUtils.isWebSocket(null));133 webSocket.close();134});135test('isMessageEvent', function () {136 return createTestIframe()137 .then(function (iframe) {138 var iframeWindow = iframe.contentWindow;139 iframeWindow['%hammerhead%'].sandbox.event.message.postMessage(window, ['message', '*']);140 return new Promise(function (resolve) {141 window.addEventListener('message', resolve);142 });143 })144 .then(function (eventObj) {145 ok(domUtils.isMessageEvent(eventObj));146 ok(!domUtils.isMessageEvent(document));147 ok(!domUtils.isMessageEvent({}));148 ok(!domUtils.isMessageEvent({ target: window }));149 ok(!domUtils.isMessageEvent(null));150 });151});152if (window.PerformanceNavigationTiming) {153 test('isPerformanceNavigationTiming', function () {154 ok(domUtils.isPerformanceNavigationTiming(window.performance.getEntriesByType('navigation')[0]));155 ok(!domUtils.isPerformanceNavigationTiming(window.performance.getEntriesByType('resource')[0]));156 ok(!domUtils.isPerformanceNavigationTiming(window.performance.getEntriesByType('paint')[0]));157 });158}159test('isArrayBuffer', function () {160 ok(domUtils.isArrayBuffer(new ArrayBuffer(0)), 'ArrayBuffer');161 ok(!domUtils.isArrayBuffer(void 0), 'undefined');162});163test('isArrayBufferView', function () {164 ok(domUtils.isArrayBufferView(new Uint8Array(0)), 'Uint8Array');165 ok(!domUtils.isArrayBufferView(void 0), 'undefined');166});167test('isDataView', function () {168 ok(domUtils.isDataView(new DataView(new ArrayBuffer(0))), 'DataView');169 ok(!domUtils.isDataView(void 0), 'undefined');170});171test('getTopSameDomainWindow', function () {172 return createTestIframe()173 .then(function (iframe) {174 strictEqual(domUtils.getTopSameDomainWindow(window.top), window.top);175 strictEqual(domUtils.getTopSameDomainWindow(iframe.contentWindow), window.top);176 });177});178test('isWindow', function () {179 ok(domUtils.isWindow(window));180 ok(!domUtils.isWindow({ top: '' }));181 var storedToString = window.toString;182 window.toString = function () {183 throw 'eid library overrides window.toString() method';184 };185 ok(domUtils.isWindow(window));186 ok(!domUtils.isWindow([187 {188 toString: function () {189 ok(false);190 }191 }192 ]));193 window.toString = storedToString;194 ok(!domUtils.isWindow(Object.create(Window.prototype)));195});196test('isWindow for a cross-domain window', function () {197 return createTestIframe({ src: getCrossDomainPageUrl('../../data/cross-domain/simple-page.html') })198 .then(function (iframe) {199 var iframeWindow = iframe.contentWindow;200 ok(domUtils.isWindow(iframeWindow));201 // NOTE: The firefox does not provide access to the cross-domain location.202 if (!browserUtils.isFirefox)203 ok(!domUtils.isWindow(iframeWindow.location));204 });205});206test('isWindow for a window received from the MessageEvent.target property (GH-1445)', function () {207 return createTestIframe()208 .then(function (iframe) {209 var iframeWindow = iframe.contentWindow;210 iframeWindow['%hammerhead%'].sandbox.event.message.postMessage(window, ['message', '*']);211 return new Promise(function (resolve) {212 window.addEventListener('message', resolve);213 });214 })215 .then(function (eventObj) {216 ok(domUtils.isWindow(eventObj.target));217 });218});219test('closest', function () {220 var div = document.createElement('div');221 div.className = 'parent';222 div = document.body.appendChild(div);223 var innerDiv = document.createElement('div');224 innerDiv.className = 'child';225 div.appendChild(innerDiv);226 ok(!domUtils.closest(null, '.test'));227 strictEqual(domUtils.closest(innerDiv, '.parent'), div);228 strictEqual(domUtils.closest(div, 'html'), document.documentElement);229 var iframe = document.createElement('iframe');230 iframe.id = 'test5';231 iframe = document.body.appendChild(iframe);232 var iframeDiv = iframe.contentDocument.createElement('div');233 iframeDiv.className = 'parent';234 iframeDiv = iframe.contentDocument.body.appendChild(iframeDiv);235 var innerIframeDiv = iframe.contentDocument.createElement('div');236 innerIframeDiv.className = 'child';237 iframeDiv.appendChild(innerIframeDiv);238 strictEqual(domUtils.closest(innerIframeDiv, '.parent'), iframeDiv);239 strictEqual(domUtils.closest(iframeDiv, 'body'), iframe.contentDocument.body);240 iframe.parentNode.removeChild(iframe);241 div.parentNode.removeChild(div);242});243test('match', function () {244 var div = document.createElement('div');245 document.body.appendChild(div);246 ok(domUtils.matches(div, 'div'));247 div.parentNode.removeChild(div);248});249test('isSVGElement', function () {250 ok(!domUtils.isSVGElement(null));251 ok(!domUtils.isSVGElement(document));252 ok(!domUtils.isSVGElement(document.documentElement));253 ok(domUtils.isSVGElement(document.createElementNS('http://www.w3.org/2000/svg', 'svg')));254 ok(domUtils.isSVGElement(document.createElementNS('http://www.w3.org/2000/svg', 'use')));255 ok(!domUtils.isSVGElement(document.createElement('div')));256});257test('isSVGElement for iframe elements', function () {258 return createTestIframe()259 .then(function (iframe) {260 var iframeDocument = iframe.contentDocument;261 ok(!domUtils.isSVGElement(null));262 ok(!domUtils.isSVGElement(iframeDocument));263 ok(!domUtils.isSVGElement(iframeDocument.documentElement));264 ok(domUtils.isSVGElement(iframeDocument.createElementNS('http://www.w3.org/2000/svg', 'svg')));265 ok(domUtils.isSVGElement(iframeDocument.createElementNS('http://www.w3.org/2000/svg', 'use')));266 ok(!domUtils.isSVGElement(iframeDocument.createElement('div')));267 });268});269if (window.fetch) {270 test('isFetchHeaders', function () {271 ok(!domUtils.isFetchHeaders(null));272 ok(!domUtils.isFetchHeaders(document));273 ok(!domUtils.isFetchHeaders(document.documentElement));274 ok(!domUtils.isFetchHeaders(window.Headers));275 ok(domUtils.isFetchHeaders(new window.Headers()));276 });277 test('isFetchHeaders in iframe', function () {278 return createTestIframe()279 .then(function (iframe) {280 var iframeDocument = iframe.contentDocument;281 var iframeWindow = iframe.contentWindow;282 ok(!domUtils.isFetchHeaders(null));283 ok(!domUtils.isFetchHeaders(iframeDocument));284 ok(!domUtils.isFetchHeaders(iframeDocument.documentElement));285 ok(!domUtils.isFetchHeaders(iframeWindow.Headers));286 ok(domUtils.isFetchHeaders(new iframeWindow.Headers()));287 });288 });289 test('isFetchRequest', function () {290 ok(!domUtils.isFetchRequest(null));291 ok(!domUtils.isFetchRequest(document));292 ok(!domUtils.isFetchRequest(document.documentElement));293 ok(!domUtils.isFetchRequest(window.Request));294 ok(domUtils.isFetchRequest(new window.Request('http://domain.com')));295 });296 test('isFetchRequest in iframe', function () {297 return createTestIframe()298 .then(function (iframe) {299 var iframeDocument = iframe.contentDocument;300 var iframeWindow = iframe.contentWindow;301 ok(!domUtils.isFetchRequest(null));302 ok(!domUtils.isFetchRequest(iframeDocument));303 ok(!domUtils.isFetchRequest(iframeDocument.documentElement));304 ok(!domUtils.isFetchRequest(iframeWindow.Request));305 ok(domUtils.isFetchRequest(new iframeWindow.Request('http://domain.com')));306 });307 });308 test('window.Request should work with the operator "instanceof" (GH-690)', function () {309 var request = new Request();310 ok(request instanceof window.Request);311 });312}313test('isHammerheadAttr', function () {314 ok(!domUtils.isHammerheadAttr('href'));315 ok(!domUtils.isHammerheadAttr('class'));316 ok(domUtils.isHammerheadAttr('data-hammerhead-focused'));317 ok(domUtils.isHammerheadAttr('data-hammerhead-hovered'));318 ok(domUtils.isHammerheadAttr('src-hammerhead-stored-value'));319});320test('isContentEditableElement', function () {321 notOk(domUtils.isContentEditableElement(null));322 document.designMode = 'on';323 ok(domUtils.isContentEditableElement(document));324 ok(domUtils.isContentEditableElement(document.body));325 document.designMode = 'off';326 // isRenderedNode327 var doc = new DOMParser().parseFromString('<xml></xml>', 'application/xml');328 var instruction = doc.createProcessingInstruction('xml-stylesheet', 'href="mycss.css" type="text/css"');329 notOk(domUtils.isContentEditableElement(instruction));330 notOk(domUtils.isContentEditableElement(document.createElement('script')));331 notOk(domUtils.isContentEditableElement(document.createElement('style')));332 notOk(domUtils.isContentEditableElement(document.createComment('comment text')));333 // isAlwaysNotEditableElement334 notOk(domUtils.isContentEditableElement(document.createElement('select')));335 notOk(domUtils.isContentEditableElement(document.createElement('option')));336 // NOTE: Disable due to IEWebDriver problem (Saucelabs)337 //notOk(domUtils.isContentEditableElement(document.createElement('applet')));338 notOk(domUtils.isContentEditableElement(document.createElement('area')));339 notOk(domUtils.isContentEditableElement(document.createElement('audio')));340 notOk(domUtils.isContentEditableElement(document.createElement('canvas')));341 notOk(domUtils.isContentEditableElement(document.createElement('datalist')));342 notOk(domUtils.isContentEditableElement(document.createElement('keygen')));343 notOk(domUtils.isContentEditableElement(document.createElement('map')));344 notOk(domUtils.isContentEditableElement(document.createElement('meter')));345 notOk(domUtils.isContentEditableElement(document.createElement('object')));346 notOk(domUtils.isContentEditableElement(document.createElement('progress')));347 notOk(domUtils.isContentEditableElement(document.createElement('source')));348 notOk(domUtils.isContentEditableElement(document.createElement('track')));349 notOk(domUtils.isContentEditableElement(document.createElement('video')));350 notOk(domUtils.isContentEditableElement(document.createElement('img')));351 notOk(domUtils.isContentEditableElement(document.createElement('input')));352 notOk(domUtils.isContentEditableElement(document.createElement('textarea')));353 notOk(domUtils.isContentEditableElement(document.createElement('button')));354 var parentElement = document.createElement('div');355 var element = document.createElement('p');356 var textNode = document.createTextNode('text');357 parentElement.appendChild(element);358 element.appendChild(textNode);359 notOk(domUtils.isContentEditableElement(parentElement));360 notOk(domUtils.isContentEditableElement(element));361 notOk(domUtils.isContentEditableElement(textNode));362 //TODO: GH - 1369363 if (!browserUtils.isAndroid) {364 parentElement.setAttribute('contenteditable', '');365 ok(domUtils.isContentEditableElement(parentElement));366 ok(domUtils.isContentEditableElement(element));367 ok(domUtils.isContentEditableElement(textNode));368 }369 // GH-1366370 var elementMock = {371 isContentEditable: true,372 tagName: 'rich-text-area',373 getAttribute: function () {374 return 'null';375 }376 };377 ok(domUtils.isContentEditableElement(elementMock));378});379test('isElementInDocument', function () {380 var shadowParent = document.createElement('div');381 ok(domUtils.isElementInDocument(document.body));382 notOk(domUtils.isElementInDocument(shadowParent));383 if (!nativeMethods.attachShadow)384 return;385 var shadow = shadowParent.attachShadow({ mode: 'open' });386 var div = document.createElement('div');387 notOk(domUtils.isElementInDocument(div));388 shadow.appendChild(div);389 notOk(domUtils.isElementInDocument(div));390 document.body.appendChild(shadowParent);391 ok(domUtils.isElementInDocument(shadowParent));392 ok(domUtils.isElementInDocument(div));393 var nestedShadowDiv = document.createElement('div');394 var nestedShadow = div.attachShadow({ mode: 'closed' });395 nestedShadow.appendChild(nestedShadowDiv);396 ok(domUtils.isElementInDocument(nestedShadowDiv));397 document.body.removeChild(shadowParent);398});399module('isIframeWithoutSrc');400test('should not process an iframe with a same url twice (GH-1419)', function () {401 var nestedIframe = null;402 return createTestIframe({ src: getSameDomainPageUrl('../../data/same-domain/form-target-to-iframe.html') })403 .then(function (iframe) {404 var iframeDocument = iframe.contentDocument;405 var formSubmit = iframeDocument.querySelector('form > input[type=submit]');406 nestedIframe = iframeDocument.querySelector('iframe');407 ok(domUtils.isIframeWithoutSrc(nestedIframe));408 return new Promise(function (resolve) {409 nestedIframe.addEventListener('load', resolve);410 formSubmit.click();411 });412 })413 .then(function () {414 var nestedIframeHammerhead = nestedIframe.contentWindow['%hammerhead%'];415 var nestedIframeNativeAddEventListener = nestedIframeHammerhead.nativeMethods.windowAddEventListener || nestedIframeHammerhead.nativeMethods.addEventListener;416 var stringifiedAddEventListener = nestedIframeNativeAddEventListener.toString();417 ok(/\s*function\s+[^\s(]*\s*\([^)]*\)\s*{\s*\[native code]\s*}\s*/.test(stringifiedAddEventListener));418 ok(!domUtils.isIframeWithoutSrc(nestedIframe));419 });420});421test('after the location is set to an iframe without src isIframeWithoutSrc should return "false"', function () {422 return createTestIframe()423 .then(function (iframe) {424 var src = getSameDomainPageUrl('../../data/same-domain/service-message-from-removed-iframe.html');425 ok(domUtils.isIframeWithoutSrc(iframe));426 return new Promise(function (resolve) {427 iframe.addEventListener('load', function () {428 resolve(iframe);429 });430 iframe.contentWindow.location = src;431 });432 })433 .then(function (iframe) {434 ok(!domUtils.isIframeWithoutSrc(iframe));435 });436});437// NOTE: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8187450/438if (!browserUtils.isIE) {439 test('should return "false" after calling document.open, document.write, document.close for the same-domain iframe (GH-703) (GH-704)', function () {440 return createTestIframe({ src: getSameDomainPageUrl('../../data/code-instrumentation/iframe.html') })441 .then(function (iframe) {442 ok(!domUtils.isIframeWithoutSrc(iframe));443 iframe.contentDocument.open();444 ok(domUtils.isIframeWithoutSrc(iframe));445 iframe.contentDocument.write('<h1>test</h1>');446 ok(domUtils.isIframeWithoutSrc(iframe));447 iframe.contentDocument.close();448 ok(domUtils.isIframeWithoutSrc(iframe));449 });450 });451}452test('should return "false" after calling document.open, document.write, document.close for the iframe with javascript src (GH-815)', function () {453 return createTestIframe({ src: 'javascript:false;' })454 .then(function (iframe) {455 ok(domUtils.isIframeWithoutSrc(iframe));456 iframe.contentDocument.open();457 ok(domUtils.isIframeWithoutSrc(iframe));458 iframe.contentDocument.write('<h1>test</h1>');459 ok(domUtils.isIframeWithoutSrc(iframe));460 iframe.contentDocument.close();461 ok(domUtils.isIframeWithoutSrc(iframe));462 });463});464test('changed location 2', function () {465 return createTestIframe({ src: 'about:blank' })466 .then(function (iframe) {467 return new Promise(function (resolve) {468 iframe.addEventListener('load', function () {469 resolve(iframe);470 });471 iframe.contentWindow.location = 'http://' + location.host + '/';472 });473 })474 .then(function (iframe) {475 iframe[INTERNAL_PROPS.processedContext] = window;476 ok(!domUtils.isIframeWithoutSrc(iframe));477 ok(!domUtils.isCrossDomainIframe(iframe));478 });479});480test('crossdomain src', function () {481 return createTestIframe({ src: getCrossDomainPageUrl('../../data/cross-domain/simple-page.html') })482 .then(function (iframe) {483 iframe[INTERNAL_PROPS.processedContext] = window;484 ok(!domUtils.isIframeWithoutSrc(iframe));485 ok(domUtils.isCrossDomainIframe(iframe));486 });487});488test('samedomain src', function () {489 var iframe = document.createElement('iframe');490 iframe.id = 'test' + Date.now();491 iframe.src = 'http://' + location.host + '/';492 ok(!domUtils.isIframeWithoutSrc(iframe));493 var promise = window.QUnitGlobals.waitForIframe(iframe)494 .then(function () {495 iframe[INTERNAL_PROPS.processedContext] = window;496 ok(!domUtils.isIframeWithoutSrc(iframe));497 ok(!domUtils.isCrossDomainIframe(iframe));498 iframe.parentNode.removeChild(iframe);499 });500 document.body.appendChild(iframe);501 ok(!domUtils.isIframeWithoutSrc(iframe));502 return promise;503});504test('without src attribute', function () {505 return createTestIframe()506 .then(function (iframe) {507 iframe[INTERNAL_PROPS.processedContext] = window;508 ok(domUtils.isIframeWithoutSrc(iframe));509 ok(!domUtils.isCrossDomainIframe(iframe));510 });511});512test('about:blank', function () {513 return createTestIframe({ src: 'about:blank' })514 .then(function (iframe) {515 iframe[INTERNAL_PROPS.processedContext] = window;516 ok(domUtils.isIframeWithoutSrc(iframe));517 ok(!domUtils.isCrossDomainIframe(iframe));518 });519});520module('isCrossDomainIframe');521test('location is changed to cross-domain', function () {522 return createTestIframe({ src: 'http://' + location.host + '/' })523 .then(function (iframe) {524 ok(!domUtils.isCrossDomainIframe(iframe));525 ok(!domUtils.isCrossDomainIframe(iframe, true));526 return new Promise(function (resolve) {527 iframe.addEventListener('load', function () {528 resolve(iframe);529 });530 iframe.contentDocument.location.href = getCrossDomainPageUrl('../../data/cross-domain/simple-page.html');531 });532 })533 .then(function (iframe) {534 ok(domUtils.isCrossDomainIframe(iframe));535 ok(!domUtils.isCrossDomainIframe(iframe, true));536 });537});538test('empty src attribute', function () {539 return createTestIframe({ src: '' })540 .then(function (iframe) {541 iframe[INTERNAL_PROPS.processedContext] = window;542 ok(domUtils.isIframeWithoutSrc(iframe));543 ok(!domUtils.isCrossDomainIframe(iframe));544 });545});546module('class manipulation');547test('addClass', function () {548 var div = document.createElement('div');549 document.body.appendChild(div);550 domUtils.addClass(null, 'test');551 strictEqual(div.className, '');552 domUtils.addClass(div, 'test');553 strictEqual(div.className, 'test');554 div.className = 'test1';555 domUtils.addClass(div, 'test2 test3');556 strictEqual(div.className, 'test1 test2 test3');557 div.className = 'test1 test2';558 domUtils.addClass(div, 'test2 test3');559 strictEqual(div.className, 'test1 test2 test3');560 div.parentNode.removeChild(div);561});562test('removeClass', function () {563 var div = document.createElement('div');564 document.body.appendChild(div);565 domUtils.removeClass(null, 'test');566 domUtils.removeClass(div, 'test');567 strictEqual(div.className, '');568 div.className = 'test';569 domUtils.removeClass(div, 'test');570 strictEqual(div.className, '');571 div.className = 'test1 test2 test3';572 domUtils.removeClass(div, 'test1');573 strictEqual(div.className, 'test2 test3');574 div.className = 'test1 test2 test3';575 domUtils.removeClass(div, 'test2');576 strictEqual(div.className, 'test1 test3');577 div.className = 'test1 test2 test3';578 domUtils.removeClass(div, 'test3');579 strictEqual(div.className, 'test1 test2');580 div.className = 'test1 test2 test3';581 domUtils.removeClass(div, 'test1 test3');582 strictEqual(div.className, 'test2');583 div.parentNode.removeChild(div);584});585test('hasClass', function () {586 var div = document.createElement('div');587 document.body.appendChild(div);588 ok(!domUtils.hasClass(null, 'test'));589 div.className = 'test';590 ok(domUtils.hasClass(div, 'test'));591 div.className = 'test1 test2 test3';592 ok(domUtils.hasClass(div, 'test1'));593 ok(domUtils.hasClass(div, 'test2'));594 ok(domUtils.hasClass(div, 'test3'));595 div.parentNode.removeChild(div);596});597test('isElementFocusable', function () {598 var src = getSameDomainPageUrl('../../data/is-focusable/iframe.html', 'is-focusable/iframe.html');599 return createTestIframe({ src: src })600 .then(function (iframe) {601 iframe.style.width = '500px';602 iframe.style.height = '500px';603 var iframeDocument = iframe.contentDocument;604 var allElements = iframeDocument.querySelectorAll('*');605 var expectedFocusedElements = Array.prototype.slice.call(iframeDocument.querySelectorAll('.expected'));606 var focusedElements = [];607 if (browserUtils.isIE) {608 expectedFocusedElements = expectedFocusedElements.filter(function (el) {609 if (browserUtils.version <= 10 && domUtils.isAnchorElement(el) && el.getAttribute('href') === '' &&610 domUtils.getTabIndex(el) === null)611 return false;612 return !domUtils.isOptionElement(el);613 });614 }615 else {616 expectedFocusedElements = expectedFocusedElements.filter(function (el) {617 return !domUtils.isTableDataCellElement(el);618 });619 }620 for (var i = 0; i < allElements.length; i++) {621 if (domUtils.isElementFocusable(allElements[i]))622 focusedElements.push(allElements[i]);623 }624 deepEqual(expectedFocusedElements, focusedElements);625 });626});627test('isTextEditableInput', function () {628 var editableTypes = {629 'color': false,630 'date': false,631 'datetime-local': false,632 'email': true,633 'month': false,634 'number': true,635 'password': true,636 'range': false,637 'search': true,638 'tel': true,639 'text': true,640 'time': false,641 'url': true,642 'week': false643 };644 var input = nativeMethods.createElement.call(document, 'input');645 // NOTE: check element with empty "type" attribute646 ok(domUtils.isTextEditableInput(input));647 for (var type in editableTypes) {648 if (editableTypes.hasOwnProperty(type)) {649 input.setAttribute('type', type);650 strictEqual(domUtils.isTextEditableInput(input), editableTypes[type]);651 }652 }653});654test('isInputWithoutSelectionProperties', function () {655 var input1 = nativeMethods.createElement.call(document, 'input');656 var input2 = nativeMethods.createElement.call(document, 'input');657 var input3 = nativeMethods.createElement.call(document, 'input');658 input1.type = 'email';659 input2.type = 'number';660 input3.type = 'text';661 if (browserUtils.isIE || browserUtils.isSafari) {662 notOk(domUtils.isInputWithoutSelectionProperties(input1));663 notOk(domUtils.isInputWithoutSelectionProperties(input2));664 }665 else {666 ok(domUtils.isInputWithoutSelectionProperties(input1));667 ok(domUtils.isInputWithoutSelectionProperties(input2));668 }669 notOk(domUtils.isInputWithoutSelectionProperties(input3));670});671test('isElementReadOnly', function () {672 var input = document.createElement('input');673 ok(!domUtils.isElementReadOnly(input));674 input.readOnly = true;675 ok(domUtils.isElementReadOnly(input));676 input.readOnly = false;677 ok(!domUtils.isElementReadOnly(input));678 input.setAttribute('readOnly', 'readOnly');679 ok(domUtils.isElementReadOnly(input));680});681module('regression');682test('isDocument infinite recursion (GH-923)', function () {683 var obj = eval(processScript('({ toString: function () { this.location = 1; } })'));684 ok(!domUtils.isDocument(obj));685});686test('isDocument for a cross-domain object (GH-467)', function () {687 return createTestIframe({ src: getCrossDomainPageUrl('../../data/cross-domain/target-url.html') })688 .then(function (iframe) {689 ok(!domUtils.isDocument(iframe.contentWindow));690 });691});692test('isDomElement for <object> tag (B252941)', function () {693 var objectElement = document.createElement('object');694 document.body.appendChild(objectElement);695 ok(domUtils.isDomElement(objectElement));696 objectElement.parentNode.removeChild(objectElement);697});698asyncTest('cross domain iframe that contains iframe without src should not throw the security error (GH-114)', function () {699 var iframe = document.createElement('iframe');700 iframe.src = getCrossDomainPageUrl('../../data/cross-domain/page-with-iframe-with-js-protocol.html');701 window.addEventListener('message', function (e) {702 strictEqual(e.data, 'ok');703 document.body.removeChild(iframe);704 start();705 });706 document.body.appendChild(iframe);707});708if (!browserUtils.isFirefox) {709 test('getIframeByElement', function () {710 var parentIframe = null;711 var childIframe = null;712 return createTestIframe()713 .then(function (iframe) {714 parentIframe = iframe;715 return createTestIframe(null, parentIframe.contentDocument.body);716 })717 .then(function (iframe) {718 childIframe = iframe;719 var parentIframeUtils = parentIframe.contentWindow['%hammerhead%'].utils.dom;720 var childIframeUtils = childIframe.contentWindow['%hammerhead%'].utils.dom;721 strictEqual(domUtils.getIframeByElement(parentIframe.contentDocument.body), parentIframe);722 strictEqual(domUtils.getIframeByElement(childIframe.contentDocument.body), childIframe);723 strictEqual(childIframeUtils.getIframeByElement(parentIframe.contentDocument.body), parentIframe);724 strictEqual(childIframeUtils.getIframeByElement(childIframe.contentDocument.body), childIframe);725 strictEqual(parentIframeUtils.getIframeByElement(parentIframe.contentDocument.body), parentIframe);726 strictEqual(parentIframeUtils.getIframeByElement(childIframe.contentDocument.body), childIframe);727 });728 });729}730test("An object with the 'tagName' and 'nodeName' properties shouldn't be recognized as a dom element", function () {731 notOk(domUtils.isIframeElement({ tagName: 'iframe', nodeName: 'iframe' }), 'iframe');732 notOk(domUtils.isFrameElement({ tagName: 'frame', nodeName: 'frame' }), 'frame');733 notOk(domUtils.isImgElement({ tagName: 'img', nodeName: 'img' }), 'img');734 notOk(domUtils.isInputElement({ tagName: 'input', nodeName: 'input' }), 'input');735 notOk(domUtils.isHtmlElement({ tagName: 'html', nodeName: 'html' }), 'html');736 notOk(domUtils.isBodyElement({ tagName: 'body', nodeName: 'body' }), 'body');737 notOk(domUtils.isHeadElement({ tagName: 'head', nodeName: 'head' }), 'head');738 notOk(domUtils.isHeadOrBodyElement({ tagName: 'body', nodeName: 'body' }), 'body');739 notOk(domUtils.isHeadOrBodyElement({ tagName: 'head', nodeName: 'head' }), 'head');740 notOk(domUtils.isBaseElement({ tagName: 'base', nodeName: 'base' }), 'base');741 notOk(domUtils.isScriptElement({ tagName: 'script', nodeName: 'script' }), 'script');742 notOk(domUtils.isStyleElement({ tagName: 'style', nodeName: 'style' }), 'style');743 notOk(domUtils.isLabelElement({ tagName: 'label', nodeName: 'label' }), 'label');744 notOk(domUtils.isTextAreaElement({ tagName: 'textarea', nodeName: 'textarea' }), 'textarea');745 notOk(domUtils.isOptionElement({ tagName: 'option', nodeName: 'option' }), 'option');746 notOk(domUtils.isSelectElement({ tagName: 'select', nodeName: 'select' }), 'select');747 notOk(domUtils.isFormElement({ tagName: 'form', nodeName: 'form' }), 'form');748 notOk(domUtils.isMapElement({ tagName: 'map', nodeName: 'map' }), 'map');749 notOk(domUtils.isMapElement({ tagName: 'area', nodeName: 'area' }), 'area');750 notOk(domUtils.isAnchorElement({ tagName: 'a', nodeName: 'a' }), 'a');751 notOk(domUtils.isTableElement({ tagName: 'table', nodeName: 'table' }), 'table');752 notOk(domUtils.isTableDataCellElement({ tagName: 'td', nodeName: 'td' }), 'td');753});754test('inspect html elements', function () {755 const htmlElements = [756 { tagName: 'iframe', assertFn: domUtils.isIframeElement },757 { tagName: 'frame', assertFn: domUtils.isFrameElement },758 { tagName: 'img', assertFn: domUtils.isImgElement },759 { tagName: 'input', assertFn: domUtils.isInputElement },760 { tagName: 'html', assertFn: domUtils.isHtmlElement },761 { tagName: 'body', assertFn: domUtils.isBodyElement },762 { tagName: 'head', assertFn: domUtils.isHeadElement },763 { tagName: 'body', assertFn: domUtils.isHeadOrBodyElement },764 { tagName: 'head', assertFn: domUtils.isHeadOrBodyElement },765 { tagName: 'base', assertFn: domUtils.isBaseElement },766 { tagName: 'script', assertFn: domUtils.isScriptElement },767 { tagName: 'style', assertFn: domUtils.isStyleElement },768 { tagName: 'label', assertFn: domUtils.isLabelElement },769 { tagName: 'textarea', assertFn: domUtils.isTextAreaElement },770 { tagName: 'option', assertFn: domUtils.isOptionElement },771 { tagName: 'select', assertFn: domUtils.isSelectElement },772 { tagName: 'form', assertFn: domUtils.isFormElement },773 { tagName: 'map', assertFn: domUtils.isMapElement },774 { tagName: 'area', assertFn: domUtils.isMapElement },775 { tagName: 'a', assertFn: domUtils.isAnchorElement },776 { tagName: 'table', assertFn: domUtils.isTableElement },777 { tagName: 'td', assertFn: domUtils.isTableDataCellElement },778 { tagName: 'input', assertFn: domUtils.isRadioButtonElement, attributes: { type: 'radio' } },779 { tagName: 'input', assertFn: domUtils.isCheckboxElement, attributes: { type: 'checkbox' } }780 ];781 if (!browserUtils.isIE11 && !browserUtils.isSafari)782 htmlElements.push({ tagName: 'input', assertFn: domUtils.isColorInputElement, attributes: { type: 'color' } });783 htmlElements.forEach(function (info) {784 var existingTags = ['html', 'body', 'script', 'head'];785 var element = null;786 if (existingTags.indexOf(info.tagName) > -1)787 element = nativeMethods.querySelector.call(document, info.tagName);788 else789 element = nativeMethods.createElement.call(document, info.tagName);790 if (info.attributes) {791 Object.keys(info.attributes).forEach(function (attr) {792 nativeMethods.setAttribute.call(element, attr, info.attributes[attr]);793 });794 }795 ok(info.assertFn(element), info.tagName);796 });797});798test('isInputWithNativeDialog', function () {799 var checkedInputTypes = ['color', 'date', 'datetime-local', 'month', 'week'];800 var countCheckedTypes = 0;801 for (var i = 0; i < checkedInputTypes.length; i++) {802 var checkedInputType = checkedInputTypes[i];803 var checkedInput = document.createElement('input');804 checkedInput.type = checkedInputType;805 // NOTE: check the browser support for the specified input type806 if (checkedInput.type !== checkedInputType)807 continue;808 countCheckedTypes++;809 ok(domUtils.isInputWithNativeDialog(checkedInput), checkedInputType);810 }811 if (countCheckedTypes === 0)812 expect(0);813});814if (browserUtils.isChrome) {815 test('should return active element inside shadow DOM', function () {816 var host = document.createElement('div');817 var root = host.attachShadow({ mode: 'open' });818 var input = document.createElement('input');819 document.body.appendChild(host);820 root.appendChild(input);821 nativeMethods.focus.call(input);822 strictEqual(domUtils.getActiveElement(), input);823 document.body.removeChild(host);824 });825 test('should return active element inside nested shadow DOM', function () {826 var hostParent = document.createElement('div');827 var hostChild = document.createElement('div');828 var rootParent = hostParent.attachShadow({ mode: 'open' });829 var rootChild = hostChild.attachShadow({ mode: 'open' });830 var input = document.createElement('input');831 document.body.appendChild(hostParent);832 rootParent.appendChild(hostChild);833 rootChild.appendChild(input);834 nativeMethods.focus.call(input);835 strictEqual(domUtils.getActiveElement(), input);836 document.body.removeChild(hostParent);837 });838}839if (window.HTMLElement.prototype.attachShadow) {840 test('isShadowRoot', function () {841 notOk(domUtils.isShadowRoot(null));842 notOk(domUtils.isShadowRoot(document));843 notOk(domUtils.isShadowRoot(window));844 notOk(domUtils.isShadowRoot(document.createElement('div')));845 ok(domUtils.isShadowRoot(document.createElement('div').attachShadow({ mode: 'open' })));846 });847 test('"getParents" should work properly for elements inside shadowDOM', function () {848 var host = document.createElement('div');849 var root = host.attachShadow({ mode: 'open' });850 var div = document.createElement('div');851 var input = document.createElement('input');852 document.body.appendChild(host);853 div.appendChild(input);854 root.appendChild(div);855 var parents = domUtils.getParents(input);856 deepEqual(parents, [div, host, document.body, document.documentElement]);857 document.body.removeChild(host);858 });859 test('"getParents" should work property for elements with slots/templates', function () {860 var template = document.createElement('template');861 template.innerHTML = '<div class=\'slot-parent\'><slot name=\'slot-name\'></slot></div>';862 // NOTE: bypass IE syntax validation863 customElements.define('custom-test-element', eval(864 '(class El extends HTMLElement { ' +865 'constructor () { ' +866 ' super(); ' +867 ' var templateContent = template.content; ' +868 ' this.attachShadow({ mode: \'open\' }).appendChild(templateContent.cloneNode(true)); ' +869 '} ' +870 '})'871 ));872 var custom = document.createElement('custom-test-element');873 var button = document.createElement('button');874 custom.innerHTML = '<div class="div-slot" slot="slot-name"></div>';875 button.innerHTML = 'Click me';876 var slotParent = custom.shadowRoot.querySelector('div.slot-parent');877 var slotContent = custom.querySelector('div.div-slot');878 slotContent.appendChild(button);879 document.body.appendChild(custom);880 deepEqual(domUtils.getParents(button), [slotContent, slotParent, custom, document.body, document.documentElement]);881 document.body.removeChild(custom);882 });883}884if (window.HTMLElement.prototype.matches && window.HTMLElement.prototype.closest) {885 test('`closest` and `matches` methods should use stored native methods (GH-1603)', function () {886 var div = document.createElement('div');887 var storedMatchesFn = window.HTMLElement.prototype.matches;888 window.HTMLElement.prototype.matches = function () {889 ok(false, 'Should not use the `HTMLElement.prototype.matches` method');890 };891 window.HTMLElement.prototype.closest = function () {892 ok(false, 'Should not use the `HTMLElement.prototype.closest method`');893 };894 document.body.appendChild(div);895 ok(domUtils.matches(div, 'div'));896 strictEqual(domUtils.closest(div, 'div'), div);897 window.HTMLElement.prototype.matches = storedMatchesFn;898 });899}900test('hammerhead should use the native classList getter in addClass, removeClass and hasClass functions (GH-1890)', function () {901 var div = document.createElement('div');902 var elementClassListPropOwnerName = window.Element.prototype.hasOwnProperty('classList') ? 'Element' : 'HTMLElement';903 var storedСlassListDescriptor = Object.getOwnPropertyDescriptor(window[elementClassListPropOwnerName].prototype, 'classList');904 Object.defineProperty(window[elementClassListPropOwnerName].prototype, 'classList', {905 get: function () { /* eslint-disable-line getter-return */906 ok(false);907 },908 configurable: true909 });910 document.body.appendChild(div);911 domUtils.addClass(div, 'test');912 ok(domUtils.hasClass(div, 'test'));913 domUtils.removeClass(div, 'test');914 div.parentNode.removeChild(div);915 Object.defineProperty(window[elementClassListPropOwnerName], 'classList', storedСlassListDescriptor);916});917test('should not throw an error when process a script inside the svg (GH-2735)', function () {918 var div = document.createElement('div');919 document.body.appendChild(div);920 div.innerHTML = [921 '<?xml version="1.0" standalone="no"?>',922 '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" ',923 ' "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',924 '<svg xmlns="http://www.w3.org/2000/svg" width="6cm" height="5cm" viewBox="0 0 600 500" version="1.1">',925 ' <script type="application/ecmascript"> <![CDATA[',926 ' var some = 123;',927 ' ]]> <\/script>', // eslint-disable-line928 '</svg>'929 ].join('\n');930 ok(true);931 document.body.removeChild(div);...

Full Screen

Full Screen

dom.js

Source:dom.js Github

copy

Full Screen

...129 element = el.parentElement || $(el).parent()[0];130 else131 element = el;132 if (element)133 isContentEditable = element.isContentEditable && !isAlwaysNotEditableElement(element) && !exports.isTextEditableElement(element);134 return exports.isRenderedNode(element) && (isContentEditable || exports.findDocument(el).designMode === 'on');135 };136 exports.isCrossDomainIframe = function (iframe, bySrc) {137 var iframeLocation = UrlUtil.getIframeLocation(iframe);138 if (!bySrc && iframeLocation.documentLocation === null)139 return true;140 var currentLocation = bySrc ? iframeLocation.srcLocation : iframeLocation.documentLocation;141 if (currentLocation && UrlUtil.isSupportedProtocol(currentLocation))142 return !UrlUtil.sameOriginCheck(location.toString(), currentLocation);143 return false;144 };145 exports.isCrossDomainWindows = function (window1, window2) {146 try {147 if (window1 === window2)...

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('#windows')5 .click('#submit-button');6 const articleHeader = await Selector('.result-content').find('h1');7 let headerText = await articleHeader.innerText;8});

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('#windows')5 .click('#submit-button');6});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2import { isAlwaysNotEditableElement } from 'testcafe-hammerhead';3test('Check if the element is always not editable', async t => {4 .expect(isAlwaysNotEditableElement(Selector('#developer-name').addCustomDOMProperties())).ok();5});6import { Selector } from 'testcafe';7import { isAlwaysNotEditableElement } from 'testcafe-hammerhead';8test('Check if the element is always not editable', async t => {9 .expect(isAlwaysNotEditableElement(Selector('#developer-name').addCustomDOMProperties())).ok();10});

Full Screen

Using AI Code Generation

copy

Full Screen

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

Full Screen

Using AI Code Generation

copy

Full Screen

1import { ClientFunction } from 'testcafe';2test('Test', async t => {3 const isAlwaysNotEditableElement = ClientFunction(() => {4 return window.testCafe.isAlwaysNotEditableElement;5 });6 console.log(await isAlwaysNotEditableElement());7});8export default {9};10export default {11};12export default {13};14export default {15};16export default {17};18export default {19};20export default {21};22export default {23};24export default {25};26export default {

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2const isAlwaysNotEditableElement = Selector(isAlwaysNotEditableElement);3test('My Test', async t => {4 .typeText('#developer-name', 'Peter')5 .click('#windows')6 .click('#submit-button')7 .expect(Selector('#article-header').innerText).eql('Thank you, Peter!');8});9function isAlwaysNotEditableElement (node) {10 return node.tagName === 'INPUT' && node.type === 'checkbox';11}12If you want to use a custom selector in a test, you need to import the selector function and use it in a test. For example, the following code imports the selector function and uses it in a test:13import { Selector } from 'testcafe';14const isAlwaysNotEditableElement = Selector(isAlwaysNotEditableElement);15test('My Test', async t => {16 .typeText('#developer-name', 'Peter')17 .click('#windows')18 .click('#submit-button')19 .expect(Selector('#article-header').innerText).eql('Thank you, Peter!');20});21function isAlwaysNotEditableElement (node) {22 return node.tagName === 'INPUT' && node.type === 'checkbox';23}

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2const element = Selector('input').with({ boundTestRun: testController });3await testController.expect(element.isAlwaysNotEditableElement()).ok();4import { Selector } from 'testcafe';5const element = Selector('input').with({ boundTestRun: testController });6await testController.expect(element.isAlwaysNotEditableElement()).notOk();7import { Selector } from 'testcafe';8const element = Selector('input').with({ boundTestRun: testController });9await testController.expect(element.isAlwaysNotEditableElement()).eql(true);10import { Selector } from 'testcafe';11const element = Selector('input').with({ boundTestRun: testController });12await testController.expect(element.isAlwaysNotEditableElement()).eql(false);13import { Selector } from 'testcafe';14const element = Selector('input').with({ boundTestRun: testController });15await testController.expect(element.isAlwaysNotEditableElement()).notEql(true);16import { Selector } from 'testcafe';17const element = Selector('input').with({ boundTestRun: testController });18await testController.expect(element.isAlwaysNotEditableElement()).notEql(false);19import { Selector } from 'testcafe';20const element = Selector('input').with({ boundTestRun: testController });21await testController.expect(element.isAlwaysNotEditableElement()).gt(0);22import { Selector } from 'testcafe';23const element = Selector('input').with({ boundTestRun: testController });24await testController.expect(element.isAlwaysNotEditableElement()).gte(0);25import { Selector

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2const selector = Selector('.my-class');3const isAlwaysNotEditable = selector.isAlwaysNotEditableElement();4import { Selector } from 'testcafe';5const selector = Selector('.my-class');6const isAlwaysNotEditable = selector.isAlwaysNotEditableElement();

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