Merge remote-tracking branch 'origin/dev-1.2-gui-testing' into

development

Conflicts:
	src/main/java/ch/ethz/seb/sebserver/gui/table/TableFilter.java
	src/main/java/ch/ethz/seb/sebserver/gui/widget/WidgetFactory.java
This commit is contained in:
anhefti 2022-01-26 09:32:11 +01:00
commit 3afed86efa
18 changed files with 157 additions and 109 deletions

View file

@ -48,6 +48,9 @@ public class ProctorRoomConnectionsPopup {
private static final LocTextKey TITLE_TEXT_KEY = private static final LocTextKey TITLE_TEXT_KEY =
new LocTextKey("sebserver.monitoring.exam.proctoring.room.connections.title"); new LocTextKey("sebserver.monitoring.exam.proctoring.room.connections.title");
private static final LocTextKey JOIN_TEXT_KEY =
new LocTextKey("sebserver.monitoring.exam.proctoring.room.connections.joinurl");
private static final LocTextKey EMPTY_LIST_TEXT_KEY = private static final LocTextKey EMPTY_LIST_TEXT_KEY =
new LocTextKey("sebserver.monitoring.search.list.empty"); new LocTextKey("sebserver.monitoring.search.list.empty");
private static final LocTextKey TABLE_COLUMN_NAME = private static final LocTextKey TABLE_COLUMN_NAME =
@ -81,16 +84,19 @@ public class ProctorRoomConnectionsPopup {
if (StringUtils.isNotBlank(joinLink)) { if (StringUtils.isNotBlank(joinLink)) {
final WidgetFactory widgetFactory = this.pageService.getWidgetFactory(); final WidgetFactory widgetFactory = this.pageService.getWidgetFactory();
final String ariaLabel = widgetFactory.getI18nSupport().getText(JOIN_TEXT_KEY) + joinLink;
final String testKey = JOIN_TEXT_KEY.name;
final Composite titleComp = widgetFactory.voidComposite(pageContext.getParent()); final Composite titleComp = widgetFactory.voidComposite(pageContext.getParent());
final GridLayout layout = (GridLayout) titleComp.getLayout(); final GridLayout layout = (GridLayout) titleComp.getLayout();
layout.numColumns = 2; layout.numColumns = 2;
layout.makeColumnsEqualWidth = false; layout.makeColumnsEqualWidth = false;
final Label label = widgetFactory.label(titleComp, "Join URL: "); final Label label = widgetFactory.labelLocalized(titleComp, JOIN_TEXT_KEY);
label.setLayoutData(new GridData()); label.setLayoutData(new GridData());
label.setData(RWT.CUSTOM_VARIANT, CustomVariant.TITLE_LABEL.key); label.setData(RWT.CUSTOM_VARIANT, CustomVariant.TITLE_LABEL.key);
final Text textInput = widgetFactory.textInput(titleComp, joinLink); final Text textInput = widgetFactory.textInput(titleComp, testKey, ariaLabel);
final GridData gridData = new GridData(SWT.LEFT, SWT.TOP, false, false); final GridData gridData = new GridData(SWT.LEFT, SWT.TOP, false, false);
textInput.setLayoutData(gridData); textInput.setLayoutData(gridData);
textInput.setText(joinLink); textInput.setText(joinLink);

View file

@ -76,7 +76,7 @@ public final class SelectionFieldBuilder extends FieldBuilder<String> {
(builder.pageService.getFormTooltipMode() == PageService.FormTooltipMode.INPUT) ? this.tooltip : null, (builder.pageService.getFormTooltipMode() == PageService.FormTooltipMode.INPUT) ? this.tooltip : null,
null, null,
actionKey, actionKey,
getARIALabel(builder)); builder.i18nSupport.getText(getARIALabel(builder)));
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false); final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
((Control) selection).setLayoutData(gridData); ((Control) selection).setLayoutData(gridData);

View file

@ -75,6 +75,7 @@ public class CheckBoxBuilder implements InputFieldBuilder {
? ExamConfigurationService.attributeNameLocKey(attribute) ? ExamConfigurationService.attributeNameLocKey(attribute)
: null, : null,
ExamConfigurationService.getToolTipKey(attribute, i18nSupport), ExamConfigurationService.getToolTipKey(attribute, i18nSupport),
ExamConfigurationService.attributeNameLocKey(attribute).name,
ExamConfigurationService.attributeNameLocKey(attribute)); ExamConfigurationService.attributeNameLocKey(attribute));
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false); final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);

View file

