How to use getContentFrame method in Playwright Internal

Best JavaScript code snippet using playwright-internal

Search.js

Source:Search.js Github

copy

Full Screen

1/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~2 ~ Copyright 2017 Adobe Systems Incorporated3 ~4 ~ Licensed under the Apache License, Version 2.0 (the "License");5 ~ you may not use this file except in compliance with the License.6 ~ You may obtain a copy of the License at7 ~8 ~ http://www.apache.org/licenses/LICENSE-2.09 ~10 ~ Unless required by applicable law or agreed to in writing, software11 ~ distributed under the License is distributed on an "AS IS" BASIS,12 ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 ~ See the License for the specific language governing permissions and14 ~ limitations under the License.15 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/16//* globals hobs,jQuery */17;(function(h, $) { // eslint-disable-line no-extra-semi18 "use strict";19 window.CQ.CoreComponentsIT.Search.v1 = window.CQ.CoreComponentsIT.Search.v1 || {};20 var c = window.CQ.CoreComponentsIT.commons;21 var search = window.CQ.CoreComponentsIT.Search.v1;22 var selectors = {23 component: {24 self: '[data-cmp-is="search"]',25 input: '[data-cmp-hook-search="input"]',26 clear: '[data-cmp-hook-search="clear"]',27 results: '[data-cmp-hook-search="results"]',28 item: {29 self: '[data-cmp-hook-search="item"]',30 mark: ".cmp-search__item-mark"31 }32 },33 editDialog: {34 self: ".cq-Dialog"35 }36 };37 var pollQuery = function(done, path, searchTerm, expected) {38 var maxRetries = 60;39 var timeout = 2000;40 var retries = 0;41 var match = false;42 var poll = function() {43 $.ajax({44 url: "/bin/querybuilder.json",45 method: "GET",46 data: {47 path: path,48 "p.limit": 100,49 fulltext: searchTerm,50 type: "cq:Page"51 }52 }).done(function(data) {53 if (data.hits && data.hits.length > 1) {54 data.hits.forEach(function(item) {55 if (item.path === expected) {56 match = true;57 }58 });59 }60 if (match) {61 done(true);62 } else {63 if (retries++ === maxRetries) {64 done(false, "Not able to get query result for " + expected);65 return;66 }67 setTimeout(poll, timeout);68 }69 }).fail(function(jqXHR, textStatus, errorThrown) {70 if (retries++ === maxRetries) {71 done(false, "pollQuery failed! " + textStatus + "," + errorThrown);72 return;73 }74 setTimeout(poll, timeout);75 });76 };77 poll();78 };79 search.tcExecuteBeforeTest = function(tcExecuteBeforeTest, searchRT, pageRT) {80 return new h.TestCase("Create Sample Content", {81 execBefore: tcExecuteBeforeTest })82 // level 183 .execFct(function(opts, done) {84 c.createPage(c.template, c.rootPage, "page_1_" + Date.now(), "page_1", done, pageRT);85 })86 .execFct(function(opts, done) {87 $.ajax({88 url: h.param("page_1")(),89 method: "POST",90 complete: done,91 dataType: "json",92 data: {93 "_charset_": "UTF-8",94 "./jcr:content/jcr:title": "Page 1"95 }96 });97 })98 // create 20 pages99 .execFct(function(opts, done) {100 for (var i = 0; i < 20; i++) {101 c.createPage(c.template, h.param("page_1")(), "page" + i, "page" + i, done, pageRT);102 }103 })104 .execFct(function(opts, done) {105 for (var i = 0; i < 20; i++) {106 $.ajax({107 url: h.param("page" + i)(),108 method: "POST",109 complete: done,110 data: {111 "_charset_": "UTF-8",112 "./jcr:content/jcr:title": "Page " + i113 }114 });115 }116 })117 // level 2118 .execFct(function(opts, done) {119 c.createPage(c.template, h.param("page_1")(), "page_1_1_" + Date.now(), "page_1_1", done, pageRT);120 })121 .execFct(function(opts, done) {122 $.ajax({123 url: h.param("page_1_1")(),124 method: "POST",125 complete: done,126 data: {127 "_charset_": "UTF-8",128 "./jcr:content/jcr:title": "Page 1.1"129 }130 });131 })132 // level 2 1133 .execFct(function(opts, done) {134 c.createPage(c.template, h.param("page_1_1")(), "page_1_1_1_" + Date.now(), "page_1_1_1", done, pageRT);135 })136 .execFct(function(opts, done) {137 $.ajax({138 url: h.param("page_1_1_1")(),139 method: "POST",140 complete: done,141 data: {142 "_charset_": "UTF-8",143 "./jcr:content/jcr:title": "Page 1.1.1"144 }145 });146 })147 // level 2 2148 .execFct(function(opts, done) {149 c.createPage(c.template, h.param("page_1_1")(), "page_1_1_2_" + Date.now(), "page_1_1_2", done, pageRT);150 })151 .execFct(function(opts, done) {152 $.ajax({153 url: h.param("page_1_1_2")(),154 method: "POST",155 complete: done,156 data: {157 "_charset_": "UTF-8",158 "./jcr:content/jcr:title": "Page 1.1.2"159 }160 });161 })162 // level 2 3163 .execFct(function(opts, done) {164 c.createPage(c.template, h.param("page_1_1")(), "page_1_1_3_" + Date.now(), "page_1_1_3", done, pageRT);165 })166 .execFct(function(opts, done) {167 $.ajax({168 url: h.param("page_1_1_3")(),169 method: "POST",170 complete: done,171 data: {172 "_charset_": "UTF-8",173 "./jcr:content/jcr:title": "Page 1.1.3"174 }175 });176 })177 // create a proxy component178 .execFct(function(opts, done) {179 c.createProxyComponent(searchRT, c.proxyPath, "compPath", done);180 })181 // add component182 .execFct(function(opts, done) {183 c.addComponent(h.param("compPath")(opts), h.param("page_1_1")(opts) + c.relParentCompPath, "cmpPath", done);184 })185 .navigateTo("/editor.html%page_1_1%.html");186 };187 /**188 * After Test Case189 */190 search.tcExecuteAfterTest = function(policyPath, policyAssignmentPath) {191 return new h.TestCase("Clean up after test", {192 execAfter: c.tcExecuteAfterTest })193 .execFct(function(opts, done) {194 c.deletePage(h.param("page_1")(opts), done);195 })196 .execFct(function(opts, done) {197 c.deletePolicy("/search", done, policyPath);198 })199 .execFct(function(opts, done) {200 c.deletePolicyAssignment("/search", done, policyAssignmentPath);201 })202 // delete the test page we created203 .execFct(function(opts, done) {204 c.deleteProxyComponent(h.param("compPath")(opts), done);205 });206 };207 /**208 * Test: Default configuration (search in current page tree)209 */210 search.testDefaultConfiguration = function(tcExecuteBeforeTest, tcExecuteAfterTest) {211 return new h.TestCase("Default configuration", {212 execBefore: tcExecuteBeforeTest,213 execAfter: tcExecuteAfterTest })214 .config.changeContext(c.getContentFrame)215 .execFct(function(opts, done) {216 pollQuery(done, c.rootPage, "Page", h.param("page_1_1_1")());217 })218 .fillInput(selectors.component.input, "Page", { delay: 1000 })219 .assert.visible(selectors.component.results)220 .assert.visible(selectors.component.item.self + '[href="' + h.config.context_path + '%page_1_1_1%.html"]');221 };222 /**223 * Test: Change search root (start level 4)224 */225 search.testChangeSearchRoot = function(tcExecuteBeforeTest, tcExecuteAfterTest) {226 return new h.TestCase("Change Search Root", {227 execBefore: tcExecuteBeforeTest,228 execAfter: tcExecuteAfterTest })229 .execTestCase(c.tcOpenConfigureDialog("cmpPath"))230 .fillInput('foundation-autocomplete[name="./searchRoot"]', "%page_1%")231 .execTestCase(c.tcSaveConfigureDialog)232 .config.changeContext(c.getContentFrame)233 .fillInput(selectors.component.input, "Page", { delay: 1000 })234 .assert.visible(selectors.component.item.self + '[href="' + h.config.context_path + '%page_1%.html"]', false);235 };236 /**237 * Test: Clear button238 */239 search.testClearButton = function(tcExecuteBeforeTest, tcExecuteAfterTest) {240 return new h.TestCase("Clear Button", {241 execBefore: tcExecuteBeforeTest,242 execAfter: tcExecuteAfterTest })243 .config.changeContext(c.getContentFrame)244 .assert.visible(selectors.component.clear, false)245 .fillInput(selectors.component.input, "Page", { delay: 1000 })246 .assert.visible(selectors.component.clear)247 .click(selectors.component.clear, { delay: 1000 })248 .assert.visible(selectors.component.clear, false)249 .assert.visible(selectors.component.results, false)250 .execFct(function(opts, done) {251 var $input = h.find(selectors.component.input);252 if ($input[0].value === "") {253 done();254 }255 });256 };257 /**258 * Test: Key: Enter key in input field doesn't navigate or clear input259 */260 search.testKeyEnterInput = function(tcExecuteBeforeTest, tcExecuteAfterTest) {261 return new h.TestCase("Key: Enter in input", {262 execBefore: tcExecuteBeforeTest,263 execAfter: tcExecuteAfterTest264 })265 .config.changeContext(c.getContentFrame)266 .fillInput(selectors.component.input, "Page", { delay: 1000 })267 .simulate(selectors.component.input, "keydown", 13, { delay: 1000, delayAfter: 1000 }) // Enter key268 .execFct(function(opts, done) {269 var location = h.context().window.location.href;270 if (location.indexOf(h.param("page_1_1")()) > 0) {271 done();272 }273 })274 .execFct(function(opts, done) {275 var $input = h.find(selectors.component.input);276 if ($input[0].value === "Page") {277 done();278 }279 });280 };281 /**282 * Test: Outside Click - dismisses results283 */284 search.testOutsideClick = function(tcExecuteBeforeTest, tcExecuteAfterTest) {285 return new h.TestCase("Outside Click", {286 execBefore: tcExecuteBeforeTest,287 execAfter: tcExecuteAfterTest })288 .config.changeContext(c.getContentFrame)289 .assert.visible(selectors.component.clear, false)290 .fillInput(selectors.component.input, "Page", { delay: 1000 })291 .assert.visible(selectors.component.clear)292 .click("body", { delay: 1000 })293 .assert.visible(selectors.component.results, false);294 };295 /**296 * Test: Mark - search term marked297 */298 search.testMark = function(tcExecuteBeforeTest, tcExecuteAfterTest) {299 return new h.TestCase("Mark", {300 execBefore: tcExecuteBeforeTest,301 execAfter: tcExecuteAfterTest })302 .config.changeContext(c.getContentFrame)303 .assert.visible(selectors.component.clear, false)304 .execFct(function(opts, done) {305 pollQuery(done, c.rootPage, "Page", h.param("page_1")());306 })307 .fillInput(selectors.component.input, "Page", { delay: 1000 })308 .assert.visible(selectors.component.item.mark + ':contains("Page")');309 };310 /**311 * Test: Input Length - minimum length of the search term312 */313 search.testMinLength = function(tcExecuteBeforeTest, tcExecuteAfterTest, policyName, policyLocation, policyPath, policyAssignmentPath) {314 return new h.TestCase("Input Length", {315 execBefore: tcExecuteBeforeTest,316 execAfter: tcExecuteAfterTest })317 .execFct(function(opts, done) {318 var data = {319 "searchTermMinimumLength": "5",320 "jcr:title": "New Policy",321 "sling:resourceType": "wcm/core/components/policy/policy"322 };323 c.createPolicy(policyName + "/new_policy", data, "policyPath", done, policyPath);324 })325 .execFct(function(opts, done) {326 var data = {};327 data["cq:policy"] = policyLocation + policyName + "/new_policy";328 data["sling:resourceType"] = "wcm/core/components/policies/mapping";329 c.assignPolicy(policyName, data, done, policyAssignmentPath);330 })331 .config.changeContext(c.getContentFrame)332 .fillInput(selectors.component.input, "page", { delay: 1000 })333 .assert.isFalse(function() {334 var $results = h.find(selectors.component.item.self);335 return $results && $results.length > 0;336 })337 .fillInput(selectors.component.input, "page ", { delay: 1000 })338 .assert.isTrue(function() {339 var $results = h.find(selectors.component.item.self);340 return $results && $results.length > 0;341 });342 };343 /**344 * Test: Results Size - Amount of fetched results345 */346 search.testResultsSize = function(tcExecuteBeforeTest, tcExecuteAfterTest, policyName, policyLocation, policyPath, policyAssignmentPath) {347 return new h.TestCase("Results Size", {348 execBefore: tcExecuteBeforeTest,349 execAfter: tcExecuteAfterTest })350 .execFct(function(opts, done) {351 var data = {352 "resultsSize": "2",353 "jcr:title": "New Policy",354 "sling:resourceType": "wcm/core/components/policy/policy"355 };356 c.createPolicy(policyName + "/new_policy", data, "policyPath", done, policyPath);357 })358 .execFct(function(opts, done) {359 var data = {};360 data["cq:policy"] = policyLocation + policyName + "/new_policy";361 data["sling:resourceType"] = "wcm/core/components/policies/mapping";362 c.assignPolicy(policyName, data, done, policyAssignmentPath);363 })364 .config.changeContext(c.getContentFrame)365 .fillInput(selectors.component.input, "page", { delay: 1000 })366 .assert.isTrue(function() {367 var $results = h.find(selectors.component.item.self);368 return $results && $results.length === 2;369 });370 };371 /**372 * Test: Scroll Down - Load more results373 */374 search.testScrollDown = function(tcExecuteBeforeTest, tcExecuteAfterTest, policyName, policyLocation, policyPath, policyAssignmentPath) {375 return new h.TestCase("Scroll Down", {376 execBefore: tcExecuteBeforeTest,377 execAfter: tcExecuteAfterTest })378 .execTestCase(c.tcOpenConfigureDialog("cmpPath"))379 .fillInput('foundation-autocomplete[name="./searchRoot"]', c.rootPage, { delayAfter: 1000 })380 .execTestCase(c.tcSaveConfigureDialog)381 .config.changeContext(c.getContentFrame)382 .fillInput(selectors.component.input, "page", { delay: 1000 })383 .assert.isTrue(function() {384 var $results = h.find(selectors.component.item.self);385 return $results && $results.length === 10;386 })387 // scroll down388 .execFct(function(opts, done) {389 var resultsElt = h.find(selectors.component.results)[0];390 resultsElt.scrollTop += 10;391 done(true);392 })393 .assert.isTrue(function() {394 var $results = h.find(selectors.component.item.self);395 return $results && $results.length === 20;396 });397 };...

Full Screen

Full Screen

Sage.CA.SBS.ERP.Sage300.Common.iFrameHelper.js

Source:Sage.CA.SBS.ERP.Sage300.Common.iFrameHelper.js Github

copy

Full Screen

...16 if (iframeWin) {17 iframeWin.postMessage(data, childUrl);18 } else {19 //get second level frame window20 var contentFrame = sg.utls.iFrameHelper.getContentFrame();21 isContentWindow = sg.utls.isChrome() || sg.utls.isSafari();22 iframeWin = contentFrame.frames[sourceFrameId];23 if (iframeWin && isContentWindow) {24 iframeWin = iframeWin.contentWindow;25 }26 if (iframeWin) {27 iframeWin.postMessage(data, childUrl);28 }29 }30 } else {31 // non portal scenario this will be used.32 window.parent.postMessage(data, childUrl)33 }34 },35 // build data- standard format to communicate the iframe messages..36 buildData: function (id, data) {37 // introduced type because, there are other messages are also posted beteween iframes, to filter custom messages this type is required. 38 var resultData = { Type: 'SageKendoiFrame', Id: id, Data: data };39 return resultData;40 },41 closeWindow: function () {42 var id = window.frameElement.id;43 var contentFrame = sg.utls.iFrameHelper.getContentFrame();44 var divCtrl = contentFrame.$("#div" + id);45 divCtrl.data("kendoWindow").trigger('close');//trigger close event46 },47 isWindowiFramePopup: function () {48 if (sg.utls.isSameOrigin()) {49 var isPortal = window.top.$('iframe.screenIframe:visible').length > 0;50 if (isPortal) {51 var id = window.top.$('iframe.screenIframe:visible').contents().find('.k-widget.k-window').find('iframe').attr('data-parentiframeid');52 if (id) {53 return true;54 }55 }56 }57 return false;58 },59 getContentFrame: function () {60 var contentFrame;61 var sameOrigin = sg.utls.isSameOrigin();62 if (!sameOrigin) {63 return window.top;64 }65 var screeniFrame = window.top.$('iframe.screenIframe:visible');66 if (screeniFrame.length > 0) {67 contentFrame = screeniFrame[0].contentWindow;68 } else {69 contentFrame = window.top; // if portal is not enabled then this will be used.70 }71 return contentFrame;72 },73 // register to receive message.74 registerToReceiveMessage: function (msgCallBackFunc) {75 // this should be javascript only, otherwise the values are not returned properly.76 if (window.addEventListener) {77 window.addEventListener("message", msgCallBackFunc,false);78 }79 else {80 window.attachEvent("onmessage", msgCallBackFunc, false);81 }82 },83 //Below methods are called from parent84 getBeforeUnloadEvent: function (frameWindow) {85 if (!frameWindow.$) return null;86 //return frameWindow.beforeClose_iFramePopup;87 if (frameWindow.$._data(frameWindow, 'events') != null && frameWindow.$._data(frameWindow, 'events')["beforeunload"] != null) {88 return frameWindow.$._data(frameWindow, 'events')["beforeunload"].map(function (elem) { return elem.handler; })[0];89 }90 return null;91 },92 getUnloadEvents: function (frameWindow) {93 if (!frameWindow.$) return null;94 if (frameWindow.$._data(frameWindow, 'events') != null && frameWindow.$._data(frameWindow, 'events')["unload"] != null) {95 return frameWindow.$._data(frameWindow, 'events')["unload"].map(function (elem) { return elem.handler; });96 }97 return null;98 },99 // id is divId - before opening the window, it will create a div and create a iframe window.100 openWindow: function (id, title, url, height, width, parentMsgCallBackFunc, source) {101 var htmlDiv = '<div id=div' + id + '/>';102 var contentFrame;103 var form;104 var visbleFrameContent;105 var divCtrl;106 if (source == null) {107 var isPortal = sg.utls.isSameOrigin();108 contentFrame = (isPortal) ? sg.utls.iFrameHelper.getContentFrame() : window;109 form = contentFrame.$('form');110 // remove the existing div.111 if (isPortal) {112 visbleFrameContent = window.top.$('iframe.screenIframe:visible').contents().find('.k-widget.k-window');113 visbleFrameContent.contents().remove("#div" + id);114 }115 // append the div116 form.append(htmlDiv);117 divCtrl = contentFrame.$("#div" + id);118 } else {119 contentFrame = source.closest('html').parent();120 form = source.closest('html').parent().find('form');121 // remove the existing div.122 visbleFrameContent = source.closest('html').parent().find('.k-widget.k-window');123 visbleFrameContent.remove("#div" + id);124 // append the div125 form.append(htmlDiv);126 divCtrl = contentFrame.find("#div" + id);127 }128 // set default height and width, if parameter is null129 if (height == null || height > sg.utls.iFrameHelper.DefaultHeight) {130 height = sg.utls.iFrameHelper.DefaultHeight;131 };132 if (width == null || width > sg.utls.iFrameHelper.DefaultWidth) {133 width = sg.utls.iFrameHelper.DefaultWidth;134 if (source == null) {135 if (width > $(contentFrame.document).width()) {136 width = $(contentFrame.document).width() - 20;137 }138 } else {139 if (width > $(source.closest('html')).width()) {140 width = $(source.closest('html')).width() - 20;141 }142 }143 };144 var portalHeight = 0;145 // if portal is enabled then set the portal height.146 if (sg.utls.isPortalIntegrated()) {147 portalHeight = sg.utls.portalHeight;148 }149 // get the height of the window and reduce the top & bottom size.150 var maxHeight;151 if (source == null) {152 maxHeight = $(contentFrame.document).height() - portalHeight; // reducing height based on portal.153 } else {154 maxHeight = $(source.closest('html')).height() - portalHeight; // reducing height based on portal.155 }156 divCtrl.kendoWindow({157 modal: true,158 title: title,159 resizable: false,160 draggable: true,161 scrollable: true,162 visible: false,163 iframe: true,164 content: sg.utls.urlEncode(url),165 maxHeight: maxHeight,166 height: height,167 width: width,168 activate: sg.utls.kndoUI.onActivate,169 actions: [170 "Maximize",171 "Close"172 ],173 close: function (e) {174 if (!sg.utls.isSameOrigin()) {175 //Call parent callback function176 if (parentMsgCallBackFunc != null && typeof parentMsgCallBackFunc !== 'undefined' && $.isFunction(parentMsgCallBackFunc)) {177 parentMsgCallBackFunc();178 }179 divCtrl.data("kendoWindow").destroy();180 return;181 }182 var frameWindow;183 if (sg.utls.isChrome() || sg.utls.isSafari()) {184 frameWindow = sg.utls.iFrameHelper.getContentFrame().frames[id];185 if (frameWindow) {186 frameWindow = sg.utls.iFrameHelper.getContentFrame().frames[id].contentWindow;187 }188 } else {189 frameWindow = sg.utls.iFrameHelper.getContentFrame().frames[id];190 }191 if (frameWindow) {192 //Call iframe beforeunload event if it exists.193 //This event is registered with Child window.194 var beforeIframeCloseEvent = sg.utls.iFrameHelper.getBeforeUnloadEvent(frameWindow);195 if (beforeIframeCloseEvent != null && typeof beforeIframeCloseEvent !== 'undefined' && $.isFunction(beforeIframeCloseEvent)) {196 if (sg.utls.iFrameHelper.beforeCloseEvent(frameWindow, divCtrl)) {197 e.preventDefault();198 return;199 }200 }201 // On Kendo window (X) close button click, to post data back to parent page, below function is used.202 // on all child popup screen where you want to return value to parent page should have function - close_iFramePopup203 // This event is registered with Child window204 var closeiframePopup = frameWindow.close_iFramePopup;205 if (typeof closeiframePopup !== 'undefined' && $.isFunction(closeiframePopup)) {206 closeiframePopup();207 }208 }209 //Call parent callback function210 if (parentMsgCallBackFunc != null && typeof parentMsgCallBackFunc !== 'undefined' && $.isFunction(parentMsgCallBackFunc)) {211 parentMsgCallBackFunc();212 }213 //This is not required. Destroy calls the page unload event.214 /*if (frameWindow) {215 //Call iframe unload event if it exists.216 //This event is registered with Child window.217 var unloadEvents = sg.utls.iFrameHelper.getUnloadEvents(frameWindow);218 if (unloadEvents != null) {219 $.each(unloadEvents, function (index, evt) {220 //console.log("event: " + evt);221 evt();222 });223 }224 }*/225 // destroy the window on close.226 divCtrl.data("kendoWindow").destroy();227 },228 refresh: function () {229 // refresh function will get called after the page load is complete, we get height after the page is loaded.230 //var contentFrame = sg.utls.iFrameHelper.getContentFrame();231 var contentHeight;232 // For call outside from Sage 300c portal233 var sameOrigin = sg.utls.isSameOrigin();234 if (!sameOrigin) {235 contentHeight = 780;236 return;237 }238 // For call outside from Sage 300c portal239 if (window.top.$('iframe.screenIframe:visible').length === 0) {240 contentHeight = 780;241 return;242 }243 var iframeContent = window.top.$('iframe.screenIframe:visible').contents().find('#' + id);244 contentHeight = iframeContent.contents().find('body').height();...

Full Screen

Full Screen

utils.js

Source:utils.js Github

copy

Full Screen

...322 (isOpen(panel) || isOpening(panel)) ?323 panel.firstChild :324 panel.backgroundFrame325exports.getContentFrame = getContentFrame;326function getContentDocument(panel) getContentFrame(panel).contentDocument327exports.getContentDocument = getContentDocument;328function setURL(panel, url) {329 getContentFrame(panel).setAttribute("src", url ? data.url(url) : url);330}331exports.setURL = setURL;332function allowContextMenu(panel, allow) {333 if(allow) {334 panel.setAttribute("context", "contentAreaContextMenu");335 } 336 else {337 panel.removeAttribute("context");338 }339}...

Full Screen

Full Screen

popupPage.js

Source:popupPage.js Github

copy

Full Screen

...53}54popupPage.prototype.addSMART=function(panelCTRLer, Jdata){55 this.myVariable.panelCTRLer = panelCTRLer;56 this.smartTableFrame = 57 jLego.basicUI.addDiv(panelCTRLer.getContentFrame(), {id: jLego.func.getRandomString(), class: this.myClass.SMART_FRAME});58 $(this.smartTableFrame).data('parentFrame', panelCTRLer.getContentFrame());59 var newWidth = $(panelCTRLer.getContentFrame()).width() - 40;60 var newHieght = $(panelCTRLer.getContentFrame()).height() - 40;61 $(this.smartTableFrame).width(newWidth);62 $(this.smartTableFrame).height(newHieght);63 $(this.smartTableFrame).css('left', '20px');64 $(this.smartTableFrame).css('padding-top', '20px');65 $(this.smartTableFrame).css('padding-bottom', '20px');66 $(this.smartTableFrame).css('padding-right', '20px');67 this.smartTableCTRLer = new jLego.objectUI.nodeTable();68 this.smartTableCTRLer.add(this.smartTableFrame, {69 columnTitleList: this.myLanguage.SMART_NODE_TABLE_TITLE,70 widthType: this.myLanguage.SMART_NODE_TABLE_TITLE_WIDTH_TYPE,71 minWidthList: this.myLanguage.SMART_NODE_TABLE_TITLE_WIDTH,72 rowCount: Jdata.attributes.length73 });74 var container;75 for(var i=0; i<Jdata.attributes.length; i++){76 container = this.smartTableCTRLer.getContainer(i, 0);77 var id = 78 jLego.basicUI.addDiv(container, {id: jLego.func.getRandomString(), class: ""});79 $(id).text(Jdata.attributes[i].attrID);80 container = this.smartTableCTRLer.getContainer(i, 1);81 var attribute = 82 jLego.basicUI.addDiv(container, {id: jLego.func.getRandomString(), class: ""});83 $(attribute).text(Jdata.attributes[i].attrName);84 container = this.smartTableCTRLer.getContainer(i, 2);85 var value = 86 jLego.basicUI.addDiv(container, {id: jLego.func.getRandomString(), class: ""});87 $(value).text(Jdata.attributes[i].attrValue);88 container = this.smartTableCTRLer.getContainer(i, 3);89 var worst = 90 jLego.basicUI.addDiv(container, {id: jLego.func.getRandomString(), class: ""});91 $(worst).text(Jdata.attributes[i].attrWorst);92 container = this.smartTableCTRLer.getContainer(i, 4);93 var threshold = 94 jLego.basicUI.addDiv(container, {id: jLego.func.getRandomString(), class: ""});95 $(threshold).text(Jdata.attributes[i].attrThreshold);96 container = this.smartTableCTRLer.getContainer(i, 5);97 var rawValue = 98 jLego.basicUI.addDiv(container, {id: jLego.func.getRandomString(), class: ""});99 $(rawValue).text(Jdata.attributes[i].attrRawValue);100 }101 102 this.addSMARTDetail(panelCTRLer, Jdata);103 var seeDetailButton =104 this.buttonCTRLer.addFreeSingleButton(panelCTRLer.getFootFrame(), {type: 'positive', top: 4, right: 5, title: this.myLanguage.DETAIL});105 $(seeDetailButton).data('isDetailMode', false);106 $(seeDetailButton).data('parent', this);107 $(seeDetailButton).click(function(){108 var isDetailMode = $(this).data('isDetailMode');109 var parent = $(this).data('parent');110 if(isDetailMode==false){111 $(this).data('isDetailMode', true);112 $(parent.smartDetailTableFrame).show();113 $(parent.smartTableFrame).hide();114 $(this).text(parent.myLanguage.BACK);115 }116 else{117 $(this).data('isDetailMode', false);118 $(parent.smartTableFrame).show();119 $(parent.smartDetailTableFrame).hide();120 $(this).text(parent.myLanguage.DETAIL);121 }122 });123 this.smartTableCTRLer.resize();124}125popupPage.prototype.addSMARTDetail=function(panelCTRLer, Jdata){126 this.smartDetailTableFrame = 127 jLego.basicUI.addDiv(panelCTRLer.getContentFrame(), {id: jLego.func.getRandomString(), class: this.myClass.SMART_FRAME});128 $(this.smartDetailTableFrame).hide();129 var newWidth = $(panelCTRLer.getContentFrame()).width() - 40;130 var newHieght = $(panelCTRLer.getContentFrame()).height() - 40;131 $(this.smartDetailTableFrame).width(newWidth);132 $(this.smartDetailTableFrame).height(newHieght);133 $(this.smartDetailTableFrame).css('left', '20px');134 $(this.smartDetailTableFrame).css('padding-top', '20px');135 $(this.smartDetailTableFrame).css('padding-bottom', '20px');136 $(this.smartDetailTableFrame).css('padding-right', '20px');137 this.smartDetailTableCTRLer = new jLego.objectUI.nodeTable();138 this.smartDetailTableCTRLer.add(this.smartDetailTableFrame, {139 columnTitleList: this.myLanguage.SMART_DETAIL_NODE_TABLE_TITLE,140 widthType: this.myLanguage.SMART_DETAIL_NODE_TABLE_TITLE_WIDTH_TYPE,141 minWidthList: this.myLanguage.SMART_DETAIL_NODE_TABLE_TITLE_WIDTH,142 rowCount: 9143 });144 //smartHealth145 var titleContainer = this.smartDetailTableCTRLer.getContainer(0, 0);146 var valueContainer = this.smartDetailTableCTRLer.getContainer(0, 1);147 var title = 148 jLego.basicUI.addDiv(titleContainer, {id: jLego.func.getRandomString(), class: ""});149 $(title).text(this.myLanguage.SMART_HEALTH);150 var value = 151 jLego.basicUI.addDiv(valueContainer, {id: jLego.func.getRandomString(), class: ""});152 $(value).text(Jdata.smartHealth);153 //deviceModel154 titleContainer = this.smartDetailTableCTRLer.getContainer(1, 0);155 valueContainer = this.smartDetailTableCTRLer.getContainer(1, 1);156 title = 157 jLego.basicUI.addDiv(titleContainer, {id: jLego.func.getRandomString(), class: ""});158 $(title).text(this.myLanguage.DEVICE_MODEL);159 value = 160 jLego.basicUI.addDiv(valueContainer, {id: jLego.func.getRandomString(), class: ""});161 $(value).text(Jdata.deviceModel);162 //firmwareVersion163 titleContainer = this.smartDetailTableCTRLer.getContainer(2, 0);164 valueContainer = this.smartDetailTableCTRLer.getContainer(2, 1);165 title = 166 jLego.basicUI.addDiv(titleContainer, {id: jLego.func.getRandomString(), class: ""});167 $(title).text(this.myLanguage.FIRMWARE_VERSION);168 value = 169 jLego.basicUI.addDiv(valueContainer, {id: jLego.func.getRandomString(), class: ""});170 $(value).text(Jdata.firmwareVersion);171 //serialNumber172 titleContainer = this.smartDetailTableCTRLer.getContainer(3, 0);173 valueContainer = this.smartDetailTableCTRLer.getContainer(3, 1);174 title = 175 jLego.basicUI.addDiv(titleContainer, {id: jLego.func.getRandomString(), class: ""});176 $(title).text(this.myLanguage.SERIAL_NUMBER);177 value = 178 jLego.basicUI.addDiv(valueContainer, {id: jLego.func.getRandomString(), class: ""});179 $(value).text(Jdata.serialNumber);180 //smartSupport181 titleContainer = this.smartDetailTableCTRLer.getContainer(4, 0);182 valueContainer = this.smartDetailTableCTRLer.getContainer(4, 1);183 title = 184 jLego.basicUI.addDiv(titleContainer, {id: jLego.func.getRandomString(), class: ""});185 $(title).text(this.myLanguage.SMART_SUPPORT);186 value = 187 jLego.basicUI.addDiv(valueContainer, {id: jLego.func.getRandomString(), class: ""});188 $(value).text(Jdata.smartSupport);189 //localTime190 titleContainer = this.smartDetailTableCTRLer.getContainer(5, 0);191 valueContainer = this.smartDetailTableCTRLer.getContainer(5, 1);192 title = 193 jLego.basicUI.addDiv(titleContainer, {id: jLego.func.getRandomString(), class: ""});194 $(title).text(this.myLanguage.LOCAL_TIME);195 value = 196 jLego.basicUI.addDiv(valueContainer, {id: jLego.func.getRandomString(), class: ""});197 $(value).text(Jdata.localTime);198 //device199 titleContainer = this.smartDetailTableCTRLer.getContainer(6, 0);200 valueContainer = this.smartDetailTableCTRLer.getContainer(6, 1);201 title = 202 jLego.basicUI.addDiv(titleContainer, {id: jLego.func.getRandomString(), class: ""});203 $(title).text(this.myLanguage.DEVICE);204 value = 205 jLego.basicUI.addDiv(valueContainer, {id: jLego.func.getRandomString(), class: ""});206 $(value).text(Jdata.device);207 //ataStandard208 titleContainer = this.smartDetailTableCTRLer.getContainer(7, 0);209 valueContainer = this.smartDetailTableCTRLer.getContainer(7, 1);210 title = 211 jLego.basicUI.addDiv(titleContainer, {id: jLego.func.getRandomString(), class: ""});212 $(title).text(this.myLanguage.ATA_STANDARD);213 value = 214 jLego.basicUI.addDiv(valueContainer, {id: jLego.func.getRandomString(), class: ""});215 $(value).text(Jdata.ataStandard);216 //ataVersion217 titleContainer = this.smartDetailTableCTRLer.getContainer(8, 0);218 valueContainer = this.smartDetailTableCTRLer.getContainer(8, 1);219 title = 220 jLego.basicUI.addDiv(titleContainer, {id: jLego.func.getRandomString(), class: ""});221 $(title).text(this.myLanguage.ATA_VERSION);222 value = 223 jLego.basicUI.addDiv(valueContainer, {id: jLego.func.getRandomString(), class: ""});224 $(value).text(Jdata.ataVersion);225}226popupPage.prototype.close=function(){227 this.smartTableCTRLer = null;228}229popupPage.prototype.resize=function(){230 if(this.smartTableCTRLer!=null){ 231 var newWidth = $(this.myVariable.panelCTRLer.getContentFrame()).width() - 40;232 var newHieght = $(this.myVariable.panelCTRLer.getContentFrame()).height() - 40;233 $(this.smartTableFrame).width(newWidth);234 $(this.smartTableFrame).height(newHieght);235 this.smartTableCTRLer.resize();236 }...

Full Screen

Full Screen

Breadcrumb.js

Source:Breadcrumb.js Github

copy

Full Screen

1/*2 * Copyright 2016 Adobe Systems Incorporated3 *4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 *8 * http://www.apache.org/licenses/LICENSE-2.09 *10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */16;(function(h, $){17 // shortcuts18 var c = window.CQ.WeRetailIT.commons;19 var breadcrumb = window.CQ.WeRetailIT.Breadcrumb;20 /**21 * test specifics22 */23 var itemSelector = {24 normal: ".cmp-breadcrumb__item",25 active: ".cmp-breadcrumb__item--active"26 };27 /**28 * Before Test Case29 */30 breadcrumb.tcExecuteBeforeTest = function() {31 return new h.TestCase("Create Sample Content")32 // common set up33 .execTestCase(c.tcExecuteBeforeTest)34 // create level 135 .execFct(function (opts,done) {36 c.createPage(c.template, c.rootPage, "level_1", "level_1", done )37 })38 // create level 239 .execFct(function (opts,done) {40 c.createPage(c.template, h.param("level_1")(), "level_2", "level_2", done )41 })42 // create level 343 .execFct(function (opts,done) {44 c.createPage(c.template, h.param("level_2")(), "level_3", "level_3", done )45 })46 // create level 447 .execFct(function (opts,done) {48 c.createPage(c.template, h.param("level_3")(), "level_4", "level_4", done )49 })50 // create level 551 .execFct(function (opts,done) {52 c.createPage(c.template, h.param("level_4")(), "level_5", "level_5", done )53 })54 // add the component to the deepest level55 .execFct(function (opts, done){56 c.addComponent(c.rtBreadcrumb, h.param("level_5")(opts)+c.relParentCompPath, "cmpPath", done)57 })58 // open the deepest level in the editor59 .navigateTo("/editor.html%level_5%.html");60 };61 /**62 * After Test Case63 */64 breadcrumb.tcExecuteAfterTest = function() {65 return new TestCase("Clean up after Test")66 // common clean up67 .execTestCase(c.tcExecuteAfterTest)68 // delete the test page we created69 .execFct(function (opts, done) {70 c.deletePage(h.param("level_1")(opts), done);71 });72 };73 /**74 * Test: Set the Hide Current flag75 */76 breadcrumb.testHideCurrent = function() {77 return new h.TestCase("Check Hide Current Flag",{78 execBefore: tcExecuteBeforeTest,79 execAfter: tcExecuteAfterTest})80 // check first if current page is shown81 .config.changeContext(c.getContentFrame)82 // the li entry for current page83 .assert.exist(itemSelector.active + ":contains('level_5')",true)84 .config.resetContext()85 // Open the configuration dialog86 .execTestCase(c.tcOpenConfigureDialog("cmpPath"))87 // check the checkbox th make the current page hidden88 .click("input[name='./hideCurrent']")89 // Close the configuration dialog90 .execTestCase(c.tcSaveConfigureDialog)91 // got to the content frame92 .config.changeContext(c.getContentFrame)93 // the li entry for current page should not be found94 .assert.exist(itemSelector.active + ":contains('level_5')", false);95 };96 /**97 * Test: Set the Show Hidden flag98 */99 breadcrumb.testShowHidden = function() {100 return new TestCase("Check Show Hidden Flag",{101 execBefore: tcExecuteBeforeTest,102 execAfter: tcExecuteAfterTest})103 .execFct(function(opts,done){104 $.ajax({105 url: h.param("level_3")(),106 method: "POST",107 complete:done,108 // POST data to be send in the request109 data: {110 "_charset_": "utf-8",111 "./jcr:content/hideInNav": "true"112 }113 })114 })115 // reload the page to make the change visible116 .reload()117 // go to content frame118 .config.changeContext(c.getContentFrame)119 // verify level 3 is no longer available120 .assert.exist(itemSelector.normal + " > a:contains('level_3')",false)121 // go back to edit frame122 .config.resetContext()123 // Open the configuration dialog124 .execTestCase(c.tcOpenConfigureDialog("cmpPath"))125 // check the checkbox to show hidden pages126 .click("input[name='./showHidden']")127 // Close the configuration dialog128 .execTestCase(c.tcSaveConfigureDialog)129 // got to the content frame130 .config.changeContext(c.getContentFrame)131 // the level 3 should be visible again132 .assert.exist(itemSelector.normal + " > a:contains('level_3')",true);133 };134 /**135 * Test: Change the start level136 */137 breadcrumb.changeStartLevel = function() {138 return new TestCase("Change Start Level",{139 execBefore: tcExecuteBeforeTest,140 execAfter: tcExecuteAfterTest})141 // check the current number of parent levels142 .assert.isTrue(function(){143 return h.find(itemSelector.normal,"iframe#ContentFrame").size() === 6})144 // Open the configuration dialog145 .execTestCase(c.tcOpenConfigureDialog("cmpPath"))146 // check the current config setting147 .assert.isTrue(function(){148 return h.find("input[name='./startLevel']").val() == 2})149 // increase start level by 2150 .fillInput("input[name='./startLevel']", 4)151 // Close the configuration dialog152 .execTestCase(c.tcSaveConfigureDialog)153 // check the current number154 .assert.isTrue(function(){155 return h.find(itemSelector.normal,"iframe#ContentFrame").size() === 5});156 };157 /**158 * Test: Set the start level to lowest allowed value of 0.159 * This shouldn't render anything since level 0 is not a valid page.160 */161 breadcrumb.setZeroStartLevel = function() {162 return new TestCase("Set Start Level to 0",{163 execBefore: tcExecuteBeforeTest,164 execAfter: tcExecuteAfterTest})165 // check the current number of items166 .assert.isTrue(function(){167 return h.find(itemSelector.normal,"iframe#ContentFrame").size() == 6})168 // Open the configuration dialog169 .execTestCase(c.tcOpenConfigureDialog("cmpPath"))170 // set it to 0171 .fillInput("input[name='./startLevel']", 0)172 // Close the configuration dialog173 .asserts.visible(c.selConfigDialog)174 // check if element name is marked as invalid175 .asserts.isTrue(function() {176 return h.find("input[name='./startLevel'].is-invalid").size() == 1177 });178 };179 /**180 * Test: Set the start level to the highest possible value 100.181 * This shouldn't render anything since level 100 is higher the the current's page level.182 */183 breadcrumb.set100StartLevel = function() {184 return new TestCase("Set Start Level to 100",{185 execBefore: tcExecuteBeforeTest,186 execAfter: tcExecuteAfterTest})187 // check the current number of items188 .assert.isTrue(function(){189 return h.find(itemSelector.normal,"iframe#ContentFrame").size() === 6})190 // Open the configuration dialog191 .execTestCase(c.tcOpenConfigureDialog("cmpPath"))192 // set it to 100193 .fillInput("input[name='./startLevel']", 100)194 // Close the configuration dialog195 .execTestCase(c.tcSaveConfigureDialog)196 // 100 is higher then current level so nothing should get rendered197 .assert.isTrue(function(){198 return h.find(itemSelector.normal,"iframe#ContentFrame").size() === 0 &&199 h.find(itemSelector.active,"iframe#ContentFrame").size() === 0200 });201 };202 var tcExecuteBeforeTest = breadcrumb.tcExecuteBeforeTest();203 var tcExecuteAfterTest = breadcrumb.tcExecuteAfterTest();204 /**205 * The main test suite.206 */207 new h.TestSuite("We.Retail Tests - Breadcrumb", {path:"/apps/weretail/tests/admin/components-it/Breadcrumb.js", register: true,208 execBefore: c.tcExecuteBeforeTestSuite,209 execInNewWindow : false})210 .addTestCase(breadcrumb.testHideCurrent(tcExecuteBeforeTest, tcExecuteAfterTest))211 .addTestCase(breadcrumb.testShowHidden(tcExecuteBeforeTest, tcExecuteAfterTest))212 .addTestCase(breadcrumb.changeStartLevel(tcExecuteBeforeTest, tcExecuteAfterTest))213 .addTestCase(breadcrumb.setZeroStartLevel(tcExecuteBeforeTest, tcExecuteAfterTest))214 .addTestCase(breadcrumb.set100StartLevel(tcExecuteBeforeTest, tcExecuteAfterTest));...

Full Screen

Full Screen

themeUI.js

Source:themeUI.js Github

copy

Full Screen

...43 };44 var removeClientlibStyleTag = function () {45 /* This function removes the style tag that is already present in the AF that is loaded in the content frame.46 So that only the css generated on runtime is applied to this AF */47 if (themeUtils.getContentFrame()) {48 var $iframe = $(themeUtils.getContentFrame());49 $("#fdtheme-id-clientlibs link", $iframe.contents()).last().remove();50 }51 };52 theme.initializeOnCompleteLoad = function () {53 if (styleVars.pageLoaded == true && styleVars.metaInfoLoaded == true) {54 themeUtils.applyThemeToAF();55 removeClientlibStyleTag();56 theme.registerOverlay(theme.mappings, $(themeUtils.getContentFrame()).contents());57 themeUtils.registerClickAction();58 Granite.author.ui.helpers.clearWait();59 }60 };61 theme.initialize = function () {62 theme.setThemeTitle();63 //TODO: More cleanup should be possible for preview!!!64 if (Granite.author.layerManager.getCurrentLayerName() === "Theme Edit" || Granite.author.layerManager.getCurrentLayerName() == null) {65 var contentWindow = themeUtils.getContentWindow();66 themeUtils.initializeAssetsPath();67 guidelib.touchlib.utils.initializeWidgets(contentWindow.$('[data-af-widgetname]'), contentWindow.$);68 // this initializes the table component, specifically written to support mobile layouts in theme editor69 guidelib.touchlib.utils.initializeTable(contentWindow.$('.guideTableNode > table'), contentWindow.$);70 //move to promise71 var themeVersion = $("[data-theme-fd-version]").data("theme-fd-version");72 if (themeVersion && themeVersion === "1.0") {73 themeUtils.migrateTheme();74 }75 themeUtils.getThemeJson();76 styleVars.pageLoaded = true;77 theme.initializeOnCompleteLoad();78 style.registerKeyboardHotkeys();79 var themePath = Granite.HTTP.getPath($(themeUtils.getContentFrame()).attr("src"));80 //Register Redo/Undo81 styleUtils.history.Manager.init(undefined, themePath);82 styleUtils.registerUndoRedoEvents();83 styleUtils.loadDefaultPropertySheet();84 style.registerViewCSSHandler();85 style.registerViewCompleteCSSHandler();86 style.registerEditRawCSSHandler();87 guidelib.author.AuthorUtils.setAuthoringFocus(themeUtils.getContentWindow().$(themeConstants.ROOT_PANEL_SELECTOR).attr("id"),88 themeUtils.getContentWindow().document);89 style.registerErrorSimulationEvents();90 }91 };92 theme.setThemeTitle = function () {93 document.title = guidelib.touchlib.constants.THEME_EDITOR_NAME +...

Full Screen

Full Screen

Text.js

Source:Text.js Github

copy

Full Screen

1/*2 * Copyright 2016 Adobe Systems Incorporated3 *4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 *8 * http://www.apache.org/licenses/LICENSE-2.09 *10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */16;(function(h, $){17 // shortcuts18 var c = window.CQ.WeRetailIT.commons;19 var text = window.CQ.WeRetailIT.Text;20 var testValue = '<b>This</b> is a <i>rich</i> <u>text</u>.';21 var selectors = {22 editor: '.text.aem-GridColumn p',23 rendered: '.cmp-text > p'24 };25 /**26 * Before Test Case27 */28 text.tcExecuteBeforeTest = function () {29 return new TestCase("Setup Before Test")30 // common set up31 .execTestCase(c.tcExecuteBeforeTest)32 // create the test page, store page path in 'testPagePath'33 .execFct(function (opts,done) {34 c.createPage(c.template, c.rootPage, 'page_' + Date.now(), "testPagePath", done)35 })36 // add the component, store component path in 'cmpPath'37 .execFct(function (opts, done){38 c.addComponent(c.rtText, h.param("testPagePath")(opts) + c.relParentCompPath, "cmpPath", done)39 })40 // open the new page in the editor41 .navigateTo("/editor.html%testPagePath%.html");42 };43 /**44 * After Test Case45 */46 text.tcExecuteAfterTest = function() {47 return new TestCase("Clean up after Test")48 // common clean up49 .execTestCase(c.tcExecuteAfterTest)50 // delete the test page we created51 .execFct(function (opts, done) {52 c.deletePage(h.param("testPagePath")(opts), done);53 });54 };55 /**56 * Test: Check if text is stored/rendered correctly using the inline editor57 */58 text.tcSetTextValueUsingInlineEditor = function(tcExecuteBeforeTest, tcExecuteAfterTest) {59 return new h.TestCase('Set text using inline editor',{60 execBefore: tcExecuteBeforeTest,61 execAfter: tcExecuteAfterTest})62 // open the inline editor63 .execTestCase(c.tcOpenInlineEditor("cmpPath"))64 //switch to the content frame65 .config.changeContext(c.getContentFrame)66 // set the example text67 .execFct(function() {68 h.find(selectors.editor).html(testValue);69 })70 // switch back to edit frame71 .config.resetContext()72 // click on save on the inline editor toolbar73 .execTestCase(c.tcSaveInlineEditor)74 //switch to the content frame75 .config.changeContext(c.getContentFrame)76 // check if the text is rendered77 .assert.isTrue(78 function() {79 var actualValue = h.find(selectors.rendered).html();80 return actualValue === testValue;81 })82 // swith back to edit frame83 .config.resetContext()84 // reload the page, to see if the text really got saved85 .navigateTo("/editor.html%testPagePath%.html")86 //switch to the content frame87 .config.changeContext(c.getContentFrame)88 // check again if the text is still there89 .assert.isTrue(90 function() {91 var actualValue = h.find(selectors.rendered).html();92 return actualValue === testValue;93 });94 };95 /**96 * v1 specifics97 */98 var tcExecuteBeforeTest = text.tcExecuteBeforeTest();99 var tcExecuteAfterTest = text.tcExecuteAfterTest();100 /**101 * The main test suite for Text Component102 */103 new h.TestSuite('We.Retail Tests - Text', {path: '/apps/weretail/tests/admin/components-it/Text/Text.js',104 execBefore:c.tcExecuteBeforeTestSuite,105 execInNewWindow : false})106 .addTestCase(text.tcSetTextValueUsingInlineEditor(tcExecuteBeforeTest, tcExecuteAfterTest));...

Full Screen

Full Screen

AbstractFramesetController.js

Source:AbstractFramesetController.js Github

copy

Full Screen

...75 Utilities.fail("Subclass must override _onFramesetReady()");76 },77 /* Subclass should override to get at the frame which shows the main content */78 getContentFrame: function() {79 Utilities.fail("Subclass must override getContentFrame()");80 },81 /* Subclass should override to create a permalink to the given Node */82 getPermalink: function(linkId) {83 Utilities.fail("Subclass must override getPermalink()");84 },85 /* Checks whether the content frame is currently blank */86 _isBlank: function() {87 var contentFrame = this.getContentFrame();88 var blankUrlEnd = "static/views/web/html/blank.html";89 var contentUrl = contentFrame.location.href;90 var cLength = contentUrl.length;91 var bLength = blankUrlEnd.length;92 this._logger.debug("Content Frame is currently at " + contentUrl);93 /* Check to see whether the content frame URL ends with the blank94 * frame URL. (Though this is not 100% infallible!)95 */96 return cLength>=bLength && contentUrl.substr(cLength-bLength, bLength)==blankUrlEnd;97 }98}99window.getFramesetController = function() {100 Utilities.fail("window.getFramesetController() must be overridden to return an appropriate subclass of AbstractFramesetController");101}

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 const contentFrame = await page.getContentFrame();7 await contentFrame.click('text=Docs');8 await browser.close();9})();10You can also use the getContentFrame() method in the following ways:11const contentFrame = await page.getContentFrame();12const contentFrame = await page.getContentFrame('iframe[title="playwright"]');13const contentFrame = await page.getContentFrame('iframe');14const contentFrame = await page.getContentFrame('iframe', 'iframe');15const contentFrame = await page.getContentFrame('iframe', 'iframe', 'iframe');16const contentFrame = await page.getContentFrame('iframe', 'iframe', 'iframe', 'iframe');17const contentFrame = await page.getContentFrame('iframe', 'iframe', 'iframe', 'iframe', 'iframe');18const contentFrame = await page.getContentFrame('iframe', 'iframe', 'iframe', 'iframe', 'iframe', 'iframe');19const contentFrame = await page.getContentFrame('iframe', 'iframe', 'iframe', 'iframe', 'iframe', 'iframe', 'iframe');20const contentFrame = await page.getContentFrame('iframe', 'iframe', 'iframe', 'iframe', 'iframe', 'iframe', 'iframe', 'iframe');21const contentFrame = await page.getContentFrame('iframe', 'iframe', 'iframe', 'iframe', 'iframe', 'iframe', 'iframe', 'iframe', 'iframe');22const contentFrame = await page.getContentFrame('iframe', 'iframe', 'iframe', 'iframe', 'iframe', 'iframe', 'iframe', 'iframe', 'iframe', 'iframe');23const contentFrame = await page.getContentFrame('iframe', 'iframe', 'iframe', 'iframe', 'iframe', 'iframe', 'iframe', 'iframe', 'iframe', 'iframe', 'ifr

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 console.log(frame);7 await browser.close();8})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 const frame = await page.getContentFrame('iframe');7 console.log(frame.url());8 await browser.close();9})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const path = require('path');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const page = await browser.newPage();6 const contentFrame = await page._delegate.getContentFrame();7 console.log(contentFrame.url());8 await browser.close();9})();10const path = require('path');11const { chromium } = require('playwright');12(async () => {13 const browser = await chromium.launch();14 const page = await browser.newPage();15 const contentFrame = await page._delegate.getContentFrame();16 console.log(contentFrame.url());17 await browser.close();18})();19const path = require('path');20const { chromium } = require('playwright');21(async () => {22 const browser = await chromium.launch();23 const page = await browser.newPage();24 const contentFrame = await page._delegate.getContentFrame();25 console.log(contentFrame.url());26 await browser.close();27})();28const path = require('path');29const { chromium } = require('playwright');30(async () => {31 const browser = await chromium.launch();32 const page = await browser.newPage();33 const contentFrame = await page._delegate.getContentFrame();34 console.log(contentFrame.url());35 await browser.close();36})();37const path = require('path');38const { chromium } = require('playwright');39(async () => {40 const browser = await chromium.launch();41 const page = await browser.newPage();42 const contentFrame = await page._delegate.getContentFrame();43 console.log(contentFrame.url());44 await browser.close();45})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const page = await browser.newPage();5 await page.goto(url);6 const contentFrame = await page.getContentFrame(url);7 await contentFrame.waitForSelector('.navbar');8 await page.screenshot({ path: 'navbar.png' });9 await browser.close();10})();11const { chromium } = require('playwright');12(async () => {13 const browser = await chromium.launch();14 const page = await browser.newPage();15 await page.goto(url);16 const contentFrame = await page.getContentFrame(url);17 await contentFrame.waitForSelector('.navbar');18 await page.screenshot({ path: 'navbar.png' });19 await browser.close();20})();21const { chromium } = require('playwright');22(async () => {23 const browser = await chromium.launch();24 const page = await browser.newPage();25 await page.goto(url);26 const contentFrame = await page.getContentFrame(url);27 await contentFrame.waitForSelector('.navbar');28 await page.screenshot({ path: 'navbar.png' });29 await browser.close();30})();31const { chromium } = require('playwright');32(async () => {33 const browser = await chromium.launch();34 const page = await browser.newPage();35 await page.goto(url);36 const contentFrame = await page.getContentFrame(url);37 await contentFrame.waitForSelector('.navbar');38 await page.screenshot({ path: 'navbar.png' });39 await browser.close();40})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch({4 });5 const page = await browser.newPage();6 await frame.click('text=Sign in');7 await frame.type('input[type="email"]', '

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2const { getContentFrame } = require('playwright/lib/server/browserType');3(async () => {4 const browser = await chromium.launch();5 const page = await browser.newPage();6 const contentFrame = await getContentFrame(page, 'youtube.com');7 await contentFrame.waitForSelector('button#movie_player > div.ytp-chrome-bottom > div.ytp-chrome-controls > div.ytp-left-controls > button.ytp-play-button');8 await contentFrame.click('button#movie_player > div.ytp-chrome-bottom > div.ytp-chrome-controls > div.ytp-left-controls > button.ytp-play-button');9 await contentFrame.waitForSelector('button#movie_player > div.ytp-chrome-bottom > div.ytp-chrome-controls > div.ytp-left-controls > button.ytp-play-button.ytp-play-button-playing');10 await contentFrame.click('button#movie_player > div.ytp-chrome-bottom > div.ytp-chrome-controls > div.ytp-left-controls > button.ytp-play-button.ytp-play-button-playing');11 await contentFrame.waitForSelector('button#movie_player > div.ytp-chrome-bottom > div.ytp-chrome-controls > div.ytp-left-controls > button.ytp-play-button');12 await browser.close();13})();14export async function getContentFrame(page: Page, url: string): Promise<Frame> {15 const context = page.context();16 const { targetInfo } = await context._doSlowMo(async () => {17 return await context._delegate.getContentFrame(page._delegate, url);18 });19 return page._frameManager.frame(targetInfo)!;20}21async function getContentFrame(page: CRPage, url: string): Promise<{ targetInfo: channels.TargetInfo }> {22 const mainFrame = page._delegate.mainFrame();23 const mainFrameId = mainFrame._targetId;24 const { targetId } = await page._session.send('Target.createTarget', {

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2const { getPlaywright } = require('playwright');3(async () => {4 const browser = await chromium.launch({5 });6 const context = await browser.newContext();7 const page = await context.newPage();8 await page.waitForSelector('input[name="q"]');9 await page.type('input[name="q"]', 'Playwright');10 await page.keyboard.press('Enter');11 const playwright = getPlaywright('chromium');12 const internalPage = playwright.selectors._page;13 const frame = internalPage.getContentFrame('iframe[name="google_ads_iframe_/21720050223/crosswordpuzzles.com/crosswordpuzzles.com_0"]');14 await page.waitForTimeout(10000);15 await browser.close();16})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { getContentFrame } = require('playwright/lib/server/chromium/crPage');2const contentFrame = getContentFrame(page);3const frame = await contentFrame._mainFrameSession._session._client.send('Page.getFrameTree');4console.log(frame);5const frame = await contentFrame._mainFrameSession._session._client.send('Page.getFrameTree');6console.log(frame);7const frame = await contentFrame._mainFrameSession._session._client.send('Page.getFrameTree');8console.log(frame);9const frame = await contentFrame._mainFrameSession._session._client.send('Page.getFrameTree');10console.log(frame);11const frame = await contentFrame._mainFrameSession._session._client.send('Page.getFrameTree');12console.log(frame);13const frame = await contentFrame._mainFrameSession._session._client.send('Page.getFrameTree');14console.log(frame);15const frame = await contentFrame._mainFrameSession._session._client.send('Page.getFrameTree');16console.log(frame);17const frame = await contentFrame._mainFrameSession._session._client.send('Page.getFrameTree');18console.log(frame);19const frame = await contentFrame._mainFrameSession._session._client.send('Page.getFrameTree');20console.log(frame);21const frame = await contentFrame._mainFrameSession._session._client.send('Page.getFrameTree');22console.log(frame);23const frame = await contentFrame._mainFrameSession._session._client.send('Page.getFrameTree');24console.log(frame);25const frame = await contentFrame._mainFrameSession._session._client.send('Page.getFrameTree');26console.log(frame);27const frame = await contentFrame._mainFrameSession._session._client.send('Page.getFrameTree');28console.log(frame);

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal 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