Skip to content

Conversation

@paulinabls
Copy link
Contributor

No description provided.

}

override fun runTask2(device: IDevice) {
if (hasLocaleSetAsExpected(device)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are missing the ! here.
You probably want to check if the system has NOT set the locale as expected, before you throw the exception.

println("Device $deviceDetails setting language to $language.")
deviceWrapper.setLanguage(language)

Thread.sleep(1000) //external app changes language via UI, so we need to wait for it
Copy link
Collaborator

@kraffmann kraffmann Jan 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a possibility to avoid the Thread.sleep()? In case the device takes longer to change the system language, we throw an exception.
Is there another event we can react on?
If not, I am fine with this.

Comment on lines 25 to 30
protected fun hasLocaleSetAsExpected(device: IDevice) :Boolean {
deviceWrapper = DeviceWrapper(device, outputReceiverProvider)
currentLanguage = deviceWrapper.getLanguage()

return currentLanguage != language
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whether the naming is stating the opposite of what the function is doing or the comparison operator should be == instead of !=.

@paulinabls paulinabls force-pushed the feature/check_and_set_language_task branch from 5f395d8 to a8eefd0 Compare January 7, 2020 14:43
@paulinabls paulinabls requested a review from kraffmann January 7, 2020 15:21
@paulinabls paulinabls merged commit e083bad into master Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants