Rayrun
← Back to Discord Forum

toMatchObject return error even after I copied the key and value from terminal

So I called an API and want to verify it with toMatchObject, 39 objects passed, only this one had problems. As you can see, these strings are indentical (I did compare it on a site). I only see 1 difference is the space before key but I don't know how to correct this. Anyone experienced this can give me advices? `Error: expect(received).toMatchObject(expected)

  • Expected - 1
  • Received + 1

@@ -120,11 +120,11 @@ "target_value": "<p>translated Custom option 3 - updated to Croatian</p>", }, Object { "field_name": "Help text", "source_value": "<p>You should upload image in 500x200 pixel to get the best quality - updated</p>",

  • "target_value": "<html><head></head><body><p>translated You should upload image in 500x200 pixel to get the best quality - updated to Croatian</p></body></html>",
  • "target_value": "<html><head></head><body><p>translated You should upload image in 500x200 pixel to get the best quality - updated to Croatian</p></body></html>",`
image.png

This thread is trying to answer question "Why does toMatchObject return an error even after copying the key and value from the terminal?"

5 replies

Additional info: So I tried to verify that textbox alone using toHaveValue And sadly it's failed too maybe it's about the html, head or body tags

What if you pass in the same object to the expect and the toMatchObject? Or what if the object are actually different and the error is valid?

@dand33 I copied the received value in the terminal it still throw error. Update: even if I removed all special characters, which give me only normal text, it still wrong I can't pass this assertion. Seems like it's the locator's issue not assertion checking with the dev now

So it seems the error is valid and you need to figure out why the objects don't match..

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].