There's a difference between sea trials and shakedown cruises.
With carriers, there are 2 sea trials, a builder's trial and an acceptance trial. The builder's trial, conducted mostly by the builder, Northrop Grumman Newport News, is first to demonstrate the ship is to specs. The acceptance trial is conducted by the US Navy's INSERVE unit. When the carrier passes INSERVE, a small delivery ceremony is held.
The ship is then commissioned into the fleet and begins a series of shakedown cruises. The flight deck is certified and flight ops begin. Crew training is stepped up to at sea conditions. After about 4-6 months of this, the carrier returns to the builder for a Post Shake-down Availability, sort of a warranty check. Anything needing repaired, adjusted, etc. is done. In addition, any new gear that couldn't be installed during the construction can be installed during the PSA.
The carrier will go through many modification and maintance periods during its service life. The Nimitz class get refueled and a complex overhaul after 25 years. The Nimitz finshed hers, The Eisenhower is currently undergoing its RCOH.
Mike