@Override public void verifyAllFieldsAtProductInventoryPage( Product serialProduct, Product nonSerialProduct, String[] esnNumbers, Map<String[], String[]> productQuantityCountAndStatuses) { search.searchForProduct( ProductSearch.builder() .productName(serialProduct.getName().get()) .active(true) .inActive(true) .create()); session.click(FIRST_EDIT_PRODUCT_BTN); waits.waitUntilVisible(ProductLocators.TITLE_EDITING_PRODUCT_TYPE); verifyCommonFieldsAtProductInventory(); waits.waitUntilVisible(productAtAllStores(serialProduct)); Map<String[], String[]> productStatuses = productQuantityCountAndStatuses; for (Map.Entry<String[], String[]> entrySet : productStatuses.entrySet()) { String[] status = entrySet.getKey(); String[] quantityCounts = entrySet.getValue(); for (int i = 0; i < status.length; i++) { if (i == 0) { int j = Integer.parseInt(quantityCounts[i]) + 1; waits.waitUntilVisible(verifyQuantity(status[i], String.valueOf(j))); } else { waits.waitUntilVisible(verifyQuantity(status[i], quantityCounts[i])); } } } waits.waitUntilVisible( verifyQuantity(ProductStaticData.QUANTITY, String.valueOf(esnNumbers.length))); String newEsnLength = String.valueOf(esnNumbers.length - 1); waits.waitUntilVisible(verifyQuantity(ProductStaticData.AVAILABLE, newEsnLength)); waits.waitUntilVisible(verifyQuantity(ProductStaticData.TRANSFER, "1")); // Verify for the non Serialized product. search.searchForProduct( ProductSearch.builder() .productName(nonSerialProduct.getName().get()) .active(true) .inActive(true) .create()); session.click(FIRST_EDIT_PRODUCT_BTN); waits.waitUntilVisible(ProductLocators.TITLE_EDITING_PRODUCT_TYPE); verifyCommonFieldsAtProductInventory(); waits.waitUntilVisible(productAtAllStores(nonSerialProduct)); Map<String[], String[]> productCountAndStatuses = productQuantityCountAndStatuses; for (Map.Entry<String[], String[]> entry : productCountAndStatuses.entrySet()) { String[] statuses = entry.getKey(); String[] quantityCount = entry.getValue(); for (int i = 0; i < statuses.length; i++) { waits.waitUntilVisible(verifyQuantity(statuses[i], quantityCount[i])); } } }
@Override public void createPurchaseOrderForSerializedProductFromProductInventory( String serializedProduct, String poNumber, int quantity) { search.searchForProduct( ProductSearch.builder() .productName(serializedProduct) .inActive(true) .active(true) .create()); session.click(FIRST_EDIT_PRODUCT_BTN); waits.waitUntilVisible(ProductLocators.TITLE_EDITING_PRODUCT_TYPE); session.click(PRODUCT_INVENTORY_TAB); waits.waitUntilVisible(TITLE_PRODUCT_INVENTORY); session.selectDropDownText( SELECT_VENDOR_TO_CREATE_PO_AT_PRODUCT_INVENTORY_LST, VendorData.EXISTING_VENDOR_NAME.value()); session.click(CREATE_PO_BTN); waits.waitForPageLoad(); waits.waitUntilVisible(TITLE_CREATING_NEW_PO_LABEL); session.setText(PURCHASE_ORDER_NUMBER, poNumber); session.clear(QTY_FLD); session.setText(QTY_FLD, String.valueOf(quantity)); session.click(SAVE_BTN); waits.waitUntilVisible(TITLE_PURCHASE_ORDERS_LABEL); }
void verifyNoReceiveShipmentAndCreatePOButtons(String productName) { search.searchForProduct(ProductSearch.builder().productName(productName).create()); session.click(FIRST_EDIT_PRODUCT_BTN); waits.waitUntilVisible(ProductLocators.TITLE_EDITING_PRODUCT_TYPE); session.click(PRODUCT_INVENTORY_TAB); waits.waitUntilNotVisible(RECEIVE_SHIPMENT_BTN); waits.waitUntilNotVisible(CREATE_PO_BTN); }
@Override public void verifyDefectiveCountIsDisplayedZeroForNonSerializedProduct(String productName) { search.searchForProduct(ProductSearch.builder().productName(productName).create()); session.click(FIRST_EDIT_PRODUCT_BTN); waits.waitUntilVisible(ProductLocators.TITLE_EDITING_PRODUCT_TYPE); session.click(PRODUCT_INVENTORY_TAB); waits.waitUntilVisible(DEFECTIVE_NONSERIALIZED_ZERO); }
@Override public void verifyOnlyEnabledVendorsInSelectedVendorDropdown( String productName, String disabledVendor, String enabledVendor) { search.searchForProduct( ProductSearch.builder().productName(productName).active(true).inActive(true).create()); session.click(FIRST_EDIT_PRODUCT_BTN); waits.waitUntilVisible(ProductLocators.TITLE_EDITING_PRODUCT_TYPE); session.click(PRODUCT_INVENTORY_TAB); waits.waitUntilVisible(TITLE_PRODUCT_INVENTORY); waits.waitUntilVisible(verifyEnabledVendorPresent(enabledVendor)); waits.waitUntilNotVisible(verifyDisabledVendorNotPresent(disabledVendor)); }
@Override public void viewEsnOfInactiveSerialProduct(Product serialProduct, String esnNumber) { search.searchForProduct( ProductSearch.builder() .productName(serialProduct.getName().get()) .active(true) .inActive(true) .create()); session.click(FIRST_EDIT_PRODUCT_BTN); waits.waitUntilVisible(ProductLocators.TITLE_EDITING_PRODUCT_TYPE); session.click(PRODUCT_INVENTORY_TAB); waits.waitUntilVisible(getEditButton(esnNumber)); session.click(getEditButton(esnNumber)); waits.waitUntilVisible(verifyEsnAtLocateProduct(esnNumber)); }
@Override public void verifyWarningMessageIsDisplayedWithUnprivilegedOfLocateProduct( Product product, String[] esnNumbers) { search.searchForProduct( ProductSearch.builder() .productName(product.getName().get()) .active(true) .inActive(true) .create()); session.click(FIRST_EDIT_PRODUCT_BTN); waits.waitUntilVisible(ProductLocators.TITLE_EDITING_PRODUCT_TYPE); session.click(PRODUCT_INVENTORY_TAB); waits.waitUntilVisible(TITLE_PRODUCT_INVENTORY); waits.waitUntilNotVisible(getEditButton(esnNumbers[0])); }
@Override public void verifyPurchaseOrderFromProductInventoryWithoutSelectingVendor( String nonSerializedProduct) { search.searchForProduct( ProductSearch.builder() .productName(nonSerializedProduct) .inActive(true) .active(true) .create()); session.click(FIRST_EDIT_PRODUCT_BTN); waits.waitUntilVisible(ProductLocators.TITLE_EDITING_PRODUCT_TYPE); session.click(PRODUCT_INVENTORY_TAB); waits.waitUntilVisible(TITLE_PRODUCT_INVENTORY); session.click(CREATE_PO_BTN); waits.waitUntilVisible(VENDOR_REQUIRED); }
@Override public void verifyPageNavigateToLocateProduct(Product product, String esnNumbers[]) { search.searchForProduct( ProductSearch.builder() .productName(product.getName().get()) .active(true) .inActive(true) .create()); session.click(FIRST_EDIT_PRODUCT_BTN); waits.waitUntilVisible(ProductLocators.TITLE_EDITING_PRODUCT_TYPE); session.click(PRODUCT_INVENTORY_TAB); waits.waitUntilVisible(TITLE_PRODUCT_INVENTORY); session.click(getEditButton(esnNumbers[0])); waits.waitUntilVisible(verifyEsnAtLocateProduct(esnNumbers[0])); if (session.existsNow(getDefaultPrice(product.getDefaultPrice().get()))) { waits.waitUntilVisible(getDefaultPrice(product.getDefaultPrice().get())); } waits.waitUntilVisible(verifyCategory(product.getCategoryText().get())); waits.waitUntilVisible(verifyShortDescription(product.getShortDescription().get())); waits.waitUntilVisible(verifyStoreName(LoginData.STORE.value())); }