I compiled this answer and got a very different result, as shown below.
There's no compilation error, with both TeXstudio and TeXworks, just a bunch of warnings about fonts:
/usr/bin/pdflatex (file /usr/share/texlive/texmf-var/fonts/map/pdftex/updmap/pdftex.map): fontmap entry for `pagd8y' already exists, duplicates ignored
I'm on Fedora workstation and use the package manager dnf install texlive-* where * is the package name.
I do use wrapfig in other documents with tikzpicture and it works as expected.
Am I missing a package?
EDIT : On Overleaf, only the 2nd figure isn't wrapped around and the issue is solved by @DavidCarlisle answer.
EDIT 2 : the problem comes from lipsum package (version 2021-03-03 v2.3). Replacing lipsum paragraphs with text solves the issue. See the comment thread for details. Thanks to @DavidCarlisle.



\WFclearat the end of a paragraph in case wrapfig isn't quite done yet. – John Kormylo Mar 05 '22 at 17:25