chromium-bidi icon indicating copy to clipboard operation
chromium-bidi copied to clipboard

Should we author e2e tests in a forward-compatible manner?

Open OrKoN opened this issue 1 year ago • 4 comments

For example, adding new attributes to local end structures is not a breaking changes in the spec but it will be a breaking change for e2e (and maybe for some wpt) tests that use assert === to check the entire structure shape. I believe we should treat all local end structs as extensible in our tests to avoid modifying all tests when there is a new attribute added.

cc @sadym-chromium

OrKoN avatar Jan 19 '24 07:01 OrKoN

Historically, the strict assertions were done in order to be aware of any protocol changes. This was reasonable when the amount of e2e tests was relatively low and the protocol was changing quite quick.

The proposed transition allowing for flexibility in adding fields in the responses without causing test failures. However, this shift introduces the possibility of introducing new fields without explicit awareness. A significant concern is that developers often rely on tests rather than directly examining the raw protocol.

Having said that, in my experience I don't recall this was a problem, so I'm fine if we change protocol assertions from == to <=, if that reduces friction with an acceptable level of risks.

sadym-chromium avatar Jan 19 '24 08:01 sadym-chromium

How does <= work?

OrKoN avatar Jan 19 '24 08:01 OrKoN

Note that there is a mechanism for <= assertion in place, but it is not very ergonomic.

To increase usability, we can consider introducing something like recursive_compare.

sadym-chromium avatar Jan 19 '24 08:01 sadym-chromium

In "<=" I mean "is sub-dictionary" comparison. It is already implemented in 2 ways:

sadym-chromium avatar Jan 19 '24 08:01 sadym-chromium