I was told it might be the fuel cap or a hose thats leaking so I bought a fuel cap. How long would I know if the fuel cap was the problem or go to the next thing. FYI I‘m trying the cheaper fixes first.
Take it to Advance Auto where they will can your car for free. The check engine light is an indication that diagnostic system in your car has recognized a possible problem and has triggered a diagnostic trouble code (DTC). Advance Auto should scan these DTC codes for free if your car is newer than 1995. Once they scan it, then you may be able to stop guessing. By the way, the gas cap thing is often over reported as a problem. Some of the newer cars with highly pressurized fuel systems can be affected if the gas cap is loose and therefore may trigger a trouble code. Sometimes it's just wishful thinking that the problem is as simple as a gas cap. but every once in a while it is the gas cap.
Put a sticker over the light then you'll be ok
You may need to have the computer reset and then see if the light comes on again. If you bought the cap at advance or autozone get them to reset the computer for free.