Skip to content

Commit

Permalink
Add feature to use label text as identifier (#107)
Browse files Browse the repository at this point in the history
Closes #102
  • Loading branch information
badari412 authored and Mihai Pârvu committed Jul 3, 2018
1 parent e92bf6d commit 764db06
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package org.robotframework.swing.label;

import org.netbeans.jemmy.operators.ContainerOperator;
import org.robotframework.swing.chooser.ByNameComponentChooser;
import org.robotframework.swing.chooser.ByNameOrTextComponentChooser;
import org.robotframework.swing.context.Context;
import org.robotframework.swing.factory.DefaultContextVerifyingOperatorFactory;

Expand All @@ -27,6 +27,6 @@ public LabelOperator createOperatorByIndex(int index) {
}

public LabelOperator createOperatorByName(String name) {
return new LabelOperator((ContainerOperator) Context.getContext(), new ByNameComponentChooser(name));
return new LabelOperator((ContainerOperator) Context.getContext(), new ByNameOrTextComponentChooser(name));
}
}
9 changes: 9 additions & 0 deletions src/test/resources/robot-tests/label.robot
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Label Should Exist By Index

Label Should Exist By Name
labelShouldExist ${labelName}

Label Should Exist By Text
labelShouldExist ${labelContent}

Label Should Exist Fails If Label Doesn't Exist
runKeywordAndExpectError *Label 'unexistingLabel' doesn't exist* labelShouldExist unexistingLabel
Expand All @@ -21,10 +24,16 @@ Label Should Not Exist By Index

Label Should Not Exist By Name
labelShouldNotExist UnexistingLabel

Label Should Not Exist By Text
labelShouldNotExist UnexistingLabel

Label Should Not Exist Fails If Label Exists
runKeywordAndExpectError *Label '${labelName}' exists* labelShouldNotExist ${labelName}

Label Should Not Exist By Text Fails If Label Exists
runKeywordAndExpectError *Label '${labelContent}' exists* labelShouldNotExist ${labelContent}

Get Label Content By Name
${retrievedContent}= getLabelContent ${labelName}
shouldBeEqual ${labelContent} ${retrievedContent}
Expand Down

0 comments on commit 764db06

Please sign in to comment.