@ -21,6 +21,7 @@ import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
import ch.ethz.seb.sebserver.gui.service.examconfig.ExamConfigurationService; import ch.ethz.seb.sebserver.gui.service.examconfig.ExamConfigurationService;
import ch.ethz.seb.sebserver.gui.service.examconfig.InputField; import ch.ethz.seb.sebserver.gui.service.examconfig.InputField;
import ch.ethz.seb.sebserver.gui.service.examconfig.InputFieldBuilder; import ch.ethz.seb.sebserver.gui.service.examconfig.InputFieldBuilder;
import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport;
import ch.ethz.seb.sebserver.gui.widget.MultiSelectionCheckbox; import ch.ethz.seb.sebserver.gui.widget.MultiSelectionCheckbox;
import ch.ethz.seb.sebserver.gui.widget.Selection; import ch.ethz.seb.sebserver.gui.widget.Selection;
import ch.ethz.seb.sebserver.gui.widget.WidgetFactory; import ch.ethz.seb.sebserver.gui.widget.WidgetFactory;
@ -50,18 +51,21 @@ public class MultiCheckboxSelection extends SelectionFieldBuilder implements Inp
final ConfigurationAttribute attribute, final ConfigurationAttribute attribute,
final ViewContext viewContext) { final ViewContext viewContext) {
final I18nSupport i18nSupport = this.widgetFactory.getI18nSupport();
final Orientation orientation = viewContext final Orientation orientation = viewContext
.getOrientation(attribute.id); .getOrientation(attribute.id);
final Composite innerGrid = InputFieldBuilder final Composite innerGrid = InputFieldBuilder
.createInnerGrid(parent, attribute, orientation); .createInnerGrid(parent, attribute, orientation);
final String attributeNameKey = ExamConfigurationService.attributeNameKey(attribute);
final MultiSelectionCheckbox selection = this.widgetFactory.selectionLocalized( final MultiSelectionCheckbox selection = this.widgetFactory.selectionLocalized(
Selection.Type.MULTI_CHECKBOX, Selection.Type.MULTI_CHECKBOX,
innerGrid, innerGrid,
() -> this.getLocalizedResources(attribute, viewContext), () -> this.getLocalizedResources(attribute, viewContext),
null, null,
() -> this.getLocalizedResourcesAsToolTip(attribute, viewContext), () -> this.getLocalizedResourcesAsToolTip(attribute, viewContext),
ExamConfigurationService.ATTRIBUTE_LABEL_LOC_TEXT_PREFIX + attribute.name) attributeNameKey,
i18nSupport.getText(attributeNameKey))
.getTypeInstance(); .getTypeInstance();
selection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); selection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

View file

