Hi! This weeks check in may be short but interesting. Firstly, I was given great news: I passed the first evaluation 😃. Now, the second period begins, and I plan to keep my good workflow ongoing.
What did I do this week?
I focused on my third milestone. I made two challenges for the course. The first one is a called Hangman challenge, and it is about creating a hangman game. The hard thing was coding its web test. I'll explain this later. The second challenge is called Pergamino challenge, and it is about deciphering a parchment with Python code. This was very straightforward, even its web test.
Did I get stuck anywhere?
Yes. The playwright test for the hangman challenge was tricky. Interacting with the exercises of this challenge meant dealing with several dialog prompts. I already knew how to accept one dialog prompt:
page.on("dialog", lambda dialog: dialog.accept("sth"))
But I had trouble when more than one needed to be handled in the same test. By looking at playwrights documentation I found a solution. First, expect for the dialog event to appear on screen. Then, accept that single dialog once. This, translated to code, is:
with page.expect_event("dialog") as prompt1:
page.once("dialog", lambda dialog: dialog.accept("sth"))
with page.expect_event("dialog") as prompt2:
page.once("dialog", lambda dialog: dialog.accept("sth"))
What is coming up next?
I made two PRs this week. Both are regarding the new challenges. They are still awaiting review. So this week I will tackle the review suggestions, and will review my peers PRs.
Top comments (0)