@@ -59,25 +59,29 @@ def test_main_navigation_returns_home_from_problem(self):
5959 expect (home ).to_have_attribute ('aria-current' , 'page' )
6060 expect (self .page .locator ('main .hero' )).to_be_visible ()
6161
62- def test_open_questions_has_its_own_navigation_tab (self ):
62+ def test_home_navigation_opens_question_board (self ):
6363 self .visit ()
6464 tab = self .page .get_by_role ('navigation' , name = 'Main navigation' ).get_by_role ('link' , name = 'Open questions' , exact = True )
6565 tab .click ()
66- expect (tab ).to_have_attribute ('aria-current' , 'page' )
67- self .assertEqual (tab .locator ('xpath=following-sibling::a' ).count (), 0 )
68- expect (tab .locator ('span' )).to_have_text ('↗' )
69- expect (self .page .get_by_role ('heading' , name = 'Open questions' , exact = True )).to_be_visible ()
70- expect (self .page .locator ('main' )).to_contain_text ('To be released.' )
71- self .page .goto (self .base + 'introduction.html' )
72- expect (self .page .locator ('.sidebar' )).not_to_contain_text ('Open questions' )
73- expect (self .page .locator ('.sidebar' ).get_by_text ('Research' , exact = True )).to_have_count (0 )
66+ expect (self .page ).to_have_url (self .base + 'open-questions/' )
67+ expect (self .page .get_by_role ('heading' , name = 'Open Question Zoo' , exact = True )).to_be_visible ()
68+ self .page .get_by_role ('link' , name = 'All questions' , exact = False ).click ()
69+ self .page .get_by_role ('searchbox' , name = 'Search the collection' ).fill ('Q001' )
70+ expect (self .page .locator ('.question-item:visible' )).to_have_count (1 )
71+ expect (self .page .locator ('.question-item:visible .question-id' )).to_have_text ('Q001' )
72+ self .page .locator ('.question-item:visible .question-link' ).click ()
73+ self .page .get_by_role ('link' , name = 'Submit a solution' , exact = True ).click ()
74+ expect (self .page .get_by_label ('Registry entry' , exact = True )).to_have_value ('Q001' )
75+ registry = self .page .request .get (self .base + 'open-questions/registry.json' ).json ()
76+ question = next (entry for entry in registry ['questions' ] if entry ['id' ] == 'Q001' )
77+ expect (self .page .get_by_role ('link' , name = 'Edit registry entry on GitHub' )).to_have_attribute (
78+ 'href' , f"https://github.com/GiggleLiu/autoresearch-gadgets/edit/main/registry/{ question ['slug' ]} .json" )
79+
80+ def test_graph_navigation_opens_question_board (self ):
7481 self .page .goto (self .base + 'graph.html' )
75- expect (self .page .locator ("#cy canvas" ).first ).to_be_visible ()
76- tab = self .page .get_by_role ('link' , name = 'Open questions' , exact = True )
77- self .assertEqual (tab .locator ('xpath=following-sibling::a' ).count (), 0 )
78- expect (tab .locator ('span' )).to_have_text ('↗' )
79- tab .click ()
80- expect (self .page .get_by_role ('heading' , name = 'Open questions' , exact = True )).to_be_visible ()
82+ self .page .get_by_role ('link' , name = 'Open questions' , exact = True ).click ()
83+ expect (self .page ).to_have_url (self .base + 'open-questions/' )
84+ expect (self .page .get_by_role ('heading' , name = 'Open Question Zoo' , exact = True )).to_be_visible ()
8185
8286 def test_home_formulas_load_as_typeset_vectors (self ):
8387 self .visit ()
@@ -231,13 +235,13 @@ def test_only_turing_rules_have_execution_labels(self):
231235 !link.textContent.includes('Result recovery') && !link.textContent.includes('See contract'))''' ))
232236 self .visit ('reduction/MaximumIndependentSet/DecisionMaximumIndependentSet' )
233237 expect (self .page .locator ('.reading-aside .rule-kind' )).to_have_text ('Turing reduction' )
234- self .visit ('reduction/CircuitSAT/SpinGlass ' )
238+ self .visit ('reduction/CircuitSAT/DecisionSpinGlass ' )
235239 expect (self .page .locator ('.reading-aside .rule-kind' )).to_have_count (0 )
236240 expect (self .page .locator ('.reading-aside' )).not_to_contain_text ('Status' )
237241 expect (self .page .locator ('.reading-aside' )).not_to_contain_text ('Capabilities' )
238242
239243 def test_rule_parameter_upper_bounds_use_inequalities (self ):
240- self .visit ('reduction/CircuitSAT/SpinGlass ' )
244+ self .visit ('reduction/CircuitSAT/DecisionSpinGlass ' )
241245 expect (self .page .locator ('.parameter-operator' )).to_have_text (['≤' , '≤' ])
242246 expect (self .page .locator ('.parameter-relation math' )).to_have_count (2 )
243247 self .page .set_viewport_size ({'width' : 390 , 'height' : 900 })
@@ -306,8 +310,13 @@ def test_legacy_documentation_urls_redirect(self):
306310 self .page .wait_for_url (self .base + 'graph.html' )
307311 expect (self .page .locator ("#cy canvas" ).first ).to_be_visible ()
308312 self .page .goto (self .base + 'open-problems.html' )
309- self .page .wait_for_url (self .base + 'index.html#open-questions' )
310- expect (self .page .get_by_role ('heading' , name = 'Open questions' , exact = True )).to_be_visible ()
313+ self .page .wait_for_url (self .base + 'open-questions/' )
314+ expect (self .page .get_by_role ('heading' , name = 'Open Question Zoo' , exact = True )).to_be_visible ()
315+
316+ def test_legacy_open_questions_hash_opens_question_board (self ):
317+ self .visit ('open-questions' )
318+ expect (self .page ).to_have_url (self .base + 'open-questions/' )
319+ expect (self .page .get_by_role ('heading' , name = 'Open Question Zoo' , exact = True )).to_be_visible ()
311320
312321 def test_docs_sidebar_drag_resizes_content (self ):
313322 self .page .goto (self .base + 'introduction.html' )
@@ -403,18 +412,20 @@ def test_graph_is_in_primary_navigation_and_opens_details(self):
403412 """ )
404413 self .page .locator ('#graph-search' ).fill ('ILP' )
405414 self .page .locator ('#graph-search' ).press ('Enter' )
406- self .assertEqual (self .page .evaluate ("""() => {
415+ graph = self .page .request .get (self .base + 'reductions/reduction_graph.json' ).json ()
416+ expected_variants = sum (node ['name' ] == 'ILP' for node in graph ['nodes' ])
417+ self .assertEqual (self .page .evaluate ("""expectedVariants => {
407418 const cy = document.querySelector('#cy')._cyreg.cy;
408419 const parent = cy.getElementById('ILP');
409420 const box = parent.boundingBox();
410421 const neighbors = parent.children().connectedEdges().connectedNodes()
411422 .difference(parent.children());
412- if (parent.children().length !== 4 || neighbors.length <= 50) return ['Missing variants or neighbors'];
423+ if (parent.children().length !== expectedVariants || neighbors.length <= 50) return ['Missing variants or neighbors'];
413424 return neighbors.filter(node => {
414425 const {x, y} = node.position();
415426 return x >= box.x1 && x <= box.x2 && y >= box.y1 && y <= box.y2;
416427 }).map(node => node.id());
417- }""" ), [])
428+ }""" , expected_variants ), [])
418429 displaced = self .page .evaluate ("""() =>
419430 document.querySelector('#cy')._cyreg.cy.nodes()
420431 .filter(node => !node.isParent() && !node.data('isVariant'))
@@ -597,7 +608,7 @@ def test_graph_list_selection_keeps_keyboard_focus(self):
597608 self .assertEqual (self .page .evaluate ('document.activeElement.tagName' ), 'BODY' )
598609
599610 def test_atlas_ilp_prioritizes_documentation_over_metadata (self ):
600- self .visit ('problem/ILP' )
611+ self .visit ('problem/ILP?variant=bounds=general,coefficient=f64,variable=bool ' )
601612 expect (self .page .locator ('article.typst-detail' )).to_contain_text ('Lenstra' )
602613 expect (self .page .locator ('.relation-title > span' ).filter (
603614 has_text = 'Expected Retrieval Cost' )).to_have_text ('Expected Retrieval Cost →' )
0 commit comments