Out of interest @limetrees32 why do you want her to have more tests? Is to treat the cancer? Do you think someone with dementia could process and cope with the level of interventions and treatments this will require? Have you considered the impact of multiple and prolonged hospital visits on the person in question?
I ask because, in my experience, dementia can get significantly worse, very quickly, when the person living with dementia has other health issues.
It is Hobson's choice here. There is no good outcome. It will be a continual review of medication, and then more medication to offset the side effects of the original meds. But regular appointments, pain relief and good care can make all the difference to someone's time left.
And one final note, the medical and care model of mental capacity is no longer a fixed entity. Many people have capacity for certain decisions in certain settings. My relative is in a dreadful state due to advanced dementia, but they can still (and do) have an active say in their finances. Health professionals are now trained to respect people's wishes as long as they are not doing themselves, or others harm. It can feel very odd from the outside, but is super important to the patient that they retain as much autonomy as possible for as long as possible.
I wish I could tell you it will be better, but there is no easy way here. You are doing your very best, and obviously love this friend dearly, but you can't take this away from them or you. I get the need to feel proactive, useful, supportive try and channel it into the things that will make the end of life easier. Hopefully your friend has a little while left, make the most of it.