@ -37,6 +37,8 @@ import ch.ethz.seb.sebserver.gui.widget.WidgetFactory.CustomVariant;
@GuiProfile @GuiProfile
public class PasswordFieldBuilder implements InputFieldBuilder { public class PasswordFieldBuilder implements InputFieldBuilder {
private static final String SEBSERVER_FORM_CONFIRM_LABEL = "sebserver.form.confirm.label";
private static final LocTextKey VAL_CONFIRM_PWD_TEXT_KEY = private static final LocTextKey VAL_CONFIRM_PWD_TEXT_KEY =
new LocTextKey("sebserver.examconfig.props.validation.password.confirm"); new LocTextKey("sebserver.examconfig.props.validation.password.confirm");
@ -84,7 +86,7 @@ public class PasswordFieldBuilder implements InputFieldBuilder {
final LocTextKey confirmNameLocKey = final LocTextKey confirmNameLocKey =
new LocTextKey( new LocTextKey(
"sebserver.form.confirm.label", SEBSERVER_FORM_CONFIRM_LABEL,
viewContext.i18nSupport.getText(attributeNameLocKey)); viewContext.i18nSupport.getText(attributeNameLocKey));
final PasswordInput confirmInput = new PasswordInput( final PasswordInput confirmInput = new PasswordInput(
innerGrid, innerGrid,

View file

@ -22,6 +22,7 @@ import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
import ch.ethz.seb.sebserver.gui.service.examconfig.ExamConfigurationService; import ch.ethz.seb.sebserver.gui.service.examconfig.ExamConfigurationService;
import ch.ethz.seb.sebserver.gui.service.examconfig.InputField; import ch.ethz.seb.sebserver.gui.service.examconfig.InputField;
import ch.ethz.seb.sebserver.gui.service.examconfig.InputFieldBuilder; import ch.ethz.seb.sebserver.gui.service.examconfig.InputFieldBuilder;
import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport;
import ch.ethz.seb.sebserver.gui.widget.RadioSelection; import ch.ethz.seb.sebserver.gui.widget.RadioSelection;
import ch.ethz.seb.sebserver.gui.widget.Selection; import ch.ethz.seb.sebserver.gui.widget.Selection;
import ch.ethz.seb.sebserver.gui.widget.WidgetFactory; import ch.ethz.seb.sebserver.gui.widget.WidgetFactory;
@ -52,18 +53,21 @@ public class RadioSelectionFieldBuilder extends SelectionFieldBuilder implements
final ConfigurationAttribute attribute, final ConfigurationAttribute attribute,
final ViewContext viewContext) { final ViewContext viewContext) {
final I18nSupport i18nSupport = this.widgetFactory.getI18nSupport();
final Orientation orientation = viewContext final Orientation orientation = viewContext
.getOrientation(attribute.id); .getOrientation(attribute.id);
final Composite innerGrid = InputFieldBuilder final Composite innerGrid = InputFieldBuilder
.createInnerGrid(parent, attribute, orientation); .createInnerGrid(parent, attribute, orientation);
final String attributeNameKey = ExamConfigurationService.attributeNameKey(attribute);
final RadioSelection selection = this.widgetFactory.selectionLocalized( final RadioSelection selection = this.widgetFactory.selectionLocalized(
Selection.Type.RADIO, Selection.Type.RADIO,
innerGrid, innerGrid,
() -> this.getLocalizedResources(attribute, viewContext), () -> this.getLocalizedResources(attribute, viewContext),
null, null,
() -> this.getLocalizedResourcesAsToolTip(attribute, viewContext), () -> this.getLocalizedResourcesAsToolTip(attribute, viewContext),
ExamConfigurationService.ATTRIBUTE_LABEL_LOC_TEXT_PREFIX + attribute.name) attributeNameKey,
i18nSupport.getText(attributeNameKey))
.getTypeInstance(); .getTypeInstance();
selection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); selection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

View file

@ -24,6 +24,7 @@ import ch.ethz.seb.sebserver.gui.service.examconfig.ExamConfigurationService;
import ch.ethz.seb.sebserver.gui.service.examconfig.InputField; import ch.ethz.seb.sebserver.gui.service.examconfig.InputField;
import ch.ethz.seb.sebserver.gui.service.examconfig.InputFieldBuilder; import ch.ethz.seb.sebserver.gui.service.examconfig.InputFieldBuilder;
import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport; import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport;
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
import ch.ethz.seb.sebserver.gui.widget.Selection; import ch.ethz.seb.sebserver.gui.widget.Selection;
import ch.ethz.seb.sebserver.gui.widget.SingleSelection; import ch.ethz.seb.sebserver.gui.widget.SingleSelection;
import ch.ethz.seb.sebserver.gui.widget.WidgetFactory; import ch.ethz.seb.sebserver.gui.widget.WidgetFactory;
@ -60,13 +61,18 @@ public class SingleSelectionFieldBuilder extends SelectionFieldBuilder implement
final Composite innerGrid = InputFieldBuilder final Composite innerGrid = InputFieldBuilder
.createInnerGrid(parent, attribute, orientation); .createInnerGrid(parent, attribute, orientation);
final LocTextKey toolTipKey = ExamConfigurationService.getToolTipKey(attribute, i18nSupport);
final String attributeNameKey = ExamConfigurationService.attributeNameKey(attribute);
final SingleSelection selection = this.widgetFactory.selectionLocalized( final SingleSelection selection = this.widgetFactory.selectionLocalized(
(attribute.type == AttributeType.COMBO_SELECTION) (attribute.type == AttributeType.COMBO_SELECTION)
? Selection.Type.SINGLE_COMBO ? Selection.Type.SINGLE_COMBO
: Selection.Type.SINGLE, : Selection.Type.SINGLE,
innerGrid, innerGrid,
() -> this.getLocalizedResources(attribute, viewContext), () -> this.getLocalizedResources(attribute, viewContext),
ExamConfigurationService.getToolTipKey(attribute, i18nSupport)) toolTipKey,
null,
attributeNameKey,
i18nSupport.getText(attributeNameKey))
.getTypeInstance(); .getTypeInstance();
selection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); selection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

View file

@ -87,6 +87,9 @@ public class TextFieldBuilder implements InputFieldBuilder {
} }
} }
text.setLayoutData(gridData); text.setLayoutData(gridData);
final String attributeNameKey = ExamConfigurationService.attributeNameKey(attribute);
WidgetFactory.setTestId(text, attributeNameKey);
WidgetFactory.setARIALabel(text, i18nSupport.getText(attributeNameKey));
final LocTextKey toolTipKey = ExamConfigurationService.getToolTipKey( final LocTextKey toolTipKey = ExamConfigurationService.getToolTipKey(
attribute, attribute,

View file

@ -328,6 +328,7 @@ public class TableFilter<ROW> {
this.textInput = TableFilter.this.entityTable.widgetFactory.textInput( this.textInput = TableFilter.this.entityTable.widgetFactory.textInput(
innerComposite, innerComposite,
TableFilter.this.entityTable.getName() + "_" + this.attribute.columnName,
getAriaLabel()); getAriaLabel());
this.textInput.setLayoutData(gridData); this.textInput.setLayoutData(gridData);
@ -354,7 +355,6 @@ public class TableFilter<ROW> {
this.textInput.setText(value); this.textInput.setText(value);
} }
} }
} }
private class SelectionFilter extends FilterComponent { private class SelectionFilter extends FilterComponent {
@ -387,7 +387,9 @@ public class TableFilter<ROW> {
ch.ethz.seb.sebserver.gui.widget.Selection.Type.SINGLE, ch.ethz.seb.sebserver.gui.widget.Selection.Type.SINGLE,
innerComposite, innerComposite,
resourceSupplier, resourceSupplier,
getAriaLabel()); null, null,
TableFilter.this.entityTable.getName() + "_" + this.attribute.columnName,
TableFilter.this.entityTable.widgetFactory.getI18nSupport().getText(getAriaLabel()));
this.selector this.selector
.adaptToControl() .adaptToControl()
@ -446,7 +448,8 @@ public class TableFilter<ROW> {
final Composite innerComposite = createInnerComposite(parent); final Composite innerComposite = createInnerComposite(parent);
this.selector = TableFilter.this.entityTable.widgetFactory.dateSelector( this.selector = TableFilter.this.entityTable.widgetFactory.dateSelector(
innerComposite, innerComposite,
getAriaLabel()); getAriaLabel(),
TableFilter.this.entityTable.getName() + "_" + this.attribute.columnName);
this.selector.addListener(SWT.Selection, event -> { this.selector.addListener(SWT.Selection, event -> {
TableFilter.this.entityTable.applyFilter(); TableFilter.this.entityTable.applyFilter();
}); });
@ -540,26 +543,27 @@ public class TableFilter<ROW> {
this.innerComposite.setLayout(gridLayout); this.innerComposite.setLayout(gridLayout);
this.innerComposite.setLayoutData(this.rowData); this.innerComposite.setLayoutData(this.rowData);
final String testKey = TableFilter.this.entityTable.getName() + "_" + this.attribute.columnName;
final WidgetFactory wf = TableFilter.this.entityTable.widgetFactory; final WidgetFactory wf = TableFilter.this.entityTable.widgetFactory;
wf.labelLocalized(this.innerComposite, DATE_FROM_TEXT); wf.labelLocalized(this.innerComposite, DATE_FROM_TEXT);
this.fromDateSelector = wf.dateSelector(this.innerComposite, getAriaLabel()); this.fromDateSelector = wf.dateSelector(this.innerComposite, getAriaLabel(), testKey);
this.fromDateSelector.addListener(SWT.Selection, event -> { this.fromDateSelector.addListener(SWT.Selection, event -> {
TableFilter.this.entityTable.applyFilter(); TableFilter.this.entityTable.applyFilter();
}); });
if (this.withTime) { if (this.withTime) {
this.fromTimeSelector = wf.timeSelector(this.innerComposite, getAriaLabel()); this.fromTimeSelector = wf.timeSelector(this.innerComposite, getAriaLabel(), testKey);
this.fromTimeSelector.addListener(SWT.Selection, event -> { this.fromTimeSelector.addListener(SWT.Selection, event -> {
TableFilter.this.entityTable.applyFilter(); TableFilter.this.entityTable.applyFilter();
}); });
} }
wf.labelLocalized(this.innerComposite, DATE_TO_TEXT); wf.labelLocalized(this.innerComposite, DATE_TO_TEXT);
this.toDateSelector = wf.dateSelector(this.innerComposite, getAriaLabel()); this.toDateSelector = wf.dateSelector(this.innerComposite, getAriaLabel(), testKey);
this.toDateSelector.addListener(SWT.Selection, event -> { this.toDateSelector.addListener(SWT.Selection, event -> {
TableFilter.this.entityTable.applyFilter(); TableFilter.this.entityTable.applyFilter();
}); });
if (this.withTime) { if (this.withTime) {
this.toTimeSelector = wf.timeSelector(this.innerComposite, getAriaLabel()); this.toTimeSelector = wf.timeSelector(this.innerComposite, getAriaLabel(), testKey);
this.toTimeSelector.addListener(SWT.Selection, event -> { this.toTimeSelector.addListener(SWT.Selection, event -> {
TableFilter.this.entityTable.applyFilter(); TableFilter.this.entityTable.applyFilter();
}); });

View file

@ -96,6 +96,10 @@ public final class ColorSelection extends Composite implements Selection {
actionCell.widthHint = ACTION_COLUMN_WIDTH; actionCell.widthHint = ACTION_COLUMN_WIDTH;
imageButton.setLayoutData(actionCell); imageButton.setLayoutData(actionCell);
if (tooltipKeyPrefix != null) {
WidgetFactory.setTestId(this, tooltipKeyPrefix);
}
this.addListener(SWT.Resize, this::adaptColumnWidth); this.addListener(SWT.Resize, this::adaptColumnWidth);
} }

View file

@ -33,10 +33,11 @@ public final class MultiSelection extends Composite implements Selection {
private final List<Label> labels = new ArrayList<>(); private final List<Label> labels = new ArrayList<>();
private final List<Label> selected = new ArrayList<>(); private final List<Label> selected = new ArrayList<>();
private final String testKey;
private Listener listener = null; private Listener listener = null;
MultiSelection(final Composite parent) { MultiSelection(final Composite parent, final String testKey) {
super(parent, SWT.NONE); super(parent, SWT.NONE);
final GridLayout gridLayout = new GridLayout(1, true); final GridLayout gridLayout = new GridLayout(1, true);
gridLayout.verticalSpacing = 1; gridLayout.verticalSpacing = 1;
@ -44,6 +45,10 @@ public final class MultiSelection extends Composite implements Selection {
gridLayout.marginHeight = 0; gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0; gridLayout.marginWidth = 0;
setLayout(gridLayout); setLayout(gridLayout);
this.testKey = testKey;
if (testKey != null) {
WidgetFactory.setTestId(this, testKey);
}
} }
@Override @Override
@ -88,6 +93,8 @@ public final class MultiSelection extends Composite implements Selection {
this.listener.handleEvent(event); this.listener.handleEvent(event);
} }
}); });
WidgetFactory.setARIALabel(label, tuple._2);
WidgetFactory.setTestId(label, (this.testKey != null) ? this.testKey + tuple._1 : tuple._1);
this.labels.add(label); this.labels.add(label);
} }
if (StringUtils.isNotBlank(selectionValue)) { if (StringUtils.isNotBlank(selectionValue)) {

View file

@ -34,7 +34,7 @@ public final class MultiSelectionCheckbox extends Composite implements Selection
private Listener listener = null; private Listener listener = null;
private final Map<String, Button> checkboxes; private final Map<String, Button> checkboxes;
MultiSelectionCheckbox(final Composite parent) { MultiSelectionCheckbox(final Composite parent, final String testKey) {
super(parent, SWT.NONE); super(parent, SWT.NONE);
final GridLayout gridLayout = new GridLayout(1, true); final GridLayout gridLayout = new GridLayout(1, true);
gridLayout.verticalSpacing = 1; gridLayout.verticalSpacing = 1;
@ -42,6 +42,9 @@ public final class MultiSelectionCheckbox extends Composite implements Selection
gridLayout.marginHeight = 0; gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0; gridLayout.marginWidth = 0;
setLayout(gridLayout); setLayout(gridLayout);
if (testKey != null) {
WidgetFactory.setTestId(this, testKey);
}
this.checkboxes = new LinkedHashMap<>(); this.checkboxes = new LinkedHashMap<>();
} }
@ -65,6 +68,8 @@ public final class MultiSelectionCheckbox extends Composite implements Selection
for (final Tuple<String> tuple : mapping) { for (final Tuple<String> tuple : mapping) {
final Button button = new Button(this, SWT.CHECK); final Button button = new Button(this, SWT.CHECK);
button.setText(tuple._2); button.setText(tuple._2);
WidgetFactory.setARIALabel(button, tuple._2);
WidgetFactory.setTestId(button, tuple._1);
final GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, true); final GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
button.setLayoutData(gridData); button.setLayoutData(gridData);
button.setData(OPTION_VALUE, tuple._1); button.setData(OPTION_VALUE, tuple._1);
@ -73,6 +78,8 @@ public final class MultiSelectionCheckbox extends Composite implements Selection
this.listener.handleEvent(event); this.listener.handleEvent(event);
} }
}); });
WidgetFactory.setTestId(button, tuple._1);
WidgetFactory.setARIALabel(button, tuple._2);
this.checkboxes.put(tuple._1, button); this.checkboxes.put(tuple._1, button);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View file

