Gravitational Test beyond the First Post-Newtonian Order with the Shadow of the M87 Black Hole