It appears the behat step "i_add_a_gallery_to_mediagallery_with" fails on the first "click_link". It can't navigate to the page. I think the workaround might be to implement the "resolve_page_instance_url" function in the behat_mod_mediagallery.php file. Moodle 4.0.3, PHP 8.0