@Test public void getSecondInHorizontalSplitPanel() throws Exception { HorizontalSplitPanelElement sp = $(HorizontalSplitPanelElement.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 1.2'. Actual text: " + labelText, "Label 1.2".equals(labelText)); }
@Test public void getFirstInHorizontalSplitPanel() throws Exception { HorizontalSplitPanelElement sp = $(HorizontalSplitPanelElement.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 getElementsInSplitPanelWithBothComponents() throws Exception { // This test is for regression checking - getFirst and getSecond // should work also when the split panel has both components. HorizontalSplitPanelElement sp = $(HorizontalSplitPanelElement.class).get(1); LabelElement label1 = sp.getFirstComponent(LabelElement.class); String label1Text = label1.getText(); assertTrue( "The first component of the split panel should be a label" + " containing the text 'Label 3.1'. Actual text: " + label1Text, "Label 3.1".equals(label1Text)); LabelElement label2 = sp.getSecondComponent(LabelElement.class); String label2Text = label2.getText(); assertTrue( "The second component of the split panel should be a label" + " containing the text 'Label 3.2'. Actual text: " + label2Text, "Label 3.2".equals(label2Text)); }