In this test, the user logs into Wix through SSO using a previously saved cookie and loads a website that is under development. The user then goes to a Twitter tweet, copies the embed code, saves it to the page under development, and opens Wix preview mode, where the test asserts that the view with the embedded tweet matches a previously taken snapshot. To demonstrate the same test failing, we change the assertion to compare the preview mode with the editor mode.
Since the content and structure of third-party embeds has the possibility of changing without warning (see: X neé Twitter), we’ve found that relying on the DOM to locate page elements is less effective than visual diffing. Visual assertions, which are built into our test framework, allow us to compare the actual result with a previously captured “known good” snapshot and easily figure out what’s happening on the page should we run into failures.
Selenium-based frameworks restrict the number of domains that can be used in a given test due to the Same-origin policy. Using Playwright instead for the QA Wolf platform lets us avoid brittle workarounds when attempting to run tests that use more than a single domain.