fraz3alpha / running-challenges

An extension to allow you to complete challenges with your parkrun results
Other
36 stars 20 forks source link

The tests don't work because parkrun is blocking our automation #333

Closed fraz3alpha closed 1 year ago

fraz3alpha commented 2 years ago

I guess it was probably inevitable, the parkrun website blocks our automated tests through Selenium via Github Actions

screenshot-main

It does work just fine on my laptop, so I suspect it's a source IP thing, unless somehow the user-agent is showing up as something different when run from within the Github Actions environment

I've spent so long trying to get the tests to work, they've caught up with us!

I suspect it might be an AWS WAF: https://medium.com/webstep/lets-confirm-you-are-human-5c3341012187 , in which case, I don't think there is a lot I can do because they probably have a lot of traffic coming from Github IPs and they are known to be automation, and are triggering the human test regardless of the amount of traffic.

rboyatt commented 2 years ago

Ah, that's a bit of a shame. I was hoping you might solve that but at least it's an explanation! At least it's possible to run locally, I guess.

fraz3alpha commented 2 years ago

I'm trying to host a set of static pages from the repository that I've pulled down myself, and making them available via an nginx container - limited success so far, I'm being thwarted by the use of HTTPS requests, but maybe I'll work something out.

On Thu, 19 May 2022, 22:20 Russell Boyatt, @.***> wrote:

Ah, that's a bit of a shame. I was hoping you might solve that but at least it's an explanation! At least it's possible to run locally, I guess.

— Reply to this email directly, view it on GitHub https://github.com/fraz3alpha/running-challenges/issues/333#issuecomment-1132217858, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVIFWYH76WFTLS7IFJTMZTVK2WB7ANCNFSM5WNLAGPA . You are receiving this because you authored the thread.Message ID: @.***>

fraz3alpha commented 2 years ago

One thing that has become apparent is that the error messages that get printed to the page aren't good enough to debug it when you don't have the developer console available! The 'ol Error: Object message isn't useful. I think the next bit I have to solve is that I was getting away with hosting the parkrun page under http (because I could change it in the test), but the volunteer data is always (sensibly) fetched from Https, as per good practice, so now I'm back to needing to work around that.

fraz3alpha commented 2 years ago

Good news, I think I've got something that might be working - it's hosting a copy of the page I've pulled down myself, and committed to the repo. It generates a certificate as part of the action, and then the test ignores the fact that cert isn't signed by a CA.

Currently it's testing the UK site and the German site - UK one works, German one doesn't because the extension is a little broken in this branch

screenshot-main

Well, it's not perfect, but it does seem to be showing promise

Edit: Oh wait, no I'm wrong, the German one works properly, it's the UK one that was giving errors for some reason

screenshot-main

rboyatt commented 2 years ago

Neat, that sounds great. What errors are you hitting on the UK site?

fraz3alpha commented 2 years ago

It turns out that the UK parkrun site tests worked fine when I re-ran it, so perhaps we are on to a winner here after all: https://github.com/fraz3alpha/running-challenges/actions/runs/2360821943

fraz3alpha commented 2 years ago

OK, I've merged my first PR to get things working, it'll run the parkrun.org.uk and parkrun.com.de tests.

I think in order to fully insulate ourselves from the vagaries of the parkrun website not working at various points, and the tests being flaky, we should keep a mock copy of all the pages, and have to periodically manually update them until we can work on something that checks the differences between our test pages, and what is live on the parkrun website. This does unfortunately mean that we aren't testing to check if the extension works with the current parkrun site, but we are at least testing the extensions isn't completely broken before we publish it.

fraz3alpha commented 1 year ago

Implemented some testing in https://github.com/fraz3alpha/running-challenges/pull/379