How to use loadPage method in Appium Xcuitest Driver

Best JavaScript code snippet using appium-xcuitest-driver

Paging.js

Source:Paging.js Github

copy

Full Screen

...157 expect(tb.getStore()).toBe(store); 158 });159 it("should update the toolbar info if the store is already loaded at render time", function() {160 store = makeStore();161 store.loadPage(2);162 mockComplete(makeData(20, 5));163 makeToolbar({164 store: store165 });166 expect(tb.down('#inputItem').getValue()).toBe(2);167 });168 it("should display the correct number of total pages", function() {169 store = makeStore();170 store.loadPage(1);171 mockComplete(makeData(20, 10));172 makeToolbar({173 store: store174 });175 expect(tb.down('#afterTextItem').el.dom.innerHTML).toBe('of 4');176 });177 it("should update the toolbar info when binding a new store", function() {178 makeToolbar();179 store = makeStore();180 store.loadPage(3);181 mockComplete(makeData(20, 10));182 tb.bindStore(store);183 expect(tb.down('#inputItem').getValue()).toBe(3);184 });185 it("should display the correct info for pageSize 0", function() {186 store = makeStore(0);187 store.load();188 mockComplete(makeData(20, 10));189 makeToolbar({190 store: store191 });192 expect(tb.getPageData()).toEqual({193 total: 20,194 currentPage: 1,195 pageCount: 1,196 fromRecord: 1,197 toRecord: 20198 });199 });200 });201 202 describe("child items", function() {203 it("should add items after the default buttons", function() {204 makeToolbar({205 items: [{206 xtype: 'button',207 itemId: 'foo'208 }]209 });210 expect(tb.items.last().getItemId()).toBe('foo');211 });212 213 it("should add items before the default buttons with prependButtons: true", function() {214 makeToolbar({215 prependButtons: true,216 items: [{217 xtype: 'button',218 itemId: 'foo'219 }]220 });221 expect(tb.items.first().getItemId()).toBe('foo');222 });223 224 it("should add the info display if displayInfo is true", function() {225 makeToolbar({226 displayInfo: true227 });228 var items = tb.items;229 expect(items.getAt(items.getCount() - 2).isXType('tbfill')).toBe(true);230 expect(items.last().getItemId()).toBe('displayItem');231 });232 });233 234 describe("disabling/enabling items", function() {235 function expectEnabled(id) {236 expectState(id, false);237 } 238 239 function expectDisabled(id) {240 expectState(id, true);241 } 242 243 function expectState(id, state) {244 expect(tb.child('#' + id).disabled).toBe(state);245 }246 247 it("should disable everything except refresh when the store hasn't been loaded", function() {248 makeToolbar();249 expectDisabled('first');250 expectDisabled('prev');251 expectDisabled('inputItem');252 expectDisabled('next');253 expectDisabled('last');254 expectEnabled('refresh');255 });256 257 describe("store loads before render", function() {258 it("should set the state if the store is loaded", function() {259 makeToolbar({}, true);260 store.load(); 261 mockComplete(makeData(20, 0));262 tb.render(Ext.getBody());263 expectDisabled('first');264 expectDisabled('prev');265 expectEnabled('inputItem');266 expectEnabled('next');267 expectEnabled('last');268 expectEnabled('refresh');269 });270 });271 272 describe("store loads after render", function() {273 it("should set the state if the store is loaded", function() {274 makeToolbar();275 store.load(); 276 mockComplete(makeData(20, 0));277 expectDisabled('first');278 expectDisabled('prev');279 expectEnabled('inputItem');280 expectEnabled('next');281 expectEnabled('last');282 expectEnabled('refresh');283 });284 });285 286 describe("based on current page", function() {287 it("should disable first/prev buttons on the first page", function() {288 makeToolbar();289 store.loadPage(1); 290 mockComplete(makeData(20, 0));291 expectDisabled('first');292 expectDisabled('prev');293 expectEnabled('inputItem');294 expectEnabled('next');295 expectEnabled('last');296 expectEnabled('refresh');297 });298 299 it("should disable next/last buttons on the last page", function() {300 makeToolbar();301 store.loadPage(4); 302 mockComplete(makeData(20, 0));303 expectEnabled('first');304 expectEnabled('prev');305 expectEnabled('inputItem');306 expectDisabled('next');307 expectDisabled('last');308 expectEnabled('refresh');309 });310 311 it("should enable all buttons when the page is not first or last", function() {312 makeToolbar();313 store.loadPage(2); 314 mockComplete(makeData(20, 0));315 expectEnabled('first');316 expectEnabled('prev');317 expectEnabled('inputItem');318 expectEnabled('next');319 expectEnabled('last');320 expectEnabled('refresh');321 });322 });323 324 describe("refresh icon", function() {325 it("should disable the refresh icon if the store is loading during construction", function() {326 makeStore();327 store.load();328 makeToolbar({329 store: store330 });331 expectDisabled('refresh');332 });333 334 it("should disable the refresh icon during a load", function() {335 makeToolbar();336 store.load();337 expectDisabled('refresh');338 });339 });340 341 describe("empty store", function() {342 it("should disable the inputItem & buttons", function() {343 makeToolbar();344 store.load();345 mockComplete(makeData(0, 0, 0));346 expectDisabled('first');347 expectDisabled('prev');348 expectDisabled('inputItem');349 expectDisabled('next');350 expectDisabled('last');351 expectEnabled('refresh');352 }); 353 });354 });355 356 describe("move/refresh methods", function() {357 var spy;358 beforeEach(function() {359 makeToolbar(); 360 store.load();361 mockComplete(makeData(20, 0));362 spy = jasmine.createSpy();363 });364 afterEach(function() {365 spy = null;366 });367 368 describe("moveFirst", function() {369 it("should fire the beforechange event with the toolbar & the new page", function() {370 tb.on('beforechange', spy);371 tb.moveFirst();372 expect(spy.mostRecentCall.args[0]).toBe(tb);373 expect(spy.mostRecentCall.args[1]).toBe(1);374 });375 376 it("should return false if the beforechange event is vetoed", function() {377 tb.on('beforechange', spy.andReturn(false));378 expect(tb.moveFirst()).toBe(false);379 });380 381 it("should return true & load the store with the first page", function() {382 spyOn(store, 'loadPage');383 expect(tb.moveFirst()).toBe(true);384 expect(store.loadPage.mostRecentCall.args[0]).toBe(1); 385 });386 });387 388 describe("movePrevious", function() {389 it("should fire the beforechange event with the toolbar & the new page", function() {390 tb.on('beforechange', spy);391 store.loadPage(3);392 mockComplete(makeData(20, 10));393 tb.movePrevious();394 expect(spy.mostRecentCall.args[0]).toBe(tb);395 expect(spy.mostRecentCall.args[1]).toBe(2);396 });397 398 it("should return false if moving to the previous page is not valid, the change event should not fire", function() {399 tb.on('beforechange', spy);400 expect(tb.movePrevious()).toBe(false);401 expect(spy).not.toHaveBeenCalled();402 });403 404 it("should return false if the beforechange event is vetoed", function() {405 tb.on('beforechange', spy.andReturn(false));406 expect(tb.movePrevious()).toBe(false);407 });408 409 it("should return true & load the store with the previous page", function() {410 spyOn(store, 'previousPage');411 store.loadPage(3);412 mockComplete(makeData(20, 10));413 expect(tb.movePrevious()).toBe(true);414 expect(store.previousPage).toHaveBeenCalled(); 415 });416 });417 418 describe("moveNext", function() {419 it("should fire the beforechange event with the toolbar & the new page", function() {420 tb.on('beforechange', spy);421 tb.moveNext();422 expect(spy.mostRecentCall.args[0]).toBe(tb);423 expect(spy.mostRecentCall.args[1]).toBe(2);424 });425 426 it("should return false if moving to the next page is not valid, the change event should not fire", function() {427 tb.on('beforechange', spy);428 store.loadPage(4);429 mockComplete(makeData(20, 15));430 expect(tb.moveNext()).toBe(false);431 expect(spy).not.toHaveBeenCalled();432 });433 434 it("should return false if the beforechange event is vetoed", function() {435 tb.on('beforechange', spy.andReturn(false));436 expect(tb.moveNext()).toBe(false);437 });438 439 it("should return true & load the store with the next page", function() {440 spyOn(store, 'nextPage');441 expect(tb.moveNext()).toBe(true);442 expect(store.nextPage).toHaveBeenCalled(); 443 });444 });445 446 describe("moveLast", function() {447 it("should fire the beforechange event with the toolbar & the new page", function() {448 tb.on('beforechange', spy);449 tb.moveLast();450 expect(spy.mostRecentCall.args[0]).toBe(tb);451 expect(spy.mostRecentCall.args[1]).toBe(4);452 });453 454 it("should return false if the beforechange event is vetoed", function() {455 tb.on('beforechange', spy.andReturn(false));456 expect(tb.moveLast()).toBe(false);457 });458 459 it("should return true & load the store with the last page", function() {460 spyOn(store, 'loadPage');461 expect(tb.moveLast()).toBe(true);462 expect(store.loadPage.mostRecentCall.args[0]).toBe(4); 463 });464 });465 466 describe("doRefresh", function() {467 it("should fire the beforechange event with the toolbar & the current page", function() {468 tb.on('beforechange', spy);469 tb.doRefresh();470 expect(spy.mostRecentCall.args[0]).toBe(tb);471 expect(spy.mostRecentCall.args[1]).toBe(1);472 });473 474 it("should return false if the beforechange event is vetoed", function() {475 tb.on('beforechange', spy.andReturn(false));476 expect(tb.doRefresh()).toBe(false);477 });478 479 it("should return true & load the store with the last page", function() {480 spyOn(store, 'loadPage');481 expect(tb.doRefresh()).toBe(true);482 expect(store.loadPage.mostRecentCall.args[0]).toBe(1); 483 });484 });485 });486 487 describe("change event", function() {488 var spy;489 beforeEach(function() {490 spy = jasmine.createSpy();491 });492 afterEach(function() {493 spy = null;494 });495 it("should fire the change event on load with the toolbar & pageData", function() {496 makeToolbar();497 tb.on('change', spy);498 store.loadPage(3);499 mockComplete(makeData(20, 10));500 expect(spy.mostRecentCall.args[0]).toBe(tb);501 expect(spy.mostRecentCall.args[1]).toEqual({502 total: 20,503 currentPage: 3,504 pageCount: 4,505 fromRecord: 11,506 toRecord: 15507 });508 }); 509 510 it("should not fire if configured with an empty store", function() {511 makeToolbar(undefined, true);512 tb.on('change', spy);513 tb.render(Ext.getBody());514 expect(spy).not.toHaveBeenCalled();515 });516 it("should provide empty pageData when a store loads empty", function() {517 makeToolbar();518 tb.on('change', spy);519 store.load();520 mockComplete('[]');521 expect(spy.mostRecentCall.args[0]).toBe(tb);522 expect(spy.mostRecentCall.args[1]).toEqual({523 total: 0,524 currentPage: 0,525 pageCount: 0,526 fromRecord: 0,527 toRecord: 0528 });529 });530 });531 532 // Opera has a problem handling key specs533 (Ext.isOpera ? xdescribe : describe)("inputItem", function() {534 var TAB = 9,535 ENTER = 13,536 ESC = 27,537 PAGE_UP = 33,538 PAGE_DOWN = 34,539 END = 35,540 HOME = 36,541 LEFT = 37,542 UP = 38,543 RIGHT = 39,544 DOWN = 40;545 546 function triggerKeyEvent(key) {547 var dom = tb.down('#inputItem').inputEl.dom;548 dom.focus();549 jasmine.fireKeyEvent(dom, keyEvent, key);550 }551 552 it("should set the value to the new page on load", function() {553 makeToolbar();554 store.loadPage(3);555 mockComplete(makeData(20, 10));556 expect(tb.getInputItem().getValue()).toBe(3);557 });558 559 it("should set the value to the current page on blur", function() {560 makeToolbar();561 var input = tb.getInputItem();562 // Will auto disable if not attached to a Store. Programatically enable so that it will focus and blur.563 input.enable();564 input.focus();565 566 waitsFor(function() {567 return input.hasFocus;568 });569 runs(function() {570 input.setValue(4);571 input.blur();572 });573 // After the blur events gets done, it should have reverted to the current page574 waitsFor(function() {575 return input.getValue() === 1;576 });577 });578 579 describe('reconfiguring a grid using buffered rendering and grouping', function () {580 // This test demonstrates that the paging toolbar will update its input item when the grid581 // is configured in a very specific way.582 //583 // This bug only is reproducible when reconfigure is called on a grid with the buffered584 // renderer plugin and grouping feature. The bug was that the buffered renderer plugin585 // would bind the data store to the plugin rather than the group store (created when586 // there's a grouping feature). See Ext.grid.plugin.BufferedRenderer:bindStore().587 //588 // See EXTJSIV-11860 and EXTJSIV-11892.589 var grid;590 afterEach(function () {591 grid.destroy();592 grid = null;593 });594 it('should update the input item when paging', function () {595 grid = Ext.create('Ext.grid.Panel', {596 width: 100,597 height: 100,598 store: makeStore(),599 features: [{ftype:'grouping'}],600 columns:[{601 text: 'Name',602 dataIndex: 'name',603 width: 100604 }],605 bbar: makeToolbar(undefined, true),606 renderTo: Ext.getBody()607 });608 grid.reconfigure(store);609 store.loadPage(3);610 mockComplete(makeData(20, 10));611 expect(tb.getInputItem().getValue()).toBe(3);612 });613 });614 describe("keypress", function() {615 it("should set the value to the first page on home", function() {616 makeToolbar();617 store.loadPage(3);618 mockComplete(makeData(100, 10));619 triggerKeyEvent(HOME);620 expect(tb.getInputItem().getValue()).toBe(1);621 });622 623 it("should set the value to the last page on end", function() {624 makeToolbar();625 store.loadPage(1);626 mockComplete(makeData(20, 0));627 triggerKeyEvent(END);628 expect(tb.getInputItem().getValue()).toBe(4);629 });630 631 describe("down", function() {632 it("should set the value to the previous page on pagedown", function() {633 makeToolbar();634 store.loadPage(3);635 mockComplete(makeData(20, 10));636 triggerKeyEvent(PAGE_DOWN);637 expect(tb.getInputItem().getValue()).toBe(2);638 });639 640 it("should set the value to the previous page on down", function() {641 makeToolbar();642 store.loadPage(3);643 mockComplete(makeData(20, 10));644 triggerKeyEvent(DOWN);645 expect(tb.getInputItem().getValue()).toBe(2);646 });647 648 describe("shift", function() {649 it("should not change the page if it will go over the limit with pagedown", function() {650 makeToolbar();651 store.loadPage(3);652 mockComplete(makeData(20, 10));653 var spy = spyOn(tb, 'processKeyEvent').andCallFake(function(field, e) {654 e.shiftKey = true;655 Ext.toolbar.Paging.prototype.processKeyEvent.call(tb, field, e);656 });657 triggerKeyEvent(PAGE_DOWN);658 expect(tb.getInputItem().getValue()).toBe(3);659 });660 661 it("should not change the page if it will go over the limit with down", function() {662 makeToolbar();663 store.loadPage(3);664 mockComplete(makeData(20, 10));665 spyOn(tb, 'processKeyEvent').andCallFake(function(field, e) {666 e.shiftKey = true;667 Ext.toolbar.Paging.prototype.processKeyEvent.call(tb, field, e);668 });669 triggerKeyEvent(DOWN);670 expect(tb.getInputItem().getValue()).toBe(3);671 });672 673 it("should decrement by 10 when using shift + pagedown", function() {674 makeToolbar();675 store.loadPage(15);676 mockComplete(makeData(100, 75));677 spyOn(tb, 'processKeyEvent').andCallFake(function(field, e) {678 e.shiftKey = true;679 Ext.toolbar.Paging.prototype.processKeyEvent.call(tb, field, e);680 });681 triggerKeyEvent(PAGE_DOWN);682 expect(tb.getInputItem().getValue()).toBe(5);683 });684 685 it("should decrement by 10 when using shift + down", function() {686 makeToolbar();687 store.loadPage(15);688 mockComplete(makeData(100, 75));689 spyOn(tb, 'processKeyEvent').andCallFake(function(field, e) {690 e.shiftKey = true;691 Ext.toolbar.Paging.prototype.processKeyEvent.call(tb, field, e);692 });693 triggerKeyEvent(DOWN);694 expect(tb.getInputItem().getValue()).toBe(5);695 });696 });697 });698 699 describe("up", function() {700 it("should set the value to the next page on pageup", function() {701 makeToolbar();702 store.loadPage(3);703 mockComplete(makeData(20, 10));704 triggerKeyEvent(PAGE_UP);705 expect(tb.getInputItem().getValue()).toBe(4);706 });707 708 it("should set the value to the next page on up", function() {709 makeToolbar();710 store.loadPage(3);711 mockComplete(makeData(20, 10));712 triggerKeyEvent(UP);713 expect(tb.getInputItem().getValue()).toBe(4);714 });715 716 describe("shift", function() {717 it("should not change the page if it will go over the limit with pageup", function() {718 makeToolbar();719 store.loadPage(1);720 mockComplete(makeData(20, 0));721 var spy = spyOn(tb, 'processKeyEvent').andCallFake(function(field, e) {722 e.shiftKey = true;723 Ext.toolbar.Paging.prototype.processKeyEvent.call(tb, field, e);724 });725 triggerKeyEvent(PAGE_UP);726 expect(tb.getInputItem().getValue()).toBe(1);727 });728 729 it("should not change the page if it will go over the limit with up", function() {730 makeToolbar();731 store.loadPage(1);732 mockComplete(makeData(20, 0));733 spyOn(tb, 'processKeyEvent').andCallFake(function(field, e) {734 e.shiftKey = true;735 Ext.toolbar.Paging.prototype.processKeyEvent.call(tb, field, e);736 });737 triggerKeyEvent(UP);738 expect(tb.getInputItem().getValue()).toBe(1);739 });740 741 it("should increment by 10 when using shift + pageup", function() {742 makeToolbar();743 store.loadPage(1);744 mockComplete(makeData(100, 0));745 spyOn(tb, 'processKeyEvent').andCallFake(function(field, e) {746 e.shiftKey = true;747 Ext.toolbar.Paging.prototype.processKeyEvent.call(tb, field, e);748 });749 triggerKeyEvent(PAGE_UP);750 expect(tb.getInputItem().getValue()).toBe(11);751 });752 753 it("should increment by 10 when using shift + up", function() {754 makeToolbar();755 store.loadPage(1);756 mockComplete(makeData(100, 0));757 spyOn(tb, 'processKeyEvent').andCallFake(function(field, e) {758 e.shiftKey = true;759 Ext.toolbar.Paging.prototype.processKeyEvent.call(tb, field, e);760 });761 triggerKeyEvent(UP);762 expect(tb.getInputItem().getValue()).toBe(11);763 });764 });765 });766 767 // These tests fails unreliably on IE9 and 10 on a VM768 describeNotIE9_10("enter", function() {769 it("should load the page in the field", function() {770 makeToolbar();771 store.loadPage(1);772 mockComplete(makeData(20, 0));773 tb.getInputItem().setRawValue(3);774 spyOn(store, 'loadPage');775 triggerKeyEvent(ENTER);776 expect(store.loadPage.mostRecentCall.args[0]).toBe(3); 777 });778 779 it("should do nothing if the value isn't valid", function() {780 makeToolbar();781 store.loadPage(1);782 mockComplete(makeData(20, 0));783 tb.getInputItem().setRawValue('foo');784 spyOn(store, 'loadPage');785 triggerKeyEvent(ENTER);786 expect(store.loadPage).not.toHaveBeenCalled();787 });788 789 it("should do nothing if the page hasn't changed", function() {790 makeToolbar();791 store.loadPage(1);792 mockComplete(makeData(20, 0));793 tb.getInputItem().setRawValue(1);794 spyOn(store, 'loadPage');795 triggerKeyEvent(ENTER);796 expect(store.loadPage).not.toHaveBeenCalled();797 });798 799 // This test fails unreliably on IE9 and 10 on a VM800 it("should pull the value up to the minimum", function() {801 makeToolbar();802 store.loadPage(2);803 mockComplete(makeData(20, 5));804 tb.getInputItem().setRawValue(-2);805 spyOn(store, 'loadPage');806 triggerKeyEvent(ENTER);807 expect(store.loadPage.mostRecentCall.args[0]).toBe(1); 808 });809 810 it("should limit the value up to the maximum", function() {811 makeToolbar();812 store.loadPage(1);813 mockComplete(makeData(20, store.pageSize));814 tb.getInputItem().setRawValue(50);815 spyOn(store, 'loadPage');816 triggerKeyEvent(ENTER);817 expect(store.loadPage.mostRecentCall.args[0]).toBe(4); 818 });819 820 it("should fire the beforechange event with the toolbar & the new page", function() {821 makeToolbar();822 store.loadPage(1);823 mockComplete(makeData(20, 0));824 tb.getInputItem().setRawValue(3);825 826 var spy = jasmine.createSpy();827 tb.on('beforechange', spy);828 triggerKeyEvent(ENTER);829 expect(spy.mostRecentCall.args[0]).toBe(tb);830 expect(spy.mostRecentCall.args[1]).toBe(3);831 });832 833 it("should not call load if vetoing the event", function() {834 makeToolbar();835 store.loadPage(1);836 mockComplete(makeData(20, 0));837 tb.getInputItem().setRawValue(3);838 839 spyOn(store, 'loadPage');840 tb.on('beforechange', function() {841 return false;842 });843 triggerKeyEvent(ENTER);844 expect(store.loadPage).not.toHaveBeenCalled();845 });846 });847 });848 });849 850 describe("after invalid load", function() {851 it("should load the largest available page when we've gone outside the dataset", function() {852 var spy = jasmine.createSpy();853 854 makeToolbar(); 855 store.loadPage(5);856 mockComplete(makeData(25, 20));857 tb.on('change', spy);858 tb.doRefresh();859 spyOn(store, 'loadPage');860 mockComplete(makeData(10, 5));861 expect(spy).not.toHaveBeenCalled();862 expect(store.loadPage.mostRecentCall.args[0]).toBe(2); 863 }); 864 });...

