@Test public void getSecondInVerticalSplitPanel() throws Exception { VerticalSplitPanelElement sp = $(VerticalSplitPanelElement.class).first(); LabelElement label = sp.getSecondComponent(LabelElement.class); String labelText = label.getText(); assertTrue( "The second component of the split panel should be a label" + " containing the text 'Label 2.2'. Actual text: " + labelText, "Label 2.2".equals(labelText)); }
@Test public void getFirstInSplitPanelWithFirstComponent() throws Exception { // This test is for regression checking - getFirst should also work // in a tab sheet with only the second component. VerticalSplitPanelElement sp = $(VerticalSplitPanelElement.class).get(1); ButtonElement button = sp.getFirstComponent(ButtonElement.class); String buttonText = button.getText(); assertTrue( "The first component of the split panel should be a button labeled \"Button\"." + " Actual label: " + buttonText, "Button".equals(buttonText)); }
@Test public void getFirstInVerticalSplitPanel() throws Exception { VerticalSplitPanelElement sp = $(VerticalSplitPanelElement.class).first(); LabelElement label = null; // There is no first component, so allow an exception. try { label = sp.getFirstComponent(LabelElement.class); } catch (Exception e) { } String labelText = label == null ? "" : label.getText(); assertTrue( "The split panel should not have a first component. Found a label with" + " text " + labelText, label == null); }
@Test public void getSecondInSplitPanelWithFirstComponent() throws Exception { // This test is for regression checking - getSecond should not return a // non-null element in a tab sheet with only the second component. VerticalSplitPanelElement sp = $(VerticalSplitPanelElement.class).get(1); ButtonElement button = null; // There is no second component, so allow an exception. try { button = sp.getSecondComponent(ButtonElement.class); } catch (Exception e) { } String buttonText = button == null ? "" : button.getText(); assertTrue( "The split panel should not have a second component. Found a button with" + " text " + buttonText, button == null); }