new landscape styling & scripting for gameroom #id_tray apparatus, & some overall scripting & styling like wobble on click-to-close; new --undUser & --duoUser rootvars universally the table felt values; many new Jasmine tests to handle tray functionality
This commit is contained in:
@@ -41,6 +41,17 @@ class TrayTest(FunctionalTest):
|
||||
document.dispatchEvent(new PointerEvent("pointerup", {clientX: endX, bubbles: true}));
|
||||
""", btn, start_x, end_x)
|
||||
|
||||
def _simulate_drag_y(self, btn, offset_y):
|
||||
"""Dispatch JS pointer events on the Y axis for landscape drag tests."""
|
||||
start_y = btn.rect['y'] + btn.rect['height'] / 2
|
||||
end_y = start_y + offset_y
|
||||
self.browser.execute_script("""
|
||||
var btn = arguments[0], startY = arguments[1], endY = arguments[2];
|
||||
btn.dispatchEvent(new PointerEvent("pointerdown", {clientY: startY, clientX: 0, bubbles: true}));
|
||||
document.dispatchEvent(new PointerEvent("pointermove", {clientY: endY, clientX: 0, bubbles: true}));
|
||||
document.dispatchEvent(new PointerEvent("pointerup", {clientY: endY, clientX: 0, bubbles: true}));
|
||||
""", btn, start_y, end_y)
|
||||
|
||||
def _make_sig_select_room(self, founder_email="founder@test.io"):
|
||||
founder, _ = User.objects.get_or_create(email=founder_email)
|
||||
room = Room.objects.create(name="Tray Test Room", owner=founder)
|
||||
@@ -155,3 +166,45 @@ class TrayTest(FunctionalTest):
|
||||
self.wait_for(lambda: self.browser.find_element(By.ID, "id_tray_btn"))
|
||||
tray = self.browser.find_element(By.ID, "id_tray")
|
||||
self.assertFalse(tray.is_displayed())
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
# Test T6 — landscape: tray btn is near the top edge of the viewport #
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
def test_tray_btn_anchored_near_top_in_landscape(self):
|
||||
room = self._make_sig_select_room()
|
||||
self.create_pre_authenticated_session("founder@test.io")
|
||||
self.browser.set_window_size(900, 500)
|
||||
self.browser.get(self._room_url(room))
|
||||
|
||||
btn = self.wait_for(
|
||||
lambda: self.browser.find_element(By.ID, "id_tray_btn")
|
||||
)
|
||||
self.assertTrue(btn.is_displayed())
|
||||
|
||||
# In landscape the handle sits at the top of the content area;
|
||||
# btn bottom should be within the top 40% of the viewport.
|
||||
vh = self.browser.execute_script("return window.innerHeight")
|
||||
btn_bottom = btn.location["y"] + btn.size["height"]
|
||||
self.assertLess(btn_bottom, vh * 0.4)
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
# Test T7 — landscape: dragging btn downward opens the tray #
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
def test_dragging_tray_btn_down_opens_tray_in_landscape(self):
|
||||
room = self._make_sig_select_room()
|
||||
self.create_pre_authenticated_session("founder@test.io")
|
||||
self.browser.set_window_size(900, 500)
|
||||
self.browser.get(self._room_url(room))
|
||||
|
||||
btn = self.wait_for(lambda: self.browser.find_element(By.ID, "id_tray_btn"))
|
||||
# In landscape, #id_tray is always display:block; position controls visibility.
|
||||
# Use Tray.isOpen() to check logical state.
|
||||
self.assertFalse(self.browser.execute_script("return Tray.isOpen()"))
|
||||
|
||||
self._simulate_drag_y(btn, 300)
|
||||
|
||||
self.wait_for(
|
||||
lambda: self.assertTrue(self.browser.execute_script("return Tray.isOpen()"))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user