Full Screen

Full Screen

ControlCenter.jsm

Source:ControlCenter.jsm Github

copy

Full Screen

...33 configurations: {34 about: {35 selectors: ["#navigator-toolbox", "#identity-popup"],36 async applyConfig() {37 await loadPage("about:rights");38 await openIdentityPopup();39 },40 },41 localFile: {42 // This selector is different so we can exclude the changing file: path43 selectors: ["#identity-popup-security"],44 async applyConfig() {45 let channel = NetUtil.newChannel({46 uri: "resource://mozscreenshots/lib/mozscreenshots.html",47 loadUsingSystemPrincipal: true,48 });49 channel = channel.QueryInterface(Ci.nsIFileChannel);50 let browserWindow = Services.wm.getMostRecentWindow(51 "navigator:browser"52 );53 let gBrowser = browserWindow.gBrowser;54 BrowserTestUtils.loadURI(gBrowser.selectedBrowser, channel.file.path);55 await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);56 await openIdentityPopup();57 },58 },59 http: {60 selectors: ["#navigator-toolbox", "#identity-popup"],61 async applyConfig() {62 await loadPage(HTTP_PAGE);63 await openIdentityPopup();64 },65 },66 httpSubView: {67 selectors: ["#navigator-toolbox", "#identity-popup"],68 async applyConfig() {69 await loadPage(HTTP_PAGE);70 await openIdentityPopup(true);71 },72 },73 https: {74 selectors: ["#navigator-toolbox", "#identity-popup"],75 async applyConfig() {76 await loadPage(HTTPS_PAGE);77 await openIdentityPopup();78 },79 },80 httpsSubView: {81 selectors: ["#navigator-toolbox", "#identity-popup"],82 async applyConfig() {83 await loadPage(HTTPS_PAGE);84 await openIdentityPopup(true);85 },86 },87 singlePermission: {88 selectors: ["#navigator-toolbox", "#identity-popup"],89 async applyConfig() {90 let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(91 PERMISSIONS_PAGE92 );93 SitePermissions.setForPrincipal(94 principal,95 "camera",96 SitePermissions.ALLOW97 );98 await loadPage(PERMISSIONS_PAGE);99 await openIdentityPopup();100 },101 },102 allPermissions: {103 selectors: ["#navigator-toolbox", "#identity-popup"],104 async applyConfig() {105 // TODO: (Bug 1330601) Rewrite this to consider temporary (TAB) permission states.106 // There are 2 possible non-default permission states, so we alternate between them.107 let states = [SitePermissions.ALLOW, SitePermissions.BLOCK];108 let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(109 PERMISSIONS_PAGE110 );111 SitePermissions.listPermissions().forEach(function(permission, index) {112 SitePermissions.setForPrincipal(113 principal,114 permission,115 states[index % 2]116 );117 });118 await loadPage(PERMISSIONS_PAGE);119 await openIdentityPopup();120 },121 },122 mixed: {123 selectors: ["#navigator-toolbox", "#identity-popup"],124 async applyConfig() {125 await loadPage(MIXED_CONTENT_URL);126 await openIdentityPopup();127 },128 },129 mixedSubView: {130 selectors: ["#navigator-toolbox", "#identity-popup"],131 async applyConfig() {132 await loadPage(MIXED_CONTENT_URL);133 await openIdentityPopup(true);134 },135 },136 mixedPassive: {137 selectors: ["#navigator-toolbox", "#identity-popup"],138 async applyConfig() {139 await loadPage(MIXED_PASSIVE_CONTENT_URL);140 await openIdentityPopup();141 },142 },143 mixedPassiveSubView: {144 selectors: ["#navigator-toolbox", "#identity-popup"],145 async applyConfig() {146 await loadPage(MIXED_PASSIVE_CONTENT_URL);147 await openIdentityPopup(true);148 },149 },150 mixedActive: {151 selectors: ["#navigator-toolbox", "#identity-popup"],152 async applyConfig() {153 await loadPage(MIXED_ACTIVE_CONTENT_URL);154 await openIdentityPopup();155 },156 },157 mixedActiveSubView: {158 selectors: ["#navigator-toolbox", "#identity-popup"],159 async applyConfig() {160 await loadPage(MIXED_ACTIVE_CONTENT_URL);161 await openIdentityPopup(true);162 },163 },164 mixedActiveUnblocked: {165 selectors: ["#navigator-toolbox", "#identity-popup"],166 async applyConfig() {167 let browserWindow = Services.wm.getMostRecentWindow(168 "navigator:browser"169 );170 let gBrowser = browserWindow.gBrowser;171 await loadPage(MIXED_ACTIVE_CONTENT_URL);172 gBrowser.ownerGlobal.gIdentityHandler.disableMixedContentProtection();173 await BrowserTestUtils.browserLoaded(174 gBrowser.selectedBrowser,175 false,176 MIXED_ACTIVE_CONTENT_URL177 );178 await openIdentityPopup();179 },180 },181 mixedActiveUnblockedSubView: {182 selectors: ["#navigator-toolbox", "#identity-popup"],183 async applyConfig() {184 let browserWindow = Services.wm.getMostRecentWindow(185 "navigator:browser"186 );187 let gBrowser = browserWindow.gBrowser;188 await loadPage(MIXED_ACTIVE_CONTENT_URL);189 gBrowser.ownerGlobal.gIdentityHandler.disableMixedContentProtection();190 await BrowserTestUtils.browserLoaded(191 gBrowser.selectedBrowser,192 false,193 MIXED_ACTIVE_CONTENT_URL194 );195 await openIdentityPopup(true);196 },197 },198 httpPassword: {199 selectors: ["#navigator-toolbox", "#identity-popup"],200 async applyConfig() {201 await loadPage(HTTP_PASSWORD_PAGE);202 await openIdentityPopup();203 },204 },205 httpPasswordSubView: {206 selectors: ["#navigator-toolbox", "#identity-popup"],207 async applyConfig() {208 await loadPage(HTTP_PASSWORD_PAGE);209 await openIdentityPopup(true);210 },211 },212 trackingProtectionNoElements: {213 selectors: ["#navigator-toolbox", "#protections-popup"],214 async applyConfig() {215 Services.prefs.setBoolPref("privacy.trackingprotection.enabled", true);216 await loadPage(HTTP_PAGE);217 await openProtectionsPopup();218 },219 },220 trackingProtectionEnabled: {221 selectors: ["#navigator-toolbox", "#protections-popup"],222 async applyConfig() {223 Services.prefs.setBoolPref("privacy.trackingprotection.enabled", true);224 await UrlClassifierTestUtils.addTestTrackers();225 await loadPage(TRACKING_PAGE);226 await openProtectionsPopup();227 },228 },229 trackingProtectionDisabled: {230 selectors: ["#navigator-toolbox", "#protections-popup"],231 async applyConfig() {232 let browserWindow = Services.wm.getMostRecentWindow(233 "navigator:browser"234 );235 let gBrowser = browserWindow.gBrowser;236 Services.prefs.setBoolPref("privacy.trackingprotection.enabled", true);237 await UrlClassifierTestUtils.addTestTrackers();238 await loadPage(TRACKING_PAGE);239 // unblock the page240 let loaded = BrowserTestUtils.browserLoaded(241 gBrowser.selectedBrowser,242 false,243 TRACKING_PAGE244 );245 gBrowser.ownerGlobal.gProtectionsHandler.disableForCurrentPage();246 await loaded;247 await openProtectionsPopup();248 },249 },250 },251};252async function loadPage(url) {253 let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");254 let gBrowser = browserWindow.gBrowser;255 BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);256 await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, url);257}258async function openIdentityPopup(expand) {259 let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");260 let gBrowser = browserWindow.gBrowser;261 let { gIdentityHandler } = gBrowser.ownerGlobal;262 gIdentityHandler._identityPopup.hidePopup();263 // Disable the popup shadow on OSX until we have figured out bug 1425253.264 if (AppConstants.platform == "macosx") {265 gIdentityHandler._identityPopup.classList.add("no-shadow");266 }...

Full Screen

Full Screen

CustomNavigationMenu.js

Source:CustomNavigationMenu.js Github

copy

Full Screen

...91 const redirectPage = (e) => {92 e.preventDefault();93 // history.push(`/pages/${labelText}`);94 if(labelText === 'Dashboard')95 loadPage(pageConstants.DASHBOARD);96 else if(labelText === 'Quotes')97 loadPage(pageConstants.QUOTES);98 else if(labelText === 'Shipments')99 loadPage(pageConstants.SHIPMENTS);100 else if(labelText === 'Billing')101 loadPage(billConstants.BILLING);102 else if(labelText === 'Reports')103 loadPage(pageConstants.REPORTS);104 else if(labelText === 'Booking')105 loadPage(pageConstants.BOOKING);106 };107 return (108 <TreeItem109 onClick={e=> redirectPage(e)}110 label={111 <div className={classes.labelRoot}>112 <LabelIcon color="inherit" className={classes.labelIcon} />113 <Typography variant="body2" className={classes.labelText}>114 {labelText}115 </Typography>116 <Typography variant="caption" color="inherit">117 {labelInfo}118 </Typography>119 </div>...

Full Screen

Full Screen

Pagination.js

Source:Pagination.js Github

copy

Full Screen

...19 };20 onPreviousButtonClickAction = () => {21 const { loadPage, activePage } = this.props;22 if (!this.isPreviousButtonDisabled()) {23 loadPage(activePage - 1);24 }25 };26 onNextButtonClickAction = () => {27 const { loadPage, activePage } = this.props;28 if (!this.isNextButtonDisabled()) {29 loadPage(activePage + 1);30 }31 };32 render = () => {33 const { totalPages, activePage } = this.props;34 return (35 <nav36 className="pagination is-centered"37 role="navigation"38 aria-label="pagination"39 >40 {totalPages > 1 && (41 <ul className="pagination-list">42 <li43 key="lessThan"...

Full Screen

Full Screen

template.js

Source:template.js Github

copy

Full Screen

1var dataMenu = {2 hMenu: [3 {label: 'Dati Generali', plugin: 'loadVMenu', menu: 'dati', tooltip: '', class: '', default:1},4 {label: 'Istruttoria Tecnica', plugin: 'loadVMenu', menu: 'it', tooltip: '', class: '', default:0},5 {label: 'Istruttoria Amministrativa', plugin: 'loadVMenu', menu: 'ia', tooltip: '', class: '', default:0},6 {label: 'Titolo', plugin: 'loadVMenu', menu: 'titolo', tooltip: '', class: '', default:0},7 {label: 'Lavori', plugin: 'loadVMenu', menu: 'lavori', tooltip: '', class: '', default:0},8 {label: 'Pagamenti', plugin: 'loadVMenu', menu: 'pagamenti', tooltip: '', class: '', default:0},9 {label: 'Iter', plugin: 'loadVMenu', menu: 'iter', tooltip: '', class: '', default:0}10 ],11 vMenu: {12 dati: [13 {label: 'Avvio Procedimento', plugin: 'loadPage', page: 'avvioproc', tooltip: '', class: '', default:1},14 {label: 'Soggetti', plugin: 'loadPage', page: 'soggetti', tooltip: '', class: '', default:0},15 {label: 'Ubicazione', plugin: 'loadPage', page: 'ubicazione', tooltip: '', class: '', default:0},16 {label: 'Allegati', plugin: 'loadPage', page: 'allegati', tooltip: '', class: '', default:0},17 {label: 'Integrazioni', plugin: 'loadPage', page: 'integrazioni', tooltip: '', class: '', default:0}18 ],19 it: [20 {label: 'Relazione Tecnica', plugin: 'loadPage', page: '', tooltip: '', class: '', default:1},21 {label: 'Parametri Progetto', plugin: 'loadPage', page: '', tooltip: '', class: '', default:0},22 {label: 'Oneri', plugin: 'loadPage', page: '', tooltip: '', class: '', default:0},23 {label: 'Rateizzazione', plugin: 'loadPage', page: '', tooltip: '', class: '', default:0},24 {label: 'FideJussioni', plugin: 'loadPage', page: '', tooltip: '', class: '', default:0}25 ],26 ia: [27 {label: 'Pareri Enti Esterni', plugin: 'loadPage', page: '', tooltip: '', class: '', default:1},28 {label: 'Commissioni', plugin: 'loadPage', page: '', tooltip: '', class: '', default:0},29 {label: 'Asservimenti', plugin: 'loadPage', page: '', tooltip: '', class: '', default:0},30 {label: 'Atti', plugin: 'loadPage', page: '', tooltip: '', class: '', default:0}31 ],32 titolo: [33 {label: 'Titolo', plugin: 'loadPage', page: '', tooltip: '', class: '', default:1},34 {label: 'Voltura', plugin: 'loadPage', page: '', tooltip: '', class: '', default:0}35 ],36 lavori: [37 {label: 'Lavori', plugin: 'loadPage', page: '', tooltip: '', class: '', default:1},38 {label: 'Proroghe', plugin: 'loadPage', page: '', tooltip: '', class: '', default:0}39 40 ],41 pagamenti: [42 {label: 'Importi Dovuti', plugin: 'loadPage', page: '', tooltip: '', class: '', default:1},43 {label: 'Pagamenti', plugin: 'loadPage', page: '', tooltip: '', class: '', default:0},44 {label: 'Scadenze', plugin: 'loadPage', page: '', tooltip: '', class: '', default:0}45 ],46 iter: [47 {label: 'Iter', plugin: 'loadPage', page: '', tooltip: '', class: '', default:1},48 {label: 'Comunicazioni', plugin: 'loadPage', page: '', tooltip: '', class: '', default:0},49 {label: 'Notifiche', plugin: 'loadPage', page: '', tooltip: '', class: '', default:0},50 {label: 'Annotazioni', plugin: 'loadPage', page: '', tooltip: '', class: '', default:0},51 {label: 'Visione Pratiche', plugin: 'loadPage', page: '', tooltip: '', class: '', default:0}52 ]53 }54};55var template = {56 hMenu: '<li class="%(class)s" data-tooltip="%(tooltip)s" data-default="%(default)s"><a href="#" data-plugin="%(plugin)s" data-menu="%(menu)s" >%(label)s</a></li>',57 vMenu: '<li class="%(class)s" data-tooltip="%(tooltip)s" data-group="%(group)s" data-default="%(default)s"><a class="list-group-item" href="#" data-plugin="%(plugin)s" data-page="%(page)s">%(label)s</a></li>'...

Full Screen

Full Screen

visualize.js

Source:visualize.js Github

copy

Full Screen

...12 //初始化默认界面13 initPage : function(){14 visualize.selectOn("conversionRate");15 var url = ctx + "/base/to/visualize/conversionRate";16 visualize.loadPage(url);17 },18 //转换率19 conversionRate : function(){20 $("#conversionRate").click(function(){21 visualize.selectOn("conversionRate");22 var url = ctx + "/base/to/visualize/conversionRate";23 visualize.loadPage(url);24 });25 },26 //航班查询爬取规律27 flightQueryRule : function(){28 $("#flightQueryRule").click(function(){29 visualize.selectOn("flightQueryRule");30 var url = ctx + "/base/to/visualize/flightQueryRule";31 visualize.loadPage(url);32 });33 },34 //占座规律35 occRule : function(){36 $("#occRule").click(function(){37 visualize.selectOn("occRule");38 var url = ctx + "/base/to/visualize/occRule";39 visualize.loadPage(url);40 });41 },42 //爬虫对查定比影响43 rateImpact : function(){44 $("#rateImpact").click(function(){45 visualize.selectOn("rateImpact");46 var url = ctx + "/base/to/visualize/rateImpact";47 visualize.loadPage(url);48 });49 },50 //爬虫对系统稳定性影响51 stableInfluence : function(){52 $("#stableInfluence").click(function(){53 visualize.selectOn("stableInfluence");54 var url = ctx + "/base/to/visualize/stableInfluence";55 visualize.loadPage(url);56 });57 },58 //代购识别分析59 identifyAnalysis : function(){60 $("#identifyAnalysis").click(function(){61 visualize.selectOn("identifyAnalysis");62 var url = ctx + "/base/to/visualize/identifyAnalysis";63 visualize.loadPage(url);64 });65 },66 //加载页面67 loadPage : function(url){68 $("#subjectBoxDataVisual").html("");69 $("#subjectBoxDataVisual").load(url);70 },71 //选中某个选项,突出显示72 selectOn : function(id){73 $('#navDataVisual').find('li').each(function() {74 $(this).removeClass("on");75 });76 $('#'+ id).addClass("on");77 }...

Full Screen

Full Screen

router.js

Source:router.js Github

copy

Full Screen

1import { createRouter, createWebHashHistory } from 'vue-router'2function loadPage(page) {3 return () => import(`./pages/${page}.vue`)4}5const routes = [6 {7 path: '/',8 name: 'Home',9 component: loadPage('HomePage')10 },11 {12 path: '/about',13 name: 'About',14 component: loadPage('AboutPage')15 },16 {17 path: '/resume',18 name: 'Resume',19 component: loadPage('ResumePage')20 },21 {22 path: '/portfolio',23 name: 'Portfolio',24 component: loadPage('PortfolioPage')25 },26 {27 path: '/projects/bugreport',28 name: 'BugReport',29 component: loadPage('BugReportPage')30 },31 {32 path: '/projects/moonminer',33 name: 'MoonMiner',34 component: loadPage('MoonMinerPage')35 },36 {37 path: '/projects/capstone',38 name: 'Capstone',39 component: loadPage('CapstonePage')40 },41 {42 path: '/projects/taskmaster',43 name: 'TaskMaster',44 component: loadPage('TaskMasterPage')45 },46 {47 path: '/projects/inspire',48 name: 'Inspire',49 component: loadPage('InspirePage')50 },51 {52 path: '/projects/keepr',53 name: 'Keepr',54 component: loadPage('KeeprPage')55 }56]57const router = createRouter({58 linkActiveClass: 'router-link-active',59 linkExactActiveClass: 'router-link-exact-active',60 history: createWebHashHistory(),61 routes62})...

Full Screen

Full Screen

menu_controller.js

Source:menu_controller.js Github

copy

Full Screen

1function start_game(){2 name = prompt("User name");3 4 sessionStorage.setItem("username", name);5 6 loadpage("./html/game.html");7}8function phaser_game(){9 loadpage("./html/phasergame.html");10}11function exit (){12 if (name != ""){13 alert("Leaving " + name + "'s game");14 }15 name = "";16 loadpage("../index.html");17}18function options(){19 loadpage("./html/options.html");20}21function load(){22 loadpage("./html/load.html");...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var AppiumXCUITestDriver = require('appium-xcuitest-driver');2var driver = new AppiumXCUITestDriver();3var AppiumIOSDriver = require('appium-ios-driver');4var driver = new AppiumIOSDriver();5var AppiumAndroidDriver = require('appium-android-driver');6var driver = new AppiumAndroidDriver();7var AppiumWindowsDriver = require('appium-windows-driver');8var driver = new AppiumWindowsDriver();9var AppiumMacDriver = require('appium-mac-driver');10var driver = new AppiumMacDriver();11var AppiumEspressoDriver = require('appium-espresso-driver');12var driver = new AppiumEspressoDriver();13var AppiumYouiEngineDriver = require('appium-youiengine-driver');14var driver = new AppiumYouiEngineDriver();15var AppiumSelendroidDriver = require('appium-selendroid-driver');16var driver = new AppiumSelendroidDriver();17var AppiumTizenDriver = require('appium-tizen-driver');18var driver = new AppiumTizenDriver();19var AppiumWebDriver = require('appium-webdriver');20var driver = new AppiumWebDriver();21var AppiumBaseDriver = require('appium-base-driver');

Full Screen

Using AI Code Generation

copy

Full Screen

1const wd = require('wd');2const {exec} = require('child_process');3const assert = require('assert');4const fs = require('fs');5const desiredCaps = {6};7const startSafari = async () => {8 await driver.init(desiredCaps);9 await driver.sleep(5000);10 await driver.sleep(5000);11 await driver.quit();12};13startSafari();14[debug] [WD Proxy] Got response with status 200: {"value":{"error":"unknown command","

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Appium Xcuitest Driver automation tests on LambdaTest cloud grid

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

Sign up Free
_

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful