diff --git a/scripts/record-scene.py b/scripts/record-scene.py index 0167e0ba..eee37791 100644 --- a/scripts/record-scene.py +++ b/scripts/record-scene.py @@ -924,6 +924,11 @@ def point_at(self, target) -> dict: if box is None: return {} x, y = int(box["x"] + box["width"] / 2), int(box["y"] + box["height"] / 2) + width, height = self.page.viewport_size["width"], self.page.viewport_size["height"] + if x > width - AVATAR_WIDTH and y > height - AVATAR_HEIGHT: + fault = f"at {self._at():.2f}s: the press on step {self.step_number} lands at {x},{y}" + self.corner_faults.append(fault) + print(f" CORNER: {fault}", flush=True) start = self.cursor_to(x, y, CURSOR_GLIDE_SECONDS) self.page.wait_for_timeout(int(CURSOR_REST_SECONDS * 1000)) ripple_at = self._at() @@ -938,7 +943,11 @@ def clear_of_caption(self, selector: str) -> None: scroll: Playwright cannot press it, and a viewer would not see it pressed. When the thing is under the bar, room is added once below the page's last row and the thing is put in the middle of the window. A - thing already clear is left where it is, so no other take moves. + thing that reaches across into the avatar's columns is held above the + avatar's corner instead, box padding and all: the right-hand half of + the station screen (its Issue card, its queue) sits there once + scrolled, and studio draws its narrator over it. A thing already clear + is left where it is, so no other take moves. The thing is found the way the click will find it, by Playwright's own locator: a scene's selector may say `:has-text("Release")`, which @@ -949,9 +958,13 @@ def clear_of_caption(self, selector: str) -> None: if not found.count(): return found.first.evaluate( - """(node, bar) => { + """(node, [bar, cornerWidth, cornerHeight]) => { const box = node.getBoundingClientRect(); - if (box.bottom <= window.innerHeight - bar) return; + // A thing that reaches across into the avatar's columns has + // the avatar's corner as its floor, not the caption bar. + const floor = box.right > window.innerWidth - cornerWidth + ? window.innerHeight - cornerHeight : window.innerHeight - bar; + if (box.bottom <= floor) return; if (!document.getElementById('fs-scene-room')) { const room = document.createElement('div'); room.id = 'fs-scene-room'; @@ -960,7 +973,7 @@ def clear_of_caption(self, selector: str) -> None: } node.scrollIntoView({ block: 'center', behavior: 'instant' }); }""", - CAPTION_HEIGHT * 2, + [CAPTION_HEIGHT * 2, AVATAR_WIDTH, AVATAR_HEIGHT + 2 * CALLOUT_PAD], ) def wait_for(self, step: dict, timeout: float) -> None: @@ -1152,7 +1165,7 @@ def scroll_to(self, selector: str, block: str, offset: int, text: str | None = N const into = (r) => r.width > 0 && r.height > 0 && r.right > corner.left && r.bottom > corner.top && r.left < width && r.top < height; const found = []; - for (const id of ['fs-scene-cap', 'fs-scene-badge', 'fs-scene-callout-label']) { + for (const id of ['fs-scene-cap', 'fs-scene-badge', 'fs-scene-callout', 'fs-scene-callout-label']) { const el = document.getElementById(id); if (!el || getComputedStyle(el).display === 'none') continue; const r = el.getBoundingClientRect(); diff --git a/scripts/scenes/README.md b/scripts/scenes/README.md index 0479bcd1..3aad4ab4 100644 --- a/scripts/scenes/README.md +++ b/scripts/scenes/README.md @@ -36,6 +36,8 @@ after it, so those stills show the box; `label` puts a few words on a tab at the box's top left (below it when the box is at the top of the frame, inside it when the box fills the frame); `style = "spotlight"` dims the rest of the frame instead. A thing off the frame, or under the page's sticky -header or the caption bar, is scrolled clear first; a thing not on the page +header or the caption bar, or reaching into the narrator's corner at the +bottom right (240 by 200), is scrolled clear first; a thing not on the page refuses the take, naming the step. Point `at` something smaller than the -frame. `label` or `style` without `at` is refused. +frame. `label` or `style` without `at` is refused. A box, a label or a press +that still lands in the narrator's corner fails the take, as a caption there does. diff --git a/scripts/scenes/course/03-01-the-station-screen.toml b/scripts/scenes/course/03-01-the-station-screen.toml index 161544a8..2f052309 100644 --- a/scripts/scenes/course/03-01-the-station-screen.toml +++ b/scripts/scenes/course/03-01-the-station-screen.toml @@ -19,8 +19,10 @@ take_is = "lesson" part = "hook" base = "http://127.0.0.1:8040" badge = "pre-alpha · simulated plant · v{version}" -# Four to six minutes, as the outline says this class runs. -budget_seconds = 360 +# Four to six minutes, as the outline says this class runs, and up to half a +# minute more for reaching the station and the Orders page by the menus (Scott, +# 2026-11-15: click through the menus even if the class runs longer). +budget_seconds = 390 gif_skip_seconds = 2.0 width = 1280 height = 720 @@ -36,6 +38,7 @@ notes = [ "The cutlery pack carries no maintenance plan, so the maintenance card says nothing is owed. That is the product's answer for this plant, filmed as drawn.", "The second booking, 5,000 good, is typed to show that the station does not check a typed figure against the mould's own counter. It is a write to a scratch plant that is thrown away when the take ends.", "At any speed but 1x every 2D page carries the product's REPLAY 10× banner across its top. It is filmed as the product draws it.", + "The class is clicked through as a person would: the only page opened by address is the Floor, the first page after sign-in. The station is reached by the Floor menu's Station tab and the mould chosen from its Machine list; the planned order is reached by the Orders menu and found with its search box; the way back is Floor, then Station.", "The opening beat is a plain card with words on it. There is no artwork of a machine, a tablet or a person.", ] @@ -127,11 +130,28 @@ name = "four-words" # ------------------------------------------------------------ on the screen +# The station is reached the way an operator reaches it: the Floor page (the +# one page opened by address, the first after signing in), its Station chip, +# and the Machine chooser at the top of the station screen. The product has no +# other station picker; the Floor page's own forms are not the station. [[step]] part = "screen" do = "goto" -url = "/dashboard/station?m=FORK1_Mold" -settle = 3 +url = "/dashboard" +settle = 2 + +[[step]] +do = "click" +selector = "nav.subnav a:text-is(\"Station\")" + +[[step]] +do = "wait_for" +js = "document.querySelector('#machine').options.length > 1" + +[[step]] +do = "choose" +selector = "#machine" +value = "FORK1_Mold" [[step]] do = "wait_for" @@ -141,10 +161,14 @@ text = "WO-FORK1-0001" [[step]] do = "say" line = "The station screen of the fork mould, FORK1_Mold. The machine is chosen at the top; the operator starts the shift here." +at = "#machine" +label = "Machine" [[step]] do = "say" line = "First card, its state: running, and since when. Going down asks why, which is the next class." +at = "#state-buttons" +label = "State" [[step]] do = "mark" @@ -153,10 +177,14 @@ name = "its-state" [[step]] do = "say" line = "Second card, its queue: the order it is running, WO-FORK1-0001, step 10, Mold, and how many good of how many ordered." +at = "#queue li.running-op" +label = "Running order" [[step]] do = "say" line = "That count moves by itself: the mould's own counter books every shot it makes." +at = "#queue li.running-op .what .muted" +label = "Good of ordered" [[step]] do = "mark" @@ -173,6 +201,8 @@ scroll_offset = 300 [[step]] do = "say" line = "Third card, book output. Against: the order at the head of the queue, step 10. The operator counts a box." +at = "#book-order" +label = "Against" [[step]] do = "choose" @@ -192,6 +222,8 @@ text = "3" [[step]] do = "say" line = "Five hundred good, three scrap. Book." +at = "#book .big-io" +label = "Good and scrap" [[step]] do = "click" @@ -213,6 +245,8 @@ scroll_offset = 300 [[step]] do = "say" line = "Booked, against WO-FORK1-0001 step 10, under the name of the person signed in. The queue's count is up by five hundred." +at = "#queue li.running-op .what .muted" +label = "The count" [[step]] do = "mark" @@ -221,6 +255,8 @@ name = "booked-500-good-3-scrap" [[step]] do = "say" line = "Fourth card, issue material. It issues to the order running here, WO-FORK1-0001." +at = "#issue-where" +label = "Issues to" [[step]] do = "choose" @@ -235,6 +271,8 @@ text = "2" [[step]] do = "say" line = "The lot is the fork line's polypropylene resin, LOT-PP-FORK1-001. Two kilos: about what five hundred forks weigh. Issue." +at = "#issue .big-io" +label = "Lot and kilos" [[step]] do = "click" @@ -247,6 +285,8 @@ js = "[...document.querySelectorAll('#issue-lot option')].some(o => o.value === [[step]] do = "say" line = "Issued. The lot is two kilos lighter, and the order now says which resin went into it." +at = "#issue-lot" +label = "Two kilos lighter" [[step]] do = "mark" @@ -263,6 +303,8 @@ scroll_offset = 300 [[step]] do = "say" line = "Fifth card, quality, on what this machine is running: forks, UT-FORK. Only characteristics with a specification are offered." +at = "#q-char" +label = "Characteristic" [[step]] do = "choose" @@ -272,6 +314,8 @@ value = "length_mm" [[step]] do = "say" line = "Length: the specification is 164 to 166 millimetres. The operator puts a fork on the gauge." +at = "#q-spec" +label = "Specification" [[step]] do = "fill" @@ -289,6 +333,8 @@ js = "(document.querySelector('#q-recent').innerText || '').includes('165.1') && [[step]] do = "say" line = "165.1 millimetres: in spec. It is in the recent results, with the time and who measured it." +at = "#q-recent li:has-text(\"165.1\")" +label = "In spec" [[step]] do = "mark" @@ -305,10 +351,14 @@ scroll_offset = 320 [[step]] do = "say" line = "Last card, maintenance on this machine. Here, nothing is owed: this plant has no maintenance plan set up." +at = "#maint" +label = "Nothing owed" [[step]] do = "say" line = "Where a plan is set up, the jobs due on this machine are listed here, and the operator can start and complete them." +at = "#maint" +label = "Jobs due" [[step]] do = "mark" @@ -316,11 +366,26 @@ name = "what-maintenance-is-owed" # -------------------------------------------------------------- it refuses +# The Orders page by its menu, and the next fork order found by typing its +# code into the page's own search box. [[step]] part = "refuses" -do = "goto" -url = "/dashboard/orders?q=WO-FORK1-0002" -settle = 2 +do = "click" +selector = "header nav a:text-is(\"Orders\")" + +[[step]] +do = "wait_for" +selector = "#order-list" +text = "WO-" + +[[step]] +do = "fill" +selector = "#f-text" +text = "WO-FORK1-0002" + +[[step]] +do = "wait_for" +js = "[...document.querySelectorAll('#order-list tbody tr')].length === 1 && document.querySelector('#order-list tbody').innerText.includes('WO-FORK1-0002')" [[step]] do = "click" @@ -336,19 +401,27 @@ scroll_offset = 220 [[step]] do = "say" line = "Now what it refuses. This is the next fork order, WO-FORK1-0002. Its first step is on the same mould, but it is only planned." +at = "#d-status" +label = "Only planned" +style = "spotlight" [[step]] do = "mark" name = "the-next-order-is-planned" +# Back the same way: the Floor menu, then its Station chip. The station +# remembers the machine last chosen on it, FORK1_Mold. [[step]] -do = "goto" -url = "/dashboard/station?m=FORK1_Mold" -settle = 3 +do = "click" +selector = "header nav a:text-is(\"Floor\")" + +[[step]] +do = "click" +selector = "nav.subnav a:text-is(\"Station\")" [[step]] do = "wait_for" -js = "[...document.querySelectorAll('#book-order option')].map(o => o.value).join() === 'WO-FORK1-0001'" +js = "document.querySelector('#machine').value === 'FORK1_Mold' && [...document.querySelectorAll('#book-order option')].map(o => o.value).join() === 'WO-FORK1-0001'" scroll_to = "#book" scroll_block = "start" scroll_offset = 300 @@ -356,10 +429,15 @@ scroll_offset = 300 [[step]] do = "say" line = "Back at the mould, the Against list holds one order: WO-FORK1-0001. The planned order is not there to book against." +at = "#book-order" +label = "One order" +style = "spotlight" [[step]] do = "say" line = "Nor is any order of another line. An operator can only book to work released to this machine." +at = "#book-order" +label = "Released work only" [[step]] do = "mark" @@ -374,6 +452,8 @@ js = "Number(((document.querySelector('#queue').innerText.match(/Mold\\D+([0-9,] [[step]] do = "say" line = "And what it does not refuse. Type five thousand good: more forks than this mould has made since the plant started." +at = "#book-good" +label = "Good" [[step]] do = "fill" @@ -392,6 +472,8 @@ text = "Booked 5,000 good, 0 scrap." [[step]] do = "say" line = "Booked. The station took the figure as typed. Nothing on the screen says the counter disagrees." +at = "#book" +label = "No warning" [[step]] do = "mark" @@ -408,6 +490,8 @@ scroll_offset = 300 [[step]] do = "say" line = "The queue now says the mould has made thousands more than its counter saw. A typed booking is added to the count; it is not checked against it." +at = "#queue li.running-op .what .muted" +label = "Thousands more" [[step]] do = "say" diff --git a/tests/fixtures/course/class-2-1-voiced-script.txt b/tests/fixtures/course/class-2-1-voiced-script.txt new file mode 100644 index 00000000..dfe868e4 --- /dev/null +++ b/tests/fixtures/course/class-2-1-voiced-script.txt @@ -0,0 +1,30 @@ +An operator stands at one press for a whole shift, a tablet in hand. Not the plant, not the line: this one machine. +Through the shift they ask the same few things. What is it doing, and what is next for it? +What did I make, what did I put in, is it good, and is anything owed to the machine? One screen answers all of them. +Four words. A station is one machine's screen, made for the person standing at it, not for the office. +The queue is the work released to this machine, in the order it should run. Only released work is in it. +To book is to write down how many good and how many scrap, always against an order and its step. +To issue is to write down which lot of material went into that order, so it can be traced later. +The station screen of the fork mould, FORK1_Mold. The machine is chosen at the top; the operator starts the shift here. +First card, its state: running, and since when. Going down asks why, which is the next class. +Second card, its queue: the order it is running, WO-FORK1-0001, step 10, Mold, and how many good of how many ordered. +That count moves by itself: the mould's own counter books every shot it makes. +Third card, book output. Against: the order at the head of the queue, step 10. The operator counts a box. +Five hundred good, three scrap. Book. +Booked, against WO-FORK1-0001 step 10, under the name of the person signed in. The queue's count is up by five hundred. +Fourth card, issue material. It issues to the order running here, WO-FORK1-0001. +The lot is the fork line's polypropylene resin, LOT-PP-FORK1-001. Two kilos: about what five hundred forks weigh. Issue. +Issued. The lot is two kilos lighter, and the order now says which resin went into it. +Fifth card, quality, on what this machine is running: forks, UT-FORK. Only characteristics with a specification are offered. +Length: the specification is 164 to 166 millimetres. The operator puts a fork on the gauge. +165.1 millimetres: in spec. It is in the recent results, with the time and who measured it. +Last card, maintenance on this machine. Here, nothing is owed: this plant has no maintenance plan set up. +Where a plan is set up, the jobs due on this machine are listed here, and the operator can start and complete them. +Now what it refuses. This is the next fork order, WO-FORK1-0002. Its first step is on the same mould, but it is only planned. +Back at the mould, the Against list holds one order: WO-FORK1-0001. The planned order is not there to book against. +Nor is any order of another line. An operator can only book to work released to this machine. +And what it does not refuse. Type five thousand good: more forks than this mould has made since the plant started. +Booked. The station took the figure as typed. Nothing on the screen says the counter disagrees. +The queue now says the mould has made thousands more than its counter saw. A typed booking is added to the count; it is not checked against it. +So a typed figure is the operator's word. The audit trail says who typed it, and the counter's own shots stay counted beside it. +That is the station screen: one machine, read top to bottom, and the work done at it written down. You now know how to do three things. diff --git a/tests/test_a_scene_keeps_what_it_points_at_and_presses_out_of_the_avatars_corner.py b/tests/test_a_scene_keeps_what_it_points_at_and_presses_out_of_the_avatars_corner.py new file mode 100644 index 00000000..cf695853 --- /dev/null +++ b/tests/test_a_scene_keeps_what_it_points_at_and_presses_out_of_the_avatars_corner.py @@ -0,0 +1,120 @@ +"""What a scene points at or presses is kept out of the avatar's corner, and a take that cannot keep it out fails. + +Studio draws its narrator over the bottom-right of every frame, 240 by 200 +pixels. Once the station screen is scrolled, its right-hand cards (the +queue, Issue material) sit in that corner, and a box drawn round them, or a +cursor pressing Issue, would be under the narrator. The recorder already +lifts a thing out from under the caption bar before it boxes or presses it; +it now lifts a thing that reaches into the avatar's columns above the +avatar's corner, and a box or a press that still lands there fails the take, +as a caption in the corner always has. This drives the runner's own stage in +Chromium against pages of that shape; no plant is needed. +""" + +from __future__ import annotations + +import importlib.util +from pathlib import Path + +import pytest + +pytestmark = [pytest.mark.slow, pytest.mark.browser] + +REPO = Path(__file__).resolve().parents[1] +RUNNER = REPO / "scripts" / "record-scene.py" + +VIEWPORT = {"width": 1280, "height": 720} +ORIGIN = "http://scene.test/" + +# Two cards side by side, as the station screen lays them out, the pair from +# y 520 to 560: across the avatar's corner's top edge, above the caption bar's lift. +CARDS = ( + "
the top of the page
" + "
" + "
Book output
" + "
" + "
the rest of the page
" +) + +# A button pinned to the bottom-right: nothing can scroll it out of the corner. +PINNED = ( + "" + "" +) + + +@pytest.fixture(scope="module") +def runner(): + spec = importlib.util.spec_from_file_location("record_scene_avatars_corner", RUNNER) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +def a_page(pw, runner, body: str): + browser = pw.chromium.launch() + page = browser.new_page(viewport=VIEWPORT) + page.add_init_script(runner.overlay_script("pre-alpha · simulated plant · vtest")) + page.route(ORIGIN, lambda route: route.fulfill(status=200, content_type="text/html", body=body)) + page.goto(ORIGIN, wait_until="load") + return browser, page + + +def bottom_of(page, selector: str) -> float: + box = page.locator(selector).bounding_box() + return box["y"] + box["height"] + + +def test_a_card_on_the_right_below_the_corners_top_is_lifted_above_it_with_room_for_the_box(runner, tmp_path): + from playwright.sync_api import sync_playwright + + corner_top = VIEWPORT["height"] - runner.AVATAR_HEIGHT + with sync_playwright() as pw: + browser, page = a_page(pw, runner, CARDS) + assert bottom_of(page, "#right") > corner_top + + runner.BrowserStage(page, tmp_path, 0.0).clear_of_caption("#right") + + assert bottom_of(page, "#right") + runner.CALLOUT_PAD <= corner_top + browser.close() + + +def test_a_card_on_the_left_at_the_same_height_is_left_where_it_is(runner, tmp_path): + from playwright.sync_api import sync_playwright + + with sync_playwright() as pw: + browser, page = a_page(pw, runner, CARDS) + before = page.locator("#left").bounding_box() + + runner.BrowserStage(page, tmp_path, 0.0).clear_of_caption("#left") + + assert page.locator("#left").bounding_box() == before + assert page.evaluate("Math.round(window.scrollY)") == 0 + browser.close() + + +def test_a_press_that_can_only_land_in_the_corner_is_written_down_and_fails_the_take(runner, tmp_path): + from playwright.sync_api import sync_playwright + + with sync_playwright() as pw: + browser, page = a_page(pw, runner, PINNED) + stage = runner.BrowserStage(page, tmp_path, 0.0) + + stage.point_at(page.locator("#pinned")) + + assert len(stage.corner_faults) == 1 and "lands at" in stage.corner_faults[0] + browser.close() + + +def test_a_box_drawn_into_the_corner_is_found_by_the_corner_check(runner, tmp_path): + from playwright.sync_api import sync_playwright + + with sync_playwright() as pw: + browser, page = a_page(pw, runner, PINNED) + stage = runner.BrowserStage(page, tmp_path, 0.0) + + page.evaluate("window.__sceneCallout(document.getElementById('pinned'), '', 'box')") + stage.check_corner() + + assert [fault for fault in stage.corner_faults if "#fs-scene-callout reaches" in fault] + browser.close() diff --git a/tests/test_class_2_1_reads_one_machine_on_its_station_screen_and_books_only_released_work.py b/tests/test_class_2_1_reads_one_machine_on_its_station_screen_and_books_only_released_work.py index 22ae62af..cf88b478 100644 --- a/tests/test_class_2_1_reads_one_machine_on_its_station_screen_and_books_only_released_work.py +++ b/tests/test_class_2_1_reads_one_machine_on_its_station_screen_and_books_only_released_work.py @@ -11,6 +11,11 @@ class (station, queue, book, issue), and the fork mould's station screen read the scene says so rather than inventing a refusal). This file holds the scene file to what the outline asks of it. No plant and no browser: the scene is loaded and walked the way the recorder walks it. + +The second filming (Scott, 2026-11-15: "Just the screen doesn't explain +anything") keeps every caption studio voiced, word for word, and adds a box +round what each line on the screen is about, and reaches the station and the +Orders page by the menus instead of by address. """ from __future__ import annotations @@ -19,7 +24,7 @@ class (station, queue, book, issue), and the fork mould's station screen read import json import re from pathlib import Path -from urllib.parse import parse_qs, urlparse +from urllib.parse import urlparse import pytest @@ -30,6 +35,15 @@ class (station, queue, book, issue), and the fork mould's station screen read SCENE = REPO / "scripts" / "scenes" / "course" / "03-01-the-station-screen.toml" PACK = REPO / "labs" / "cutlery" / "masterdata" MACHINE = "FORK1_Mold" +# The caption lines of the take studio voiced, as that take's script file +# wrote them: the second filming says exactly these, in this order. +VOICED = REPO / "tests" / "fixtures" / "course" / "class-2-1-voiced-script.txt" +# The one line on the screen that is about nothing drawn there: the audit trail +# it names is not on the station screen. +POINTS_AT_NOTHING_ON_SCREEN = { + "So a typed figure is the operator's word. The audit trail says who typed it," + " and the counter's own shots stay counted beside it." +} # The lab fleet, the public demo and the stock demo ports: a class is never # filmed on a plant somebody else is looking at. @@ -67,6 +81,8 @@ def everything_written(scene: dict) -> list[str]: for step in scene["step"]: if step["do"] == "say": written.append(step["line"]) + if step.get("label"): + written.append(step["label"]) if step["do"] == "slide": written += [step["title"], *step["lines"]] if step["do"] == "fill": @@ -95,7 +111,8 @@ def test_the_scene_is_a_full_take_of_class_2_1_named_by_its_label_that_runs_four assert (scene["width"], scene["height"]) == (1280, 720) planned = runner.planned_seconds(scene) # Page loads and waits add to the plan; the finished take is measured. - assert 240 <= planned <= scene["budget_seconds"] <= 360, planned + # Half a minute over the first filming's six, for the clicked path, and no more. + assert 240 <= planned <= scene["budget_seconds"] <= 390, planned print(f"planned {planned} s against a {scene['budget_seconds']} s budget") @@ -133,10 +150,52 @@ def test_the_idea_card_names_station_queue_book_and_issue(scene): def test_the_screen_is_the_fork_moulds_station_and_its_machine_is_the_first_step_of_the_fork_line(scene): first = min(fork_routing()["operations"], key=lambda op: op["seq"])["equipment"] - stations = [urlparse(step["url"]) for step in scene["step"] if step["do"] == "goto" and "/station" in step["url"]] assert first == MACHINE - assert stations and all(parse_qs(url.query)["m"] == [MACHINE] for url in stations) + assert chosen_in(scene, "screen", "#machine") == [MACHINE] + + +def test_the_only_page_opened_by_address_is_the_floor_and_the_station_and_orders_are_reached_by_their_menus(scene): + pages = [step for step in scene["step"] if step["do"] == "goto"] + clicked = [step["selector"] for step in scene["step"] if step["do"] == "click"] + screen = steps_of(scene, "screen") + + assert [urlparse(step["url"]).path for step in pages] == ["/dashboard"] + assert pages[0] is screen[0] + # Floor's Station chip, then the machine chooser, before anything is read. + assert [step["do"] for step in screen[:4]] == ["goto", "click", "wait_for", "choose"] + assert screen[1]["selector"] == 'nav.subnav a:text-is("Station")' + assert clicked.count('header nav a:text-is("Orders")') == 1 + # Back from the Orders page the same way: the Floor menu, then Station. + back = clicked.index('header nav a:text-is("Floor")') + assert clicked[back + 1] == 'nav.subnav a:text-is("Station")' + + +def test_every_caption_is_the_line_studio_voiced_word_for_word_in_the_same_order(runner, scene): + voiced = VOICED.read_text(encoding="utf-8").splitlines() + + assert len(voiced) == 30 + assert runner.script_lines(scene) == voiced + + +def test_every_line_said_over_the_screen_points_at_what_it_is_about_and_no_line_over_a_card_does(scene): + on_screen = [s for s in scene["step"] if s["do"] == "say" and s["part"] in ("screen", "refuses")] + on_cards = [s for s in scene["step"] if s["do"] == "say" and s["part"] not in ("screen", "refuses")] + unpointed = [s["line"] for s in on_screen if not s.get("at") and s["line"] not in POINTS_AT_NOTHING_ON_SCREEN] + + assert unpointed == [], f"{len(unpointed)} of {len(on_screen)} lines over the screen point at nothing: {unpointed}" + assert [s["line"] for s in on_cards if s.get("at")] == [] + # A label is a few words, and the dimmed spotlight is kept for the two refusals. + assert all(len(s["label"].split()) <= 3 for s in on_screen if s.get("label")) + spotlit = [s for s in on_screen if s.get("style") == "spotlight"] + assert len(spotlit) == 2 and all(s["part"] == "refuses" for s in spotlit) + + +def test_what_is_typed_is_typed_at_the_default_pace_and_the_long_lot_is_chosen(runner, scene): + assert scene["type_delay_seconds"] == runner.TYPE_DELAY_SECONDS + assert chosen_in(scene, "screen", "#issue-lot") == ["LOT-PP-FORK1-001"] + typed = [step["text"] for step in scene["step"] if step["do"] == "fill"] + assert typed == ["500", "3", "2", "165.1", "WO-FORK1-0002", "5000"] def test_it_reads_the_cards_top_to_bottom_state_queue_book_issue_quality_maintenance(scene): @@ -193,7 +252,7 @@ def test_what_it_refuses_is_a_planned_order_which_the_against_list_does_not_offe said = " ".join(step["line"] for step in refuses if step["do"] == "say") assert not planned["release"] and planned["line"] == "FORK1LINE" - assert "'planned'" in next(step["js"] for step in refuses if "WO-FORK1-0002" in step.get("js", "")) + assert "'planned'" in next(step["js"] for step in refuses if "#d-status" in step.get("js", "")) # Back at the mould, the list is checked to hold the released order alone. assert any("#book-order option" in step.get("js", "") for step in refuses) assert "not there to book against" in said @@ -208,7 +267,7 @@ def test_a_figure_the_counter_contradicts_is_filmed_as_taken_and_owned_up_to_not said = " ".join(step["line"] for step in refuses if step["do"] == "say") # The take checks the mould's count is short of the figure before typing it. - fill = next(i for i, step in enumerate(refuses) if step["do"] == "fill") + fill = next(i for i, step in enumerate(refuses) if step["do"] == "fill" and step["selector"] == "#book-good") assert any(f"< {typed}" in step.get("js", "") for step in refuses[:fill]) assert "took the figure as typed" in said assert "does not refuse a Good figure the machine's own counter contradicts" in honesty @@ -268,8 +327,10 @@ def test_the_counter_the_absent_order_the_floor_switch_the_lot_list_and_the_repl def test_no_screen_of_people_is_filmed_and_admin_is_not_opened(scene): urls = [step["url"] for step in scene["step"] if step["do"] == "goto"] + clicked = " ".join(step["selector"] for step in scene["step"] if step["do"] == "click") assert not [url for url in urls if "people" in url or "/admin" in url] + assert "Setup" not in clicked and "Admin" not in clicked def test_the_recorder_plays_every_step_of_it(runner, scene): @@ -277,7 +338,7 @@ def test_the_recorder_plays_every_step_of_it(runner, scene): class Stage: def __getattr__(self, verb): - return lambda *args: handed.append(verb) + return lambda *args, **pointer: handed.append(verb) runner.play(scene, Stage())