CDC: “Beginning December 6, all air travelers, regardless of citizenship or vaccination status, will be to be required to show a negative pre-departure COVID-19 viral test taken the day before they board their flight to the United States. For example, a passenger whose flight to the United States is at any time on a Sunday would need to have a negative test taken at any time on Saturday.”
I have confirmed with the Riviera Maya resort that the test can be taken anytime between 8 am and 4 pm the day before departure. Schedule it when you arrive.