@ -69,7 +69,7 @@ public final class MultiSelectionCombo extends Composite implements Selection {
setLayout(gridLayout); setLayout(gridLayout);
this.addListener(SWT.Resize, this::adaptColumnWidth); this.addListener(SWT.Resize, this::adaptColumnWidth);
this.textInput = widgetFactory.textInput(this, "selection"); this.textInput = widgetFactory.textInput(this, locTextPrefix, "selection");
this.textCell = new GridData(SWT.LEFT, SWT.CENTER, true, true); this.textCell = new GridData(SWT.LEFT, SWT.CENTER, true, true);
this.textInput.setLayoutData(this.textCell); this.textInput.setLayoutData(this.textCell);
this.dropDown = new DropDown(this.textInput, SWT.NONE); this.dropDown = new DropDown(this.textInput, SWT.NONE);

View file

@ -36,6 +36,7 @@ public class PasswordInput extends Composite {
private boolean isPlainText = true; private boolean isPlainText = true;
private boolean isEditable = true; private boolean isEditable = true;
private String label = null; private String label = null;
private String testKey = null;
public PasswordInput( public PasswordInput(
final Composite parent, final Composite parent,
@ -45,6 +46,7 @@ public class PasswordInput extends Composite {
super(parent, SWT.NONE); super(parent, SWT.NONE);
this.label = widgetFactory.getI18nSupport().getText(label); this.label = widgetFactory.getI18nSupport().getText(label);
this.testKey = (label != null) ? label.name : null;
GridLayout gridLayout = new GridLayout(2, false); GridLayout gridLayout = new GridLayout(2, false);
gridLayout.horizontalSpacing = 0; gridLayout.horizontalSpacing = 0;
gridLayout.verticalSpacing = 0; gridLayout.verticalSpacing = 0;
@ -115,6 +117,7 @@ public class PasswordInput extends Composite {
if (this.label != null) { if (this.label != null) {
WidgetFactory.setARIALabel(passwordInput, this.label); WidgetFactory.setARIALabel(passwordInput, this.label);
WidgetFactory.setTestId(passwordInput, this.testKey);
} }
this.passwordInputField = passwordInput; this.passwordInputField = passwordInput;

View file

@ -28,10 +28,11 @@ public final class RadioSelection extends Composite implements Selection {
private static final long serialVersionUID = 7937242481193100852L; private static final long serialVersionUID = 7937242481193100852L;
private final String testKey;
private Listener listener = null; private Listener listener = null;
private final Map<String, Button> radioButtons; private final Map<String, Button> radioButtons;
RadioSelection(final Composite parent) { RadioSelection(final Composite parent, final String testKey) {
super(parent, SWT.NONE); super(parent, SWT.NONE);
final GridLayout gridLayout = new GridLayout(1, true); final GridLayout gridLayout = new GridLayout(1, true);
gridLayout.verticalSpacing = 1; gridLayout.verticalSpacing = 1;
@ -39,6 +40,10 @@ public final class RadioSelection extends Composite implements Selection {
gridLayout.marginHeight = 0; gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0; gridLayout.marginWidth = 0;
setLayout(gridLayout); setLayout(gridLayout);
this.testKey = testKey;
if (testKey != null) {
WidgetFactory.setTestId(this, testKey);
}
this.radioButtons = new LinkedHashMap<>(); this.radioButtons = new LinkedHashMap<>();
} }
@ -70,6 +75,8 @@ public final class RadioSelection extends Composite implements Selection {
this.listener.handleEvent(event); this.listener.handleEvent(event);
} }
}); });
WidgetFactory.setTestId(button, (this.testKey != null) ? this.testKey + tuple._1 : tuple._1);
WidgetFactory.setARIALabel(button, tuple._2);
this.radioButtons.put(tuple._1, button); this.radioButtons.put(tuple._1, button);
} }

View file

@ -29,11 +29,14 @@ public final class SingleSelection extends Combo implements Selection {
final List<String> keyMapping; final List<String> keyMapping;
final boolean isEditable; final boolean isEditable;
SingleSelection(final Composite parent, final int type) { SingleSelection(final Composite parent, final int type, final String testKey) {
super(parent, type); super(parent, type);
this.valueMapping = new ArrayList<>(); this.valueMapping = new ArrayList<>();
this.keyMapping = new ArrayList<>(); this.keyMapping = new ArrayList<>();
this.isEditable = type == SWT.NONE; this.isEditable = type == SWT.NONE;
if (testKey != null) {
WidgetFactory.setTestId(this, testKey);
}
} }
@Override @Override

View file

@ -67,7 +67,7 @@ public class WidgetFactory {
private static final String ADD_HTML_ATTR_ARIA_ROLE = "role"; private static final String ADD_HTML_ATTR_ARIA_ROLE = "role";
private static final String ADD_HTML_ATTR_ARIA_LABEL = "aria-label"; private static final String ADD_HTML_ATTR_ARIA_LABEL = "aria-label";
private static final String ADD_HTML_ATTR_TEST_ID = "test-id"; private static final String ADD_HTML_ATTR_TEST_ID = "data-test";
private static final String SUB_TITLE_TExT_SUFFIX = ".subtitle"; private static final String SUB_TITLE_TExT_SUFFIX = ".subtitle";
public enum AriaRole { public enum AriaRole {
@ -377,6 +377,7 @@ public class WidgetFactory {
public Button buttonLocalized(final Composite parent, final String locTextKey) { public Button buttonLocalized(final Composite parent, final String locTextKey) {
final Button button = new Button(parent, SWT.NONE); final Button button = new Button(parent, SWT.NONE);
setARIARole(button, AriaRole.button); setARIARole(button, AriaRole.button);
setTestId(button, locTextKey);
this.polyglotPageService.injectI18n(button, new LocTextKey(locTextKey)); this.polyglotPageService.injectI18n(button, new LocTextKey(locTextKey));
return button; return button;
} }
@ -384,6 +385,7 @@ public class WidgetFactory {
public Button buttonLocalized(final Composite parent, final LocTextKey locTextKey) { public Button buttonLocalized(final Composite parent, final LocTextKey locTextKey) {
final Button button = new Button(parent, SWT.NONE); final Button button = new Button(parent, SWT.NONE);
setARIARole(button, AriaRole.button); setARIARole(button, AriaRole.button);
setTestId(button, locTextKey.name);
this.polyglotPageService.injectI18n(button, locTextKey); this.polyglotPageService.injectI18n(button, locTextKey);
return button; return button;
} }
@ -391,6 +393,7 @@ public class WidgetFactory {
public Button buttonLocalized(final Composite parent, final CustomVariant variant, final String locTextKey) { public Button buttonLocalized(final Composite parent, final CustomVariant variant, final String locTextKey) {
final Button button = new Button(parent, SWT.NONE); final Button button = new Button(parent, SWT.NONE);
setARIARole(button, AriaRole.button); setARIARole(button, AriaRole.button);
setTestId(button, locTextKey);
this.polyglotPageService.injectI18n(button, new LocTextKey(locTextKey)); this.polyglotPageService.injectI18n(button, new LocTextKey(locTextKey));
button.setData(RWT.CUSTOM_VARIANT, variant.key); button.setData(RWT.CUSTOM_VARIANT, variant.key);
return button; return button;
@ -408,6 +411,31 @@ public class WidgetFactory {
if (ariaLabel != null) { if (ariaLabel != null) {
setARIALabel(button, this.i18nSupport.getText(ariaLabel)); setARIALabel(button, this.i18nSupport.getText(ariaLabel));
} }
if (locTextKey != null) {
setTestId(button, locTextKey.name);
} else if (toolTipKey != null) {
setTestId(button, toolTipKey.name);
}
this.polyglotPageService.injectI18n(button, locTextKey, toolTipKey);
return button;
}
public Button buttonLocalized(
final Composite parent,
final int type,
final LocTextKey locTextKey,
final LocTextKey toolTipKey,
final String testKey,
final LocTextKey ariaLabel) {
final Button button = new Button(parent, type);
setARIARole(button, AriaRole.button);
if (ariaLabel != null) {
setARIALabel(button, this.i18nSupport.getText(ariaLabel));
}
if (testKey != null) {
setTestId(button, testKey);
}
this.polyglotPageService.injectI18n(button, locTextKey, toolTipKey); this.polyglotPageService.injectI18n(button, locTextKey, toolTipKey);
return button; return button;
} }
@ -475,19 +503,23 @@ public class WidgetFactory {
} }
public Text textInput(final Composite content, final LocTextKey label) { public Text textInput(final Composite content, final LocTextKey label) {
return textInput(content, false, false, this.i18nSupport.getText(label)); return textInput(content, false, false, label.name, this.i18nSupport.getText(label));
} }
public Text textInput(final Composite content, final String label) { public Text textInput(final Composite content, final String testKey, final LocTextKey label) {
return textInput(content, false, false, label); return textInput(content, false, false, testKey, this.i18nSupport.getText(label));
}
public Text textInput(final Composite content, final String testKey, final String label) {
return textInput(content, false, false, testKey, label);
} }
public Text passwordInput(final Composite content, final LocTextKey label) { public Text passwordInput(final Composite content, final LocTextKey label) {
return textInput(content, true, false, this.i18nSupport.getText(label)); return textInput(content, true, false, label.name, this.i18nSupport.getText(label));
} }
public Text passwordInput(final Composite content, final String label) { public Text passwordInput(final Composite content, final String testKey, final String label) {
return textInput(content, true, false, label); return textInput(content, true, false, testKey, label);
} }
public Text textAreaInput( public Text textAreaInput(
@ -518,13 +550,14 @@ public class WidgetFactory {
final boolean readonly, final boolean readonly,
final LocTextKey label) { final LocTextKey label) {
return textInput(content, password, readonly, this.i18nSupport.getText(label)); return textInput(content, password, readonly, label.name, this.i18nSupport.getText(label));
} }
public Text textInput( public Text textInput(
final Composite content, final Composite content,
final boolean password, final boolean password,
final boolean readonly, final boolean readonly,
final String testKey,
final String label) { final String label) {
final Text input = readonly final Text input = readonly
@ -536,6 +569,9 @@ public class WidgetFactory {
if (label != null) { if (label != null) {
WidgetFactory.setARIALabel(input, label); WidgetFactory.setARIALabel(input, label);
} }
if (testKey != null) {
setTestId(input, testKey);
}
return input; return input;
} }
@ -552,6 +588,7 @@ public class WidgetFactory {
final Text numberInput = new Text(content, (readonly) ? SWT.LEFT | SWT.READ_ONLY : SWT.RIGHT | SWT.BORDER); final Text numberInput = new Text(content, (readonly) ? SWT.LEFT | SWT.READ_ONLY : SWT.RIGHT | SWT.BORDER);
if (label != null) { if (label != null) {
setARIALabel(numberInput, this.i18nSupport.getText(label)); setARIALabel(numberInput, this.i18nSupport.getText(label));
setTestId(numberInput, label.name);
} }
if (numberCheck != null) { if (numberCheck != null) {
numberInput.addListener(SWT.Verify, event -> { numberInput.addListener(SWT.Verify, event -> {
@ -663,6 +700,7 @@ public class WidgetFactory {
final TreeItem item = new TreeItem(parent, SWT.NONE); final TreeItem item = new TreeItem(parent, SWT.NONE);
this.polyglotPageService.injectI18n(item, new LocTextKey(locTextKey)); this.polyglotPageService.injectI18n(item, new LocTextKey(locTextKey));
setARIARole(item, AriaRole.listitem); setARIARole(item, AriaRole.listitem);
setTestId(item, locTextKey);
return item; return item;
} }
@ -670,6 +708,7 @@ public class WidgetFactory {
final TreeItem item = new TreeItem(parent, SWT.NONE); final TreeItem item = new TreeItem(parent, SWT.NONE);
this.polyglotPageService.injectI18n(item, locTextKey); this.polyglotPageService.injectI18n(item, locTextKey);
setARIARole(item, AriaRole.listitem); setARIARole(item, AriaRole.listitem);
setTestId(item, locTextKey.name);
return item; return item;
} }
@ -677,6 +716,7 @@ public class WidgetFactory {
final TreeItem item = new TreeItem(parent, SWT.NONE); final TreeItem item = new TreeItem(parent, SWT.NONE);
this.polyglotPageService.injectI18n(item, new LocTextKey(locTextKey)); this.polyglotPageService.injectI18n(item, new LocTextKey(locTextKey));
setARIARole(item, AriaRole.listitem); setARIARole(item, AriaRole.listitem);
setTestId(item, locTextKey);
return item; return item;
} }
@ -684,6 +724,7 @@ public class WidgetFactory {
final TreeItem item = new TreeItem(parent, SWT.NONE); final TreeItem item = new TreeItem(parent, SWT.NONE);
this.polyglotPageService.injectI18n(item, locTextKey); this.polyglotPageService.injectI18n(item, locTextKey);
setARIARole(item, AriaRole.listitem); setARIARole(item, AriaRole.listitem);
setTestId(item, locTextKey.name);
return item; return item;
} }
@ -774,112 +815,46 @@ public class WidgetFactory {
if (toolTip != null) { if (toolTip != null) {
setARIALabel(imageButton, this.i18nSupport.getText(toolTip)); setARIALabel(imageButton, this.i18nSupport.getText(toolTip));
} }
setTestId(imageButton, toolTip.name);
return imageButton; return imageButton;
} }
public Selection selectionLocalized(
final Selection.Type type,
final Composite parent,
final Supplier<List<Tuple<String>>> itemsSupplier,
final LocTextKey label) {
return this.selectionLocalized(type, parent, itemsSupplier, null, null, label);
}
public Selection selectionLocalized(
final Selection.Type type,
final Composite parent,
final Supplier<List<Tuple<String>>> itemsSupplier,
final String label) {
return this.selectionLocalized(
type, parent, itemsSupplier, null, null, label);
}
public Selection selectionLocalized(
final Selection.Type type,
final Composite parent,
final Supplier<List<Tuple<String>>> itemsSupplier,
final LocTextKey toolTipTextKey,
final LocTextKey label) {
return this.selectionLocalized(type, parent, itemsSupplier, toolTipTextKey, null, label);
}
public Selection selectionLocalized( public Selection selectionLocalized(
final Selection.Type type, final Selection.Type type,
final Composite parent, final Composite parent,
final Supplier<List<Tuple<String>>> itemsSupplier, final Supplier<List<Tuple<String>>> itemsSupplier,
final LocTextKey toolTipTextKey, final LocTextKey toolTipTextKey,
final Supplier<List<Tuple<String>>> itemsToolTipSupplier, final Supplier<List<Tuple<String>>> itemsToolTipSupplier,
final String label) { final String testKey,
final String ariaLabel) {
return selectionLocalized(
type, parent, itemsSupplier, toolTipTextKey, itemsToolTipSupplier, null, label);
}
public Selection selectionLocalized(
final Selection.Type type,
final Composite parent,
final Supplier<List<Tuple<String>>> itemsSupplier,
final LocTextKey toolTipTextKey,
final Supplier<List<Tuple<String>>> itemsToolTipSupplier,
final LocTextKey label) {
return selectionLocalized(
type, parent, itemsSupplier, toolTipTextKey, itemsToolTipSupplier, null,
(label != null) ? this.i18nSupport.getText(label) : null);
}
public Selection selectionLocalized(
final Selection.Type type,
final Composite parent,
final Supplier<List<Tuple<String>>> itemsSupplier,
final LocTextKey toolTipTextKey,
final Supplier<List<Tuple<String>>> itemsToolTipSupplier,
final String actionLocTextPrefix,
final LocTextKey label) {
return selectionLocalized(
type, parent, itemsSupplier, toolTipTextKey, itemsToolTipSupplier, actionLocTextPrefix,
(label != null) ? this.i18nSupport.getText(label) : null);
}
public Selection selectionLocalized(
final Selection.Type type,
final Composite parent,
final Supplier<List<Tuple<String>>> itemsSupplier,
final LocTextKey toolTipTextKey,
final Supplier<List<Tuple<String>>> itemsToolTipSupplier,
final String actionLocTextPrefix,
final String label) {
final Selection selection; final Selection selection;
switch (type) { switch (type) {
case SINGLE: case SINGLE:
selection = new SingleSelection(parent, SWT.READ_ONLY); selection = new SingleSelection(parent, SWT.READ_ONLY, testKey);
break; break;
case SINGLE_COMBO: case SINGLE_COMBO:
selection = new SingleSelection(parent, SWT.NONE); selection = new SingleSelection(parent, SWT.NONE, testKey);
break; break;
case RADIO: case RADIO:
selection = new RadioSelection(parent); selection = new RadioSelection(parent, testKey);
break; break;
case MULTI: case MULTI:
selection = new MultiSelection(parent); selection = new MultiSelection(parent, testKey);
break; break;
case MULTI_COMBO: case MULTI_COMBO:
selection = new MultiSelectionCombo( selection = new MultiSelectionCombo(
parent, parent,
this, this,
actionLocTextPrefix, testKey,
// NOTE parent would work for firefox but on IE and Chrome only parent.getParent().getParent() works // NOTE parent would work for firefox but on IE and Chrome only parent.getParent().getParent() works
parent.getParent().getParent()); parent.getParent().getParent());
break; break;
case MULTI_CHECKBOX: case MULTI_CHECKBOX:
selection = new MultiSelectionCheckbox(parent); selection = new MultiSelectionCheckbox(parent, testKey);
break; break;
case COLOR: case COLOR:
selection = new ColorSelection(parent, this, actionLocTextPrefix); selection = new ColorSelection(parent, this, testKey);
break; break;
default: default:
throw new IllegalArgumentException("Unsupported Selection.Type: " + type); throw new IllegalArgumentException("Unsupported Selection.Type: " + type);
@ -903,41 +878,53 @@ public class WidgetFactory {
updateFunction.accept(selection); updateFunction.accept(selection);
} }
if (label != null) { if (ariaLabel != null) {
selection.setAriaLabel(label); selection.setAriaLabel(ariaLabel);
} }
return selection; return selection;
} }
public DateTime dateSelector(final Composite parent, final LocTextKey label) { public DateTime dateSelector(final Composite parent, final LocTextKey label, final String testKey) {
RWT.setLocale(this.i18nSupport.getUsersFormatLocale()); RWT.setLocale(this.i18nSupport.getUsersFormatLocale());
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
final DateTime dateTime = new DateTime(parent, SWT.DATE | SWT.BORDER | SWT.DROP_DOWN); final DateTime dateTime = new DateTime(parent, SWT.DATE | SWT.BORDER | SWT.DROP_DOWN);
dateTime.setLayoutData(gridData); dateTime.setLayoutData(gridData);
if (label != null) { if (label != null) {
setARIALabel(dateTime, this.i18nSupport.getText(label)); setARIALabel(dateTime, this.i18nSupport.getText(label));
} }
if (testKey != null) {
setTestId(dateTime, testKey);
}
return dateTime; return dateTime;
} }
public DateTime timeSelector(final Composite parent, final LocTextKey label) { public DateTime timeSelector(final Composite parent, final LocTextKey label, final String testKey) {
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
final DateTime dateTime = new DateTime(parent, SWT.TIME | SWT.BORDER | SWT.SHORT); final DateTime dateTime = new DateTime(parent, SWT.TIME | SWT.BORDER | SWT.SHORT);
dateTime.setLayoutData(gridData); dateTime.setLayoutData(gridData);
if (label != null) { if (label != null) {
setARIALabel(dateTime, this.i18nSupport.getText(label)); setARIALabel(dateTime, this.i18nSupport.getText(label));
} }
if (testKey != null) {
setTestId(dateTime, testKey);
}
return dateTime; return dateTime;
} }
public DateTime timeSelectorWithSeconds(final Composite parent, final LocTextKey label) { public DateTime timeSelectorWithSeconds(final Composite parent, final LocTextKey label, final String testKey) {
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
final DateTime dateTime = new DateTime(parent, SWT.TIME | SWT.BORDER | SWT.MEDIUM); final DateTime dateTime = new DateTime(parent, SWT.TIME | SWT.BORDER | SWT.MEDIUM);
dateTime.setLayoutData(gridData); dateTime.setLayoutData(gridData);
if (label != null) { if (label != null) {
setARIALabel(dateTime, this.i18nSupport.getText(label)); setARIALabel(dateTime, this.i18nSupport.getText(label));
} }
if (testKey != null) {
setTestId(dateTime, testKey);
}
return dateTime; return dateTime;
} }

View file

@ -1748,7 +1748,7 @@ sebserver.monitoring.exam.proctoring.action.broadcastoff.video=End Video Broadca
sebserver.monitoring.exam.proctoring.action.broadcaston.chat=Enable Chat sebserver.monitoring.exam.proctoring.action.broadcaston.chat=Enable Chat
sebserver.monitoring.exam.proctoring.action.broadcastoff.chat=Disable Chat sebserver.monitoring.exam.proctoring.action.broadcastoff.chat=Disable Chat
sebserver.monitoring.exam.proctoring.room.connections.title=SEB Connections in {0} sebserver.monitoring.exam.proctoring.room.connections.title=SEB Connections in {0}
sebserver.monitoring.exam.proctoring.room.connections.joinurl=Join URL:
sebserver.monitoring.exam.info.pleaseSelect=At first please select an Exam from the list sebserver.monitoring.exam.info.pleaseSelect=At first please select an Exam from the list
sebserver.monitoring.exam.list.empty=There are currently no running exams sebserver.monitoring.exam.list.empty=There are currently no running exams