Loading...
Searching...
No Matches
lomiri.indicators.tests.test_action_latency.TestBuffering Class Reference

## Public Member Functions

| test_switch_buffers_actvations (self)
| test_slider_buffers_activations (self)

## Static Public Attributes

int | action_delay = 2500

## Detailed Description

    Test that switching multiple times will buffer activations

    See https://bugs.launchpad.net/lomiri/+source/lomiri/+bug/1390136 .

Definition at line 99 of file test_action_latency.py.

## Member Function Documentation

## test_slider_buffers_activations()

lomiri.indicators.tests.test_action_latency.TestBuffering.test_slider_buffers_activations | ( |  | self | ) |

Definition at line 144 of file test_action_latency.py.

def test_slider_buffers_activations(self):
slider = self.indicator_page.get_slider()
original_value = slider.value
slider.slide_left()
# will buffer change until it receives the change from server
slider.slide_right()
final_value = slider.value
# backend will respond to first slider. Since it's a live slider
# it'll probably be a random value along the slide.
slider_menu = self.indicator_page.get_slider_menu()
self.assertThat(
slider_menu.serverValue,
Eventually(NotEquals(original_value), timeout=20)
)
# It wont yet have reached the final value due to the buffering
# Second activate should have gone out by now
self.assertThat(
slider_menu.serverValue,
NotEquals(final_value)
)
# front-end should not change as a result of server update
# while it is buffered
self.assertThat(
slider.value,
Equals(final_value)
)
# server will respond to the second activate
self.assertThat(
slider_menu.serverValue,
Eventually(Equals(final_value), timeout=20)
)
# make sure we've got the server value set.
self.assertThat(
slider.value,
Equals(slider_menu.serverValue)
)

## test_switch_buffers_actvations()

lomiri.indicators.tests.test_action_latency.TestBuffering.test_switch_buffers_actvations | ( |  | self | ) |

Definition at line 107 of file test_action_latency.py.

def test_switch_buffers_actvations(self):
switch = self.indicator_page.get_switcher()
switch.change_state()
intermediate_value = switch.checked
# will buffer change until it receives the change from server
switch.change_state()
final_value = switch.checked
# backend will respond to first switch.
switch_menu = self.indicator_page.get_switch_menu()
self.assertThat(
switch_menu.serverChecked,
Eventually(Equals(intermediate_value), timeout=20)
)
# The buffered activation should have gone to server now.
# front-end should not change as a result of server update
# while it is buffered
self.assertThat(
switch.checked,
Equals(final_value)
)
# server will respond to the second activate
self.assertThat(
switch_menu.serverChecked,
Eventually(Equals(final_value), timeout=20)
)
# make sure we've got the server value set.
self.assertThat(
switch.checked,
Equals(switch_menu.serverChecked)
)

## Member Data Documentation

## action_delay

int lomiri.indicators.tests.test_action_latency.TestBuffering.action_delay = 2500

static

Definition at line 105 of file test_action_latency.py.

The documentation for this class was generated from the following file:

- tests/autopilot/lomiri/indicators/tests/test_action_latency.py