Custom shortcode works in Elementor editor but not on frontend

The problem is with the require_once, you are passing a relative path and that path doesn’t exist.

Assuming the test.php file you want to require is in this path

wp-content/themes/your-theme/views/test.php

You can use the following

require_once locate_template('views/test.php');

Consider using include instead of require_one, if this shortcode is not 100% necessary for your site to function, its best to use include as this way you will not receive a fatal error because that file doesn’t exist.