Skip to content

Instantly share code, notes, and snippets.

@matsub
Created December 28, 2018 06:08
Show Gist options
  • Save matsub/c56b39779974db3a25058d8c13eea2b3 to your computer and use it in GitHub Desktop.
Save matsub/c56b39779974db3a25058d8c13eea2b3 to your computer and use it in GitHub Desktop.
testcafeがLoose equalityをstrict equalityとして評価しているように見える
import { Selector } from 'testcafe'
fixture `Loose Equality`
.page `http://localhost:8000/`
test('Say Hello', async t => {
const btn = Selector("button")
await t.click(btn)
// assertion
const p = Selector("p")
await t.expect(p.textContent).contains("hello", "yay, hello")
})
<button>yabai</button>
<script>
document.querySelector("button").addEventListener('click', e => {
if (1 == '1') {
const elm = document.createElement("p")
elm.textContent = "hello"
document.body.appendChild(elm)
} else {
throw new Error("You're an idiot.")
}
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment