Laptop not charging/ shutting down during diagnostic tests

Hey, I've been dealing with this problem for the last two weeks and have nearly exhausted every avenue of help and was wondering if anyone out there could give me any advice?

Recently I've been having charging issues with my laptop (a 4-year-old Alienware 17). I initially had a problem where I would plug the laptop in to charge and my laptop wouldn't recognise that there was a charger in the port at all (apparently this is quite common with my model of laptop but all research/solutions for this haven't worked for me). The charger works fine- I checked to see that it was the right one for my laptop etc- and I have also checked my laptop's battery health through pre-boot diagnostics just to be safe; which have all come back indicating that the laptop battery is healthy. The battery I am using in my Alienware is the original one that it came with 4 years ago so I have also considered that the battery is simply past its shelf life (I'm not sure how to check if this is the case however as pre-boot has said the battery is fine). Last week my laptop seemed to die completely (charging wasn't working at all to boot up the laptop) but after a week of leaving it alone it's finally turned back on and is holding a charge after leaving it to charge all day. The new issue, however, is that despite my laptop saying it is at 100% full charge it's only indicating that I have around 40 minutes or less of run time when unplugged, instead of its usual 3+ hours. I have previously run security checks to make sure this isn't a virus and have also tried to run diagnostic tests through Dell's official support site; these never complete however as when I try to run both the short and full diagnostic tests on the laptop the whole system always shuts down halfway through.

This whole situation has really confused me; I've spent countless hours researching on forums, trying (and failing) to contact tech support sites and being put on hold by Dell, and now I'm not sure where else I can turn. My Dell Warranty ran out over a year ago so I feel like I've exhausted all the obvious solutions. Any ideas what could be wrong with my laptop? Or any advice on ways to solve these issues?

Any advice on this would be greatly appreciated!! :)
The same idea, my friend had the also the same problem with the Lenovo laptop, tried to repair it with technicians but was not able to solve the battery problem. It is advisable to change it.