How to replace website?

You can install the All-in-One WP Migration to make a backup of the new test site. Then install the plugin in your old site as well and upload the backup there.
Then update the permalinks and change Site URL in Setting > General if needed.

Here’s the URL for the Plugin: https://wordpress.org/plugins/all-in-one-wp-migration/