Try that with battery by itself. See if you can reproduce that issue. Then remove the battery and use AC power alone. See if you can reproduce this issue. If it happens on one or the other, replace the offending item. If it happens on both, send the notebook in for service with AC and battery. (Most likely it is internal!)
Remember, you must test with just AC alone and battery alone in order to eliminate the possibility of an easy fix vs. serious repairs.
HP Pavilion all-in-one: AMD A6-7410, 8GB RAM, 1TB HDD, 23" IPS Touch screen, Windows 10 64-bit