public String getTestId(String baseId) { String id = normalize(baseId); Integer number = ids.get(id); if (number == null) { number = 0; } else { number++; } ids.put(id, number); // prevent conflicts while (ids.containsKey(id + number)) { number++; } if (number > 0) { id = id + number; } return goodFastHash(128).hashString(id, StandardCharsets.UTF_8).toString(); }
public void beforeTopLevelWindowInit() { updateUiTheme(); // todo move to login handling updateClientSystemMessages(app.getLocale()); // todo move test id manager into RootWindow ? getTestIdManager().reset(); }
@Override public void setFrame(Frame frame) { super.setFrame(frame); AppUI ui = AppUI.getCurrent(); if (ui != null) { if (ui.isTestMode()) { searchField.setCubaId("ftsField"); searchBtn.setCubaId("ftsSearchBtn"); } if (ui.isPerformanceTestMode()) { searchField.setId(ui.getTestIdManager().reserveId("ftsField")); } } }
@Override public void setDebugId(String id) { super.setDebugId(id); AppUI ui = AppUI.getCurrent(); if (id != null && ui != null && ui.isPerformanceTestMode()) { TestIdManager testIdManager = ui.getTestIdManager(); for (Map.Entry<Action, Button> entry : actionButtons.entrySet()) { Button button = entry.getValue(); Action action = entry.getKey(); button.setId(testIdManager.getTestId(id + "_" + action.getId())); } } }
@Override public void setId(String id) { this.id = id; AppUI ui = AppUI.getCurrent(); if (ui != null && ui.isPerformanceTestMode() && StringUtils.isEmpty(debugId)) { getComponent().setId(ui.getTestIdManager().getTestId("window_" + id)); } }
@Override public void setDebugId(String id) { super.setDebugId(id); String debugId = getDebugId(); AppUI ui = AppUI.getCurrent(); if (debugId != null && ui != null) { TestIdManager testIdManager = ui.getTestIdManager(); for (Map.Entry<com.vaadin.ui.Component, ComponentDescriptor> tabEntry : tabMapping.entrySet()) { com.vaadin.ui.Component tabComponent = tabEntry.getKey(); com.vaadin.ui.Accordion.Tab tab = component.getTab(tabComponent); ComponentDescriptor componentDescriptor = tabEntry.getValue(); String name = componentDescriptor.name; component.setTestId(tab, testIdManager.getTestId(debugId + "." + name)); } } }
@Override public void setDebugId(String id) { super.setDebugId(id); String debugId = getDebugId(); if (debugId != null) { TestIdManager testIdManager = AppUI.getCurrent().getTestIdManager(); for (Map.Entry<com.vaadin.ui.Component, ComponentDescriptor> tabEntry : tabMapping.entrySet()) { com.vaadin.ui.Component tabComponent = tabEntry.getKey(); com.vaadin.ui.TabSheet.Tab tab = component.getTab(tabComponent); ComponentDescriptor componentDescriptor = tabEntry.getValue(); String name = componentDescriptor.name; component.setTestId(tab, testIdManager.getTestId(debugId + "." + name)); } } }
@Override public void setDebugId(String id) { super.setDebugId(id); AppUI ui = AppUI.getCurrent(); if (id != null && ui != null) { componentComposition.setId(ui.getTestIdManager().getTestId(id + "_composition")); } }
@Override public void setDebugId(String id) { super.setDebugId(id); AppUI ui = AppUI.getCurrent(); if (id != null && ui != null) { componentComposition.setId(ui.getTestIdManager().getTestId(id + "_composition")); } }
@Override public void setDebugId(String id) { super.setDebugId(id); if (id != null) { String debugId = getDebugId(); TestIdManager testIdManager = AppUI.getCurrent().getTestIdManager(); for (Action action : actions) { CubaButton button = actionButtons.get(action); if (button != null && Strings.isNullOrEmpty(button.getId())) { button.setId(testIdManager.getTestId(debugId + "_" + action.getId())); } } } }
protected void componentAttachedToUI() { adjustParentStyles(); if (ui.isTestMode()) { linksLayout.setCubaId("breadCrumbs"); if (closeBtn != null) { closeBtn.setCubaId("closeBtn"); } } if (ui.isPerformanceTestMode()) { TestIdManager testIdManager = ui.getTestIdManager(); linksLayout.setId(testIdManager.getTestId("breadCrumbs")); if (closeBtn != null) { closeBtn.setId(testIdManager.getTestId("closeBtn")); } } }
@Override public void setDebugId(String id) { super.setDebugId(id); AppUI ui = AppUI.getCurrent(); if (ui != null && id != null) { for (final FieldConfig fc : fields.values()) { com.vaadin.ui.Component composition = WebComponentsHelper.getComposition(fc.getComponentNN()); if (composition != null) { composition.setId(ui.getTestIdManager().getTestId(id + "_" + fc.getId())); } } } }
protected void assignDebugId(com.vaadin.ui.Component composition, String id) { AppUI ui = AppUI.getCurrent(); if (ui == null) { return; } String debugId = getDebugId(); if (ui.isPerformanceTestMode()) { if (composition != null && debugId != null) { TestIdManager testIdManager = ui.getTestIdManager(); composition.setId(testIdManager.getTestId(debugId + "_" + id)); } } }
@Override public void setDebugId(String id) { super.setDebugId(id); AppUI ui = AppUI.getCurrent(); if (ui != null && id != null) { for (final Component component : getOwnComponents()) { com.vaadin.ui.Component composition = WebComponentsHelper.getComposition(component); if (composition != null) { composition.setId(ui.getTestIdManager().getTestId(id + "_" + component.getId())); } } } }
@Override public void addAction(Action action, int index) { checkNotNullArgument(action, "action must be non null"); int oldIndex = findActionById(actions, action.getId()); if (oldIndex >= 0) { removeAction(actions.get(oldIndex)); if (index > oldIndex) { index--; } } actions.add(index, action); actionHandler.addAction(action, index); CubaButton vButton = new CubaButton(); setPickerButtonAction(vButton, action); component.addButton(vButton, index); actionButtons.put(action, vButton); if (StringUtils.isNotEmpty(getDebugId())) { TestIdManager testIdManager = AppUI.getCurrent().getTestIdManager(); // Set debug id vButton.setId(testIdManager.getTestId(getDebugId() + "_" + action.getId())); } if (action instanceof PickerFieldAction) { PickerFieldAction pickerFieldAction = (PickerFieldAction) action; pickerFieldAction.setPickerField(this); if (!isEditable()) { pickerFieldAction.editableChanged(this, isEditable()); } } actionsPermissions.apply(action); }
protected void assignDebugId(FieldConfig fc, com.vaadin.ui.Component composition) { AppUI ui = AppUI.getCurrent(); if (ui == null) { return; } String debugId = getDebugId(); if (ui.isTestMode()) { if (composition != null) { composition.setCubaId(fc.getId()); } } if (ui.isPerformanceTestMode()) { if (composition != null && debugId != null) { TestIdManager testIdManager = ui.getTestIdManager(); composition.setId(testIdManager.getTestId(debugId + "_" + fc.getId())); } } }
AppUI.getCurrent().getTestIdManager().getTestId(getDebugId() + "." + name));
@Override public Accordion.Tab addTab(String name, Component childComponent) { if (childComponent.getParent() != null && childComponent.getParent() != this) { throw new IllegalStateException("Component already has parent"); } Tab tab = new Tab(name, childComponent); this.tabs.put(name, tab); com.vaadin.ui.Component tabComponent = childComponent.unwrapComposition(com.vaadin.ui.Component.class); tabComponent.setSizeFull(); tabMapping.put(tabComponent, new ComponentDescriptor(name, childComponent)); com.vaadin.ui.Accordion.Tab tabControl = this.component.addTab(tabComponent); if (getDebugId() != null) { this.component.setTestId(tabControl, AppUI.getCurrent().getTestIdManager().getTestId(getDebugId() + "." + name)); } if (AppUI.getCurrent().isTestMode()) { this.component.setCubaId(tabControl, name); } if (frame != null) { if (childComponent instanceof BelongToFrame && ((BelongToFrame) childComponent).getFrame() == null) { ((BelongToFrame) childComponent).setFrame(frame); } else { ((FrameImplementation) frame).registerComponent(childComponent); } } childComponent.setParent(this); return tab; }
button.setId(ui.getTestIdManager().getTestId("breadCrubms_Button_" + window.getId()));