How to use page.press method in qawolf

Best JavaScript code snippet using qawolf

Create.js

Source:Create.js Github

copy

Full Screen

1/*!2 * ${copyright}3 */4sap.ui.define([5 "sap/base/Log",6 "sap/ui/test/TestUtils"7], function (Log, TestUtils) {8 "use strict";9 return {10 create : function (Given, When, Then, sUIComponent) {11 var oExpectedLog = {12 component : "sap.ui.model.odata.v4.ODataParentBinding",13 level : Log.Level.ERROR,14 message : "POST on 'SalesOrderList' failed; will be repeated automatically"15 },16 sModifiedNote = "Modified by OPA",17 bRealOData = TestUtils.isRealOData();18 Given.iStartMyUIComponent({19 componentConfig : {20 name : sUIComponent || "sap.ui.core.sample.odata.v4.SalesOrders"21 }22 });23 sap.ui.test.Opa.getContext().sViewName = "sap.ui.core.sample.odata.v4.SalesOrders.Main";24 // Create, modify and delete of an unsaved sales order25 When.onTheMainPage.firstSalesOrderIsVisible();26 if (!bRealOData) {27 Then.onTheMainPage.checkSalesOrdersCount(10);28 }29 // check value helps within sales order line items30 When.onTheMainPage.selectFirstSalesOrder();31 When.onTheMainPage.pressValueHelpOnProductCategory();32 Then.onTheValueHelpPopover.checkTitle("Value Help: Category (Modified Mapping)");33 When.onTheValueHelpPopover.close();34 When.onTheMainPage.setValueHelpQualifier("additional");35 When.onTheMainPage.pressValueHelpOnProductCategory();36 Then.onTheValueHelpPopover.checkTitle("Value Help: Category (Additional Mapping)");37 When.onTheValueHelpPopover.close();38 When.onTheMainPage.pressValueHelpOnProductTypeCode();39 When.onTheMainPage.pressCreateSalesOrdersButton();40 Then.onTheCreateNewSalesOrderDialog.checkNewBuyerId("0100000000");41 Then.onTheCreateNewSalesOrderDialog.checkNewNote();42 Then.onTheCreateNewSalesOrderDialog.checkCurrencyCodeIsValueHelp();43 When.onTheCreateNewSalesOrderDialog.pressValueHelpOnCurrencyCode();44 When.onTheValueHelpPopover.close();45 Then.onTheMainPage.checkNote(0);46 When.onTheCreateNewSalesOrderDialog.changeNote(sModifiedNote);47 Then.onTheCreateNewSalesOrderDialog.checkNewNote(sModifiedNote);48 Then.onTheMainPage.checkNote(0, sModifiedNote);49 When.onTheCreateNewSalesOrderDialog.confirmDialog();50 if (!bRealOData) {51 Then.onTheMainPage.checkSalesOrdersCount(10);52 }53 Then.onTheMainPage.checkID(0, "");54 Then.onTheMainPage.checkSalesOrderSelected(0);55 When.onTheMainPage.changeNote(0, sModifiedNote + "_2");56 Then.onTheMainPage.checkNote(0, sModifiedNote + "_2");57 When.onTheMainPage.deleteSelectedSalesOrder();58 When.onTheSalesOrderDeletionConfirmation.cancel();59 Then.onTheMainPage.checkID(0, "");60 When.onTheMainPage.deleteSelectedSalesOrder();61 When.onTheSalesOrderDeletionConfirmation.confirm();62 When.onTheSuccessInfo.confirm();63 if (!bRealOData) {64 Then.onTheMainPage.checkSalesOrdersCount(10);65 }66 Then.onTheMainPage.checkID(0);67 // Create a sales order, save, modify again, save and delete68 When.onTheMainPage.pressCreateSalesOrdersButton();69 When.onTheCreateNewSalesOrderDialog.changeNote(sModifiedNote + "_save");70 When.onTheCreateNewSalesOrderDialog.confirmDialog();71 Then.onTheMainPage.checkID(0, "");72 Then.onTheMainPage.checkButtonDisabled("confirmSalesOrder");73 When.onTheMainPage.pressSaveSalesOrdersButton();74 When.onTheSuccessInfo.confirm();75 if (bRealOData) {76 Then.onTheMainPage.checkButtonEnabled("confirmSalesOrder");77 // TODO: TestUtils may support to provide JSON response/or generated keys...78 Then.onTheMainPage.checkDifferentID(0, "");79 // TODO: TestUtils does not support PATCH at all80 When.onTheMainPage.changeNote(0, sModifiedNote + "_3");81 When.onTheMainPage.pressSaveSalesOrdersButton();82 }83 When.onTheMainPage.deleteSelectedSalesOrder();84 When.onTheSalesOrderDeletionConfirmation.confirm();85 When.onTheSuccessInfo.confirm();86 Then.onTheMainPage.checkID(0);87 // Create a sales order, save and refresh the sales orders88 When.onTheMainPage.pressCreateSalesOrdersButton();89 When.onTheCreateNewSalesOrderDialog.changeNote(sModifiedNote + "_save");90 When.onTheCreateNewSalesOrderDialog.confirmDialog();91 Then.onTheMainPage.checkID(0, "");92 When.onTheMainPage.pressSaveSalesOrdersButton();93 Then.onTheSuccessInfo.checkMessage(/SalesOrder created: \d*, SAP/);94 When.onTheSuccessInfo.confirm();95 if (!bRealOData) {96 Then.onTheMainPage.checkSalesOrdersCount(11);97 }98 When.onTheMainPage.rememberCreatedSalesOrder();99 When.onTheMainPage.pressRefreshSalesOrdersButton();100 Then.onTheMainPage.checkID(0);101 When.onTheMainPage.doubleRefresh();102 Then.onTheMainPage.checkID(0);103 // Create a sales order, refresh/filter w/o saving -> expected "pending changes" message104 When.onTheMainPage.pressCreateSalesOrdersButton();105 When.onTheCreateNewSalesOrderDialog.confirmDialog();106 // Cancel refresh107 When.onTheMainPage.pressRefreshSalesOrdersButton();108 When.onTheRefreshConfirmation.cancel();109 Then.onTheMainPage.checkID(0, "");110 When.onTheMainPage.pressRefreshAllButton();111 When.onTheRefreshConfirmation.cancel();112 Then.onTheMainPage.checkID(0, "");113 if (bRealOData) {114 When.onTheMainPage.filterGrossAmount("1000");115 When.onTheErrorInfo.confirm();116 Then.onTheMainPage.checkID(0, "");117 }118 // Confirm refresh119 When.onTheMainPage.pressRefreshSalesOrdersButton();120 When.onTheRefreshConfirmation.confirm();121 When.onTheMainPage.firstSalesOrderIsAtPos0();122 Then.onTheMainPage.checkID(0);123 // Create a sales order, press "cancel sales order changes" w/o saving124 When.onTheMainPage.pressCreateSalesOrdersButton();125 When.onTheCreateNewSalesOrderDialog.confirmDialog();126 When.onTheMainPage.pressCancelSalesOrderListChangesButton();127 When.onTheMainPage.firstSalesOrderIsAtPos0();128 if (!bRealOData) {129 Then.onTheMainPage.checkSalesOrdersCount(10);130 }131 Then.onTheMainPage.checkID(0);132 if (bRealOData) {133 // Cancel or resume a failed creation of a sales order134 // Create a sales order with invalid note, save, cancel135 When.onTheMainPage.pressCreateSalesOrdersButton();136 When.onTheCreateNewSalesOrderDialog.confirmDialog();137 When.onTheMainPage.changeNote(0, "RAISE_ERROR");138 When.onTheMainPage.pressSaveSalesOrdersButton();139 When.onTheMessagePopover.close();140 When.onTheMainPage.pressRefreshSalesOrdersButton();141 When.onTheRefreshConfirmation.cancel();142 Then.onTheMainPage.checkID(0, "");143 When.onTheMainPage.pressCancelSalesOrderListChangesButton();144 When.onTheMainPage.firstSalesOrderIsAtPos0();145 // Create a sales order with invalid note, save, update note, save -> success146 When.onTheMainPage.pressCreateSalesOrdersButton();147 When.onTheCreateNewSalesOrderDialog.confirmDialog();148 When.onTheMainPage.changeNote(0, "RAISE_ERROR");149 When.onTheMainPage.pressSaveSalesOrdersButton();150 When.onTheMessagePopover.close();151 // Do it again to ensure that it is retried without update152 When.onTheMainPage.pressSaveSalesOrdersButton();153 When.onTheMessagePopover.close();154 When.onTheMainPage.changeNote(0, "Valid Note");155 When.onTheMainPage.pressSaveSalesOrdersButton();156 When.onTheSuccessInfo.confirm();157 Then.onTheMainPage.checkDifferentID(0, "");158 // cleanup159 When.onTheMainPage.deleteSelectedSalesOrder();160 When.onTheSalesOrderDeletionConfirmation.confirm();161 When.onTheSuccessInfo.confirm();162 Then.onTheMainPage.checkID(0);163 }164 // set base context for input field FavoriteProductID165 When.onTheMainPage.pressSetBindingContextButton();166 Then.onTheMainPage.checkFavoriteProductID();167 if (!bRealOData) {168 // Some special/detailed filter and sorter tasks169 // Tests made with mockdata to have stable data, -> this can not be tested manually170 // because sort buttons/searchfield are not enabled for !oRealOData171 // therefore the test are directly tiggered either with controller code or via172 // ODLB.changeParameter API173 // Filter and then sort: filter is not lost on sort174 When.onTheMainPage.filterGrossAmountViaAPI("1000");175 Then.onTheMainPage.checkFirstGrossAmountGreater("1000");176 When.onTheMainPage.sortByGrossAmountViaController();177 Then.onTheMainPage.checkFirstGrossAmountGreater("1000");178 When.onTheMainPage.selectFirstSalesOrder();179 // stores sales order ID in Opa context180 When.onTheMainPage.firstSalesOrderIsVisible();181 //sort by sales order ID descending182 When.onTheMainPage.sortByGrossAmountViaController();183 Then.onTheMainPage.checkSalesOrderIdInDetails(false); // selection is kept184 // Change filter via API (changeParameters)185 When.onTheMainPage.sortByGrossAmountViaController();186 When.onTheMainPage.filterSOItemsByProductIdWithChangeParameters(1);187 Then.onTheMainPage.checkSalesOrderItemInRow(0);188 // reset filter again (Note: resets also filter ItemPosition gt '0000000000')189 When.onTheMainPage.filterSOItemsByProductIdWithChangeParameters(undefined);190 // Sort191 When.onTheMainPage.sortBySalesOrderIDviaController(); // sort by sales order ID asc.192 // stores sales order ID in Opa context193 When.onTheMainPage.firstSalesOrderIsVisible();194 // sort by sales order ID desc.195 When.onTheMainPage.sortBySalesOrderIDviaController();196 Then.onTheMainPage.checkSalesOrderIdInDetails(true); // selection lost197 // Relative list bindings show correct data when switching to a different context198 When.onTheMainPage.sortBySalesOrderIDviaController(); // sort to the initial order199 When.onTheMainPage.selectSalesOrderWithId("0500000000");200 Then.onTheMainPage.checkSalesOrderItemInRow(0, "0500000000", "0000000010");201 When.onTheMainPage.selectSalesOrderItemWithPosition("0000000010");202 Then.onTheMainPage.checkContactNameInRow(0, "Karl");203 Then.onTheMainPage.checkContactNameInRow(1, "Harald");204 When.onTheMainPage.selectSalesOrderItemWithPosition("0000000020");205 Then.onTheMainPage.checkContactNameInRow(0, "Dagmar");206 Then.onTheMainPage.checkContactNameInRow(1, "Ursula");207 Then.onTheMainPage.checkContactNameInRow(2, "Foo");208 When.onTheMainPage.selectSalesOrderItemWithPosition("0000000010");209 Then.onTheMainPage.checkContactNameInRow(0, "Karl");210 Then.onTheMainPage.checkContactNameInRow(1, "Harald");211 // Filter on relative list binding (table without extended change detection)212 When.onTheMainPage.selectSalesOrderWithId("0500000000");213 Then.onTheMainPage.checkSalesOrderItemInRow(0, "0500000000", "0000000010");214 When.onTheMainPage.selectSalesOrderItemWithPosition("0000000010");215 Then.onTheMainPage.checkSupplierPhoneNumber("0622734567");216 // select the row that remains, so that it will be selected after the filtering217 When.onTheMainPage.selectSalesOrderItemWithPosition("0000000020");218 When.onTheMainPage.filterSalesOrderItemsByProductID("HT-1001");219 Then.onTheMainPage.checkSalesOrderItemInRow(0, "0500000000", "0000000020");220 Then.onTheMainPage.checkSupplierPhoneNumber("3088530");221 }222 if (bRealOData) {223 // primitive sorter and filter tasks,224 // -> probably not dependent on current sales orders in back end225 When.onTheMainPage.sortBySalesOrderID(); // sort via ID ascending (initial order)226 When.onTheMainPage.firstSalesOrderIsVisible(); //-> we expect first order on POS 0227 When.onTheMainPage.sortBySalesOrderID(); // sort via ID descending228 Then.onTheMainPage.checkSalesOrderIdInDetails(true); //selection lost229 When.onTheMainPage.sortBySalesOrderID(); // no sort230 When.onTheMainPage.sortByGrossAmount(); // sort by GrossAmount ascending231 Then.onTheMainPage.checkSalesOrderIdInDetails(true);232 When.onTheMainPage.sortByGrossAmount(); // sort by GrossAmount descending233 Then.onTheMainPage.checkSalesOrderIdInDetails(true);234 // remember GrossAmount of first item235 When.onTheMainPage.selectFirstSalesOrder(true);236 When.onTheMainPage.filterGrossAmount(undefined); // filter by remembered GrossAmount237 // -> no items left because operator is GT238 Then.onTheMainPage.checkSalesOrdersCount(0);239 }240 // delete the last created SalesOrder again241 When.onAnyPage.cleanUp("SalesOrders");242 Then.onAnyPage.checkLog(bRealOData243 ? [oExpectedLog, oExpectedLog, oExpectedLog]244 : undefined);245 Then.iTeardownMyUIComponent();246 }247 };...

Full Screen

Full Screen

CreateRelative.js

Source:CreateRelative.js Github

copy

Full Screen

1/*!2 * ${copyright}3 */4sap.ui.define([5 "sap/base/Log",6 "sap/ui/test/TestUtils"7], function (Log, TestUtils) {8 "use strict";9 return {10 createRelative : function (Given, When, Then, sUIComponent) {11 var bRealOData = TestUtils.isRealOData();12 // we check supportAssistantIssues only within this test journey because it is the most13 // deepest one regarding reached UI elements14 When.onAnyPage.applySupportAssistant();15 Given.iStartMyUIComponent({16 componentConfig : {17 name : sUIComponent || "sap.ui.core.sample.odata.v4.SalesOrders"18 }19 });20 sap.ui.test.Opa.getContext().sViewName = "sap.ui.core.sample.odata.v4.SalesOrders.Main";21 // Preparation: create a new sales order22 When.onTheMainPage.firstSalesOrderIsVisible();23 When.onTheMainPage.pressCreateSalesOrdersButton();24 When.onTheCreateNewSalesOrderDialog.confirmDialog();25 When.onTheMainPage.pressSaveSalesOrdersButton();26 When.onTheSuccessInfo.confirm();27 When.onTheMainPage.rememberCreatedSalesOrder();28 Then.onTheMainPage.checkTableLength(0, "SalesOrderLineItems");29 // Create a new sales order line item; no refresh allowed; cancel created item30 When.onTheMainPage.pressCreateSalesOrderItemButton();31 Then.onTheMainPage.checkTableLength(1, "SalesOrderLineItems");32 Then.onTheMainPage.checkSalesOrderItemsCount(0); // server side count is still 033 When.onTheMainPage.pressRefreshSalesOrdersButton();34 When.onTheRefreshConfirmation.cancel();35 // canceling different group does not remove created sales order item36 When.onTheMainPage.pressCancelSalesOrderListChangesButton();37 Then.onTheMainPage.checkTableLength(1, "SalesOrderLineItems");38 When.onTheMainPage.pressCancelSalesOrderChangesButton();39 Then.onTheMainPage.checkTableLength(0, "SalesOrderLineItems");40 // Delete transient sales order line item41 When.onTheMainPage.pressCreateSalesOrderItemButton();42 When.onTheMainPage.selectSalesOrderItemWithPosition("");43 When.onTheMainPage.deleteSelectedSalesOrderLineItem();44 When.onTheSalesOrderLineItemDeletionConfirmation.confirm();45 When.onTheSuccessInfo.confirm();46 Then.onTheMainPage.checkTableLength(0, "SalesOrderLineItems");47 // Create a sales order line item; save, update and delete it48 When.onTheMainPage.pressCreateSalesOrderItemButton();49 When.onTheMainPage.selectSalesOrderItemWithPosition("");50 When.onTheMainPage.pressSaveSalesOrderButton();51 When.onTheSuccessInfo.confirm();52 Then.onTheMainPage.checkSalesOrderItemsCount(bRealOData ? 1 : 0);53 if (bRealOData) {54 Then.onTheMainPage.checkNewSalesOrderItemProductName("Notebook Basic 15");55 // update note of new sales order item56 When.onTheMainPage.changeSalesOrderLineItemNote(0, "Line Item Note Changed - 1");57 When.onTheMainPage.pressSaveSalesOrderButton();58 Then.onTheMainPage.checkSalesOrderLineItemNote(0, "Line Item Note Changed - 1");59 // check correct error handling of multiple changes in one $batch60 When.onTheMainPage.changeSalesOrderLineItemNote(0, "Line Item Note Changed - 2");61 When.onTheMainPage.changeSalesOrderLineItemQuantity(0, "0.0");62 When.onTheMainPage.pressSaveSalesOrderButton();63 When.onTheMessagePopover.close();64 When.onTheMainPage.changeSalesOrderLineItemQuantity(0, "2.0");65 When.onTheMainPage.pressSaveSalesOrderButton();66 Then.onTheMainPage.checkSalesOrderLineItemNote(0, "Line Item Note Changed - 2");67 // change context should be possible after Line Items were saved68 // Test only possible with realOData because same GET request for the Line Items69 // with different result happen which is not possible with mockdata70 When.onTheMainPage.selectSalesOrder(1);71 When.onTheMainPage.selectSalesOrder(0);72 When.onTheMainPage.selectSalesOrderItemWithPosition("0000000010");73 // try to change the parent Sales Order,74 // the dependent ODCB should also got its new ETag, check that it can be modified75 When.onTheMainPage.changeNoteInDetails("Sales Order Details Note Changed - 1");76 When.onTheMainPage.pressSaveSalesOrderButton();77 // this is only possible if it has got a new ETag via refresh single78 When.onTheMainPage.changeNote(0, "Sales Order Note Changed - 1");79 When.onTheMainPage.pressSaveSalesOrdersButton();80 // change again Note in details causes error because of outdated ETag81 // because refresh on relative bindings is not supported82 When.onTheMainPage.changeNoteInDetails("Sales Order Details Note Changed - 2");83 When.onTheMainPage.pressSaveSalesOrderButton();84 When.onTheMessagePopover.close();85 // check has pending changes86 When.onTheMainPage.pressRefreshSelectedSalesOrdersButton();87 When.onTheRefreshConfirmation.cancel();88 // reset changes and refresh single sales order89 When.onTheMainPage.pressCancelSalesOrderChangesButton();90 When.onTheMainPage.pressRefreshSelectedSalesOrdersButton();91 // change Note in details afterwarts is now possible again92 When.onTheMainPage.changeNoteInDetails("Sales Order Details Note Changed - 3");93 When.onTheMainPage.pressSaveSalesOrderButton();94 // delete persisted sales order item95 When.onTheMainPage.deleteSelectedSalesOrderLineItem();96 When.onTheSalesOrderLineItemDeletionConfirmation.confirm();97 When.onTheSuccessInfo.confirm();98 Then.onTheMainPage.checkTableLength(0, "SalesOrderLineItems");99 // Confirmation of new created sales order, non-transient but still having -1 path100 // Note: The sales order must have at least one line item101 When.onTheMainPage.pressCreateSalesOrderItemButton();102 When.onTheMainPage.pressSaveSalesOrderButton();103 When.onTheSuccessInfo.confirm();104 When.onTheMainPage.pressConfirmSalesOrderButton();105 }106 // test refresh single107 // preparation108 When.onTheMainPage.pressRefreshSalesOrdersButton();109 When.onTheMainPage.pressCreateSalesOrdersButton();110 When.onTheCreateNewSalesOrderDialog.confirmDialog();111 When.onTheMainPage.pressSaveSalesOrdersButton();112 When.onTheSuccessInfo.confirm();113 When.onTheMainPage.rememberCreatedSalesOrder();114 // test: refresh single reads expands115 When.onTheMainPage.pressRefreshSelectedSalesOrdersButton();116 Then.onTheMainPage.checkCompanyName(0, "SAP");117 When.onTheMainPage.pressCreateSalesOrderItemButton();118 When.onTheMainPage.pressSaveSalesOrderButton();119 When.onTheSuccessInfo.confirm();120 Then.onTheMainPage.checkTableLength(bRealOData ? 1 : 0, "SalesOrderLineItems");121 // test: refresh single refreshes also dependent bindings122 When.onTheMainPage.pressRefreshSelectedSalesOrdersButton();123 Then.onTheMainPage.checkTableLength(bRealOData ? 1 : 0, "SalesOrderLineItems");124 // delete all created SalesOrders again125 When.onAnyPage.cleanUp("SalesOrders");126 Then.onAnyPage.checkLog(bRealOData ? [{127 component : "sap.ui.model.odata.v4.ODataPropertyBinding",128 level : Log.Level.ERROR,129 message : "Failed to update path /SalesOrderList/-1/SO_2_SOITEM"130 //TODO: enable checkLog to deal with RegExp131 }, {132 component : "sap.ui.model.odata.v4.ODataPropertyBinding",133 level : Log.Level.ERROR,134 message : "Failed to update path /SalesOrderList/-1/SO_2_SOITEM"135 //TODO: enable checkLog to deal with RegExp136 }, {137 component : "sap.ui.model.odata.v4.ODataPropertyBinding",138 level : Log.Level.ERROR,139 message : "Failed to update path /SalesOrderList/-1/Note"140 //TODO: enable checkLog to deal with RegExp141 }] : undefined);142 Then.onAnyPage.analyzeSupportAssistant();143 Then.iTeardownMyUIComponent();144 }145 };...

Full Screen

Full Screen

menu.e2e.ts

Source:menu.e2e.ts Github

copy

Full Screen

1import {browser, Key, protractor} from 'protractor';2import {MenuPage} from './menu-page';3describe('menu', () => {4 let page: MenuPage;5 beforeEach(function() {6 page = new MenuPage();7 });8 it('should open menu when the trigger is clicked', () => {9 page.expectMenuPresent(false);10 page.trigger().click();11 page.expectMenuPresent(true);12 expect(page.menu().getText()).toEqual('One\nTwo\nThree\nFour');13 });14 it('should close menu when menu item is clicked', () => {15 page.trigger().click();16 page.items(0).click();17 page.expectMenuPresent(false);18 });19 it('should run click handlers on regular menu items', () => {20 page.trigger().click();21 page.items(0).click();22 expect(page.getResultText()).toEqual('one');23 page.trigger().click();24 page.items(1).click();25 expect(page.getResultText()).toEqual('two');26 });27 it('should run not run click handlers on disabled menu items', () => {28 page.trigger().click();29 page.items(2).click();30 expect(page.getResultText()).toEqual('');31 });32 it('should support multiple triggers opening the same menu', () => {33 page.triggerTwo().click();34 expect(page.menu().getText()).toEqual('One\nTwo\nThree\nFour');35 page.expectMenuAlignedWith(page.menu(), 'trigger-two');36 page.backdrop().click();37 page.expectMenuPresent(false);38 page.trigger().click();39 expect(page.menu().getText()).toEqual('One\nTwo\nThree\nFour');40 page.expectMenuAlignedWith(page.menu(), 'trigger');41 page.backdrop().click();42 page.expectMenuPresent(false);43 });44 it('should mirror classes on host to menu template in overlay', () => {45 page.trigger().click();46 page.menu().getAttribute('class').then((classes: string) => {47 expect(classes).toContain('md-menu-panel custom');48 });49 });50 describe('keyboard events', () => {51 beforeEach(() => {52 // click start button to avoid tabbing past navigation53 page.start().click();54 page.pressKey(Key.TAB);55 });56 it('should auto-focus the first item when opened with ENTER', () => {57 page.pressKey(Key.ENTER);58 page.expectFocusOn(page.items(0));59 });60 it('should auto-focus the first item when opened with SPACE', () => {61 page.pressKey(Key.SPACE);62 page.expectFocusOn(page.items(0));63 });64 it('should not focus the first item when opened with mouse', () => {65 page.trigger().click();66 page.expectFocusOn(page.trigger());67 });68 it('should focus subsequent items when down arrow is pressed', () => {69 page.pressKey(Key.ENTER);70 page.pressKey(Key.DOWN);71 page.expectFocusOn(page.items(1));72 });73 it('should focus previous items when up arrow is pressed', () => {74 page.pressKey(Key.ENTER);75 page.pressKey(Key.DOWN);76 page.pressKey(Key.UP);77 page.expectFocusOn(page.items(0));78 });79 it('should skip disabled items using arrow keys', () => {80 page.pressKey(Key.ENTER);81 page.pressKey(Key.DOWN);82 page.pressKey(Key.DOWN);83 page.expectFocusOn(page.items(3));84 page.pressKey(Key.UP);85 page.expectFocusOn(page.items(1));86 });87 it('should close the menu when tabbing past items', () => {88 page.pressKey(Key.ENTER);89 page.pressKey(Key.TAB);90 page.expectMenuPresent(false);91 page.pressKey(Key.TAB);92 page.pressKey(Key.ENTER);93 page.expectMenuPresent(true);94 page.pressKey(protractor.Key.chord(Key.SHIFT, Key.TAB));95 page.expectMenuPresent(false);96 });97 it('should wrap back to menu when arrow keying past items', () => {98 page.pressKey(Key.ENTER);99 page.pressKey(Key.DOWN);100 page.pressKey(Key.DOWN);101 page.pressKey(Key.DOWN);102 page.expectFocusOn(page.items(0));103 page.pressKey(Key.UP);104 page.expectFocusOn(page.items(3));105 });106 it('should focus before and after trigger when tabbing past items', () => {107 page.pressKey(Key.ENTER);108 page.pressKey(Key.TAB);109 page.expectFocusOn(page.triggerTwo());110 // navigate back to trigger111 page.pressKey(protractor.Key.chord(protractor.Key.SHIFT, protractor.Key.TAB));112 page.pressKey(Key.ENTER);113 page.pressKey(protractor.Key.chord(protractor.Key.SHIFT, protractor.Key.TAB));114 page.expectFocusOn(page.start());115 });116 });117 describe('position - ', () => {118 it('should default menu alignment to "after below" when not set', () => {119 page.trigger().click();120 // menu.x should equal trigger.x, menu.y should equal trigger.y121 page.expectMenuAlignedWith(page.menu(), 'trigger');122 });123 it('should align overlay end to origin end when x-position is "before"', () => {124 page.beforeTrigger().click();125 page.beforeTrigger().getLocation().then(trigger => {126 // the menu's right corner must be attached to the trigger's right corner.127 // menu = 112px wide. trigger = 60px wide. 112 - 60 = 52px of menu to the left of trigger.128 // trigger.x (left corner) - 52px (menu left of trigger) = expected menu.x (left corner)129 // menu.y should equal trigger.y because only x position has changed.130 page.expectMenuLocation(page.beforeMenu(), {x: trigger.x - 52, y: trigger.y});131 });132 });133 it('should align overlay bottom to origin bottom when y-position is "above"', () => {134 page.aboveTrigger().click();135 page.aboveTrigger().getLocation().then(trigger => {136 // the menu's bottom corner must be attached to the trigger's bottom corner.137 // menu.x should equal trigger.x because only y position has changed.138 // menu = 64px high. trigger = 20px high. 64 - 20 = 44px of menu extending up past trigger.139 // trigger.y (top corner) - 44px (menu above trigger) = expected menu.y (top corner)140 page.expectMenuLocation(page.aboveMenu(), {x: trigger.x, y: trigger.y - 44});141 });142 });143 it('should align menu to top left of trigger when "below" and "above"', () => {144 page.combinedTrigger().click();145 page.combinedTrigger().getLocation().then(trigger => {146 // trigger.x (left corner) - 52px (menu left of trigger) = expected menu.x147 // trigger.y (top corner) - 44px (menu above trigger) = expected menu.y148 page.expectMenuLocation(page.combinedMenu(), {x: trigger.x - 52, y: trigger.y - 44});149 });150 });151 });...

Full Screen

Full Screen

MessageHandling.js

Source:MessageHandling.js Github

copy

Full Screen

1/*!2 * ${copyright}3 */4sap.ui.define([5 "sap/ui/core/MessageType",6 "sap/ui/test/Opa5",7 "sap/ui/test/TestUtils"8], function (MessageType, Opa5, TestUtils) {9 "use strict";10 return {11 checkMessages : function (Given, When, Then, sUIComponent) {12 var sPersistentMessage = "Enter customer reference if available",13 sTransientMessage = "Minimum order quantity is 2",14 sUnboundMessage = "Example for an unbound message";15 if (TestUtils.isRealOData()) {16 Opa5.assert.ok(true, "Test runs only with mock data");17 return;18 }19 Given.iStartMyUIComponent({20 componentConfig : {21 name : sUIComponent || "sap.ui.core.sample.odata.v4.SalesOrders"22 }23 });24 When.onTheMainPage.firstSalesOrderIsVisible();25 Then.onTheMainPage.checkMessageCount(2);26 Then.onTheMainPage.checkNoteValueState(1, "Warning", sPersistentMessage);27 When.onTheMainPage.pressMessagesButton();28 Then.onTheMainPage.checkMessages([{29 message : sUnboundMessage,30 type : MessageType.Information31 }, {32 message : sPersistentMessage,33 type : MessageType.Warning34 }]);35 When.onTheMainPage.selectMessage(sUnboundMessage);36 Then.onTheMainPage.checkMessageDetails(sUnboundMessage,37 "Details for \"Example for an unbound message\" (absolute longtext URL).");38 When.onTheMainPage.pressBackToMessagesButton();39 When.onTheMainPage.selectMessage(sPersistentMessage);40 Then.onTheMainPage.checkMessageDetails(sPersistentMessage,41 "Details for \"Enter customer reference if available\" (relative longtext URL).");42 When.onTheMainPage.pressBackToMessagesButton();43 When.onTheMainPage.pressMessagePopoverCloseButton();44 Then.onTheMainPage.checkMessageCount(0);45 Then.onTheMainPage.checkNoteValueState(1, "None", "");46 When.onTheMainPage.pressMessagesButton();47 Then.onTheMainPage.checkMessages([]);48 When.onTheMainPage.pressMessagePopoverCloseButton();49 When.onTheMainPage.selectSalesOrder(1);50 Then.onTheMainPage.checkMessageCount(2);51 Then.onTheMainPage.checkNoteValueState(1, "Warning", sPersistentMessage);52 Then.onTheMainPage.checkInputValueState("SOD_Note", "Warning", sPersistentMessage);53 Then.onTheMainPage.checkSalesOrderLineItemQuantityValueState(1, "Error",54 sTransientMessage);55 When.onTheMainPage.pressMessagesButton();56 Then.onTheMainPage.checkMessages([{57 message : sPersistentMessage,58 type : MessageType.Warning59 }, {60 message : sTransientMessage,61 type : MessageType.Error62 }]);63 When.onTheMainPage.selectMessage(sTransientMessage);64 Then.onTheMainPage.checkMessageDetails(sTransientMessage,65 "Details for \"Minimum order quantity is 2\" (absolute longtext URL).");66 When.onTheMainPage.pressBackToMessagesButton();67 When.onTheMainPage.pressMessagePopoverCloseButton();68 Then.onTheMainPage.checkMessageCount(1);69 When.onTheMainPage.pressMessagesButton();70 Then.onTheMainPage.checkMessages([{71 message : sTransientMessage,72 type : MessageType.Error73 }]);74 When.onTheMainPage.pressMessagePopoverCloseButton();75 Then.onTheMainPage.checkNoteValueState(1, "None", "");76 Then.onTheMainPage.checkInputValueState("SOD_Note", "None", "");77 Then.onTheMainPage.checkSalesOrderLineItemQuantityValueState(1, "Error",78 sTransientMessage);79 When.onTheMainPage.selectSalesOrder(0);80 Then.onTheMainPage.checkSalesOrderLineItemQuantityValueState(1, "None", "");81 Then.onTheMainPage.checkMessageCount(1);82 When.onTheMainPage.selectSalesOrder(1);83 Then.onTheMainPage.checkSalesOrderLineItemQuantityValueState(1, "Error",84 sTransientMessage);85 Then.onTheMainPage.checkMessageCount(1);86 When.onTheMainPage.pressMessagesButton();87 Then.onTheMainPage.checkMessages([{88 message : sTransientMessage,89 type : MessageType.Error90 }]);91 When.onTheMainPage.pressMessagePopoverCloseButton();92 Then.onAnyPage.checkLog();93 Then.iTeardownMyUIComponent();94 }95 };...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const qawolf = require("qawolf");2const selectors = require("./selectors/test");3describe("test", () => {4 let browser;5 let page;6 beforeAll(async () => {7 browser = await qawolf.launch();8 page = await qawolf.createPage(browser);9 });10 afterAll(async () => {11 await qawolf.stopVideos();12 await browser.close();13 });14 it("test", async () => {15 await page.press(selectors.searchInput, "Enter");16 });17});18module.exports = {19 searchInput: "#tsf > div:nth-child(2) > div > div.RNNXgb > div > div.a4bIc > input",20};

Full Screen

Using AI Code Generation

copy

Full Screen

1const { launch } = require('qawolf');2const selectors = require('./selectors/test.json');3test('test', async () => {4 const browser = await launch();5 const context = await browser.newContext();6 const page = await context.newPage();

Full Screen

Using AI Code Generation

copy

Full Screen

1const qawolf = require("qawolf");2const selectors = require("./selectors/test.json");3describe("test", () => {4 let browser;5 let page;6 beforeAll(async () => {7 browser = await qawolf.launch();8 });9 afterAll(async () => {10 await qawolf.stopVideos();11 await browser.close();12 });13 it("test", async () => {

Full Screen

Using AI Code Generation

copy

Full Screen

1const { launch, press, toMatchImageSnapshot } = require("qawolf");2const path = require("path");3expect.extend({ toMatchImageSnapshot });4describe("test", () => {5 let browser;6 let page;7 beforeAll(async () => {8 page = await browser.page();9 });10 afterAll(async () => {11 await browser.close();12 });13 it("test", async () => {14 await page.press("input", "Enter");15 const image = await page.screenshot();16 expect(image).toMatchImageSnapshot();17 });18});19const { launch, press, toMatchImageSnapshot } = require("qawolf");20const path = require("path");21expect.extend({ toMatchImageSnapshot });22describe("test", () => {23 let browser;24 let page;25 beforeAll(async () => {26 page = await browser.page();27 });28 afterAll(async () => {29 await browser.close();30 });31 it("test", async () => {32 await page.press("input", "Enter");33 const image = await page.screenshot();34 expect(image).toMatchImageSnapshot();35 });36});

Full Screen

Using AI Code Generation

copy

Full Screen

1const qawolf = require("qawolf");2const { chromium } = require("playwright");3const { test, expect } = require("@playwright/test");4test("test", async () => {5 const browser = await chromium.launch();6 const context = await browser.newContext();7 const page = await context.newPage();

Full Screen

Using AI Code Generation

copy

Full Screen

1const qawolf = require('qawolf');2const selectors = require('./selectors/test.json');3let browser;4let page;5beforeAll(async () => {6 browser = await qawolf.launch();7 page = await qawolf.createPage(browser);8});9afterAll(async () => {10 await qawolf.stopVideos();11 await browser.close();12});13test('test', async () => {

Full Screen

Using AI Code Generation

copy

Full Screen

1const qawolf = require("qawolf");2describe("test", () => {3 let browser;4 beforeAll(async () => {5 browser = await qawolf.launch();6 });7 afterAll(async () => {8 await qawolf.stopVideos();9 await browser.close();10 });11 it("test", async () => {12 const context = await browser.newContext();13 const page = await context.newPage();14 await page.press("text=Hello", "Enter");15 });16});17{18 "scripts": {19 },20 "dependencies": {21 }22}

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 qawolf 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