Everyone has the Notebooks chooser
From the development repository at 1ccf212. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
ba6791455b
commit
bc3c9bb886
6 files changed
+73
-25
No files matched your search
@@ -851,11 +851,11 @@ class EndToEndTest(unittest.TestCase):
|
||||
|
||||
# Allowed by the host, the guest puts an image on the page (the
|
||||
# file would come from the browser's own chooser).
|
||||
self.assertTrue(firefox.run("return document.getElementById('host_tools').hidden;"))
|
||||
self.assertTrue(firefox.run("return document.getElementById('new_page').hidden;"))
|
||||
firefox.switch_to(host_tab)
|
||||
self.assertEqual(firefox.run(TOGGLE_PERMISSION, "Guest"), "true")
|
||||
firefox.switch_to(guest_tab)
|
||||
self.wait_until(lambda s: not firefox.run("return document.getElementById('host_tools').hidden;"),
|
||||
self.wait_until(lambda s: not firefox.run("return document.getElementById('new_page').hidden;"),
|
||||
"the guest to be allowed to start pages")
|
||||
firefox.run_until_done(LOAD_IMAGE, 300, 400, "png", 0, False)
|
||||
guest = self.wait_until(lambda s: s["image"] and s["image"]["ready"], "the guest's image")
|
||||
@@ -1182,7 +1182,7 @@ class EndToEndTest(unittest.TestCase):
|
||||
# after the right is withdrawn, and cannot remove the host's.
|
||||
self.assertEqual(firefox.run(TOGGLE_PERMISSION, "Viewer"), "true")
|
||||
firefox.switch_to(guest_tab)
|
||||
self.wait_until(lambda s: not firefox.run("return document.getElementById('host_tools').hidden;"),
|
||||
self.wait_until(lambda s: not firefox.run("return document.getElementById('new_page').hidden;"),
|
||||
"the viewer to be allowed")
|
||||
firefox.run_until_done(LOAD_IMAGE, 200, 100, "png", 0, False)
|
||||
added = self.wait_until(lambda s: len(s["images"]) == 3, "the viewer's image")
|
||||
@@ -1190,7 +1190,7 @@ class EndToEndTest(unittest.TestCase):
|
||||
self.wait_until(lambda s: len(s["images"]) == 3, "the viewer's image to reach the host")
|
||||
self.assertEqual(firefox.run(TOGGLE_PERMISSION, "Viewer"), "false")
|
||||
firefox.switch_to(guest_tab)
|
||||
self.wait_until(lambda s: firefox.run("return document.getElementById('host_tools').hidden;"),
|
||||
self.wait_until(lambda s: firefox.run("return document.getElementById('new_page').hidden;"),
|
||||
"the right to be withdrawn")
|
||||
own = added["images"][2]
|
||||
firefox.run(ERASER_AT, own["x"] + 100, own["y"] + 50, 5)
|
||||
@@ -1431,9 +1431,9 @@ class EndToEndTest(unittest.TestCase):
|
||||
"return document.getElementById('notice').textContent;"))
|
||||
|
||||
# Only the host can start a new page.
|
||||
self.assertTrue(firefox.run("return document.getElementById('host_tools').hidden;"))
|
||||
self.assertTrue(firefox.run("return document.getElementById('new_page').hidden;"))
|
||||
firefox.switch_to(teacher_tab)
|
||||
self.assertFalse(firefox.run("return document.getElementById('host_tools').hidden;"))
|
||||
self.assertFalse(firefox.run("return document.getElementById('new_page').hidden;"))
|
||||
|
||||
# The host starts a new page. Everyone moves to it, and everyone's
|
||||
# old page is kept without anyone asking: the teacher's now, the
|
||||
@@ -1963,12 +1963,12 @@ class EndToEndTest(unittest.TestCase):
|
||||
self.enter_name("Student", "join_session")
|
||||
self.wait_until(lambda s: s["page"]["number"] == 2 and s["image"] and s["image"]["ready"],
|
||||
"the student to reach the large image page")
|
||||
self.assertTrue(firefox.run("return document.getElementById('host_tools').hidden;"))
|
||||
self.assertTrue(firefox.run("return document.getElementById('new_page').hidden;"))
|
||||
firefox.switch_to(teacher_tab)
|
||||
self.assertEqual(firefox.run(TOGGLE_PERMISSION, "Student"), "true")
|
||||
firefox.switch_to(student_tab)
|
||||
self.wait_until(
|
||||
lambda s: not firefox.run("return document.getElementById('host_tools').hidden;"),
|
||||
lambda s: not firefox.run("return document.getElementById('new_page').hidden;"),
|
||||
"the student to be allowed to start pages")
|
||||
firefox.run_until_done(LOAD_IMAGE, 300, 400, "png", 0, True)
|
||||
student = self.wait_until(lambda s: s["page"]["number"] == 3, "the student's image page")
|
||||
@@ -1981,7 +1981,7 @@ class EndToEndTest(unittest.TestCase):
|
||||
self.assertEqual(firefox.run(TOGGLE_PERMISSION, "Student"), "false")
|
||||
firefox.switch_to(student_tab)
|
||||
self.wait_until(
|
||||
lambda s: firefox.run("return document.getElementById('host_tools').hidden;"),
|
||||
lambda s: firefox.run("return document.getElementById('new_page').hidden;"),
|
||||
"the student's permission to be withdrawn")
|
||||
firefox.run("window.kokkoja.session.newPage();")
|
||||
time.sleep(1)
|
||||
@@ -2241,6 +2241,21 @@ class EndToEndTest(unittest.TestCase):
|
||||
return [...document.getElementById('session_notebook').options].map((o) => o.textContent);
|
||||
"""), lambda names: "Other notebook" not in names, "the toolbar's list to lose the notebook")
|
||||
firefox.run("document.getElementById('chooser_close').click();")
|
||||
|
||||
# A guest has the chooser too, to look at and clear their own
|
||||
# notebook; a card tells them that loading is the host's.
|
||||
firefox.switch_to(student_tab)
|
||||
number = self.state()["page"]["number"]
|
||||
firefox.run("document.getElementById('load_notebook_page').click();")
|
||||
self.wait_until_true(lambda: firefox.run("""
|
||||
return document.querySelectorAll('#chooser_pages .page_card').length;
|
||||
"""), lambda n: n >= 1, "the student's chooser to list kept pages")
|
||||
firefox.run("document.querySelector('#chooser_pages .page_card').click();")
|
||||
self.assertIn("Only the host and co-hosts", firefox.run("return document.getElementById('chooser_message').textContent;"))
|
||||
self.assertTrue(firefox.run("return document.getElementById('notebook_chooser').open;"))
|
||||
self.assertEqual(self.state()["page"]["number"], number)
|
||||
firefox.run("document.getElementById('chooser_close').click();")
|
||||
firefox.switch_to(teacher_tab)
|
||||
# A page that its images have made longer than a sheet is first
|
||||
# shown at the scale at which one sheet fits the window.
|
||||
self.assertEqual(firefox.run(VIEW), long_view)
|
||||
|
||||
Reference in new issue
Block a user