-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't make it run in iteration (retry) #18
Comments
Hey @arielmoatti - I've decided that this code is no longer encompasses retry logic. The idea with that is that I'm not opinionated about orchestration of the code. It just does the thing when asked. That being said, to get the functionality you're seeking: add this snippet to /tests/appointment.test.js before the test definition test.beforeEach(async ({}, testInfo) => {
if (testInfo.retry > 0) {
const waitSeconds = parseInt(process.env.RETRY_WAIT_SECONDS || "60");
logger.info(`Waiting ${waitSeconds} seconds then retrying ...`);
await sleep(waitSeconds * 1000);
}
});
test.afterEach(async ({ context }, testInfo) => {
await context.close()
if (testInfo.status !== testInfo.expectedStatus) {
logger.warn(`Appointment booking failed: ${testInfo.error.message}`);
if (testInfo.error.message === "Rate limit exceeded") {
const waitSeconds = parseInt(process.env.RETRY_WAIT_SECONDS_BLOCKED || "600");
logger.info(`Waiting ${waitSeconds} seconds because we were rate limited ...`);
await sleep(waitSeconds * 1000);
}
}
});
function sleep(ms = 120000) {
return new Promise((resolve) => setTimeout(resolve, ms));
} You can then play with Let me know if that works for you. EDIT: Don't forget about defining the |
Thanks, Daniel! ok, I've added this snippet, still nothing. Then I added the line: I was really hoping that this app would do the trick, but the situation in their system is so lousy, there must be another way for me to get a Termin... |
It's normal to wait a long time at night or on weekends for an appointment to open up. Mornings around 9-11 AM and evenings 5-7 PM are usually best. Let it run and increase
We're competing with a lot of other bots. I even heard that there are shady folks selling appointments for cash. btw with your driver's license appointment, make sure to show the bureaucrat your supporting docs (like when you got the license & driving record) even if they don't ask. They forgot to ask me when I went, and then I got a letter months late that I had to go again to show them the docs I had brought to the original meeting in the first place. |
Thanks again for those ideas! As for the license, thanks for the tips! Yes, I'll have everything at hand. Moreover, my ideal Termin would be to have both (Anmeldung & Umschreibung) in the same day, in the same place, and in sequential order, so I can get rid of these two in 1 hour (!) - until today, my only luck was to open two browsers in incognito and do that... now, even this fails. |
Could you share your playwright.config.js file (please remove secret values)? Did you set PROXY_URL? Would you share your logs?
Yes. Exactly as it appears at https://service.berlin.de/dienstleistungen/.
I would get the first appointment and then use env vars to limit the time, date & place of the second appointment ... but maybe there is something more clever. Let me think. |
Thanks. I sent you my PROXY_URL setting privately per email. That's a tought mission. |
Are you suggesting that the calendar appointments are universal? My belief is that appointments are made available per service. So the calendars are not the same between services. Maybe what you're suggesting is true or partially true. We'd need to do some research unless you can definitely say. Perhaps appointment slot batches are made available at the same time for every calendar. Maybe they release similar dates/times per service to each individual calendar. We could leverage that. My belief is that when you cancel an appointment it is made available in the calendar for the appointment service you booked. We definitely see instances of single appointments being available often enough that this should be true (releasing individual appointments via a manual mechanism would not scale). Any thoughts @arielmoatti ? |
Yes, I'm sure. At least for those two I mentioned. A friend of mine tried it for himself with two browser windows (incognito or different user profile, since the system is cookie based) and requested these two different Termins, he found a day in March, one slot at 11:00 and the second at 12:00. He booked them and he's done! So envy... I couldn't replicate this... I usually never see a calendar at all (and wait 1:00 minute), and when a miracle happens, and I go for the one available day - it then shows me an empty page (no Amt nor time slots). That's why I'm counting on a bot, to do that tidious job for me... |
OK so this thread has gotten a bit off topic. @arielmoatti I think we solved the retry issue. If you continue to have issues, create a new one :) |
Thanks! I've update the file appointment.test.js with mailslurp API key, inbox_id, name and phone. I run it in Docker Desktop and it runs, once, with the usual "Leider sind aktuell keine Termine für ihre Auswahl verfügbar." result. But I have no idea how to make this run over and over (with the 60 seconds delay and Terminsuche wiederholen button) since "retries" field is no loger there. Even if I added it, it doesn't have a timeout, so it reached "limit" immediately.
What am I doning wrong?
The text was updated successfully, but these errors were encountered: