Nightwatch has its own little semantic world. It’s a world that, while not “on fleek”, makes a lot of sense to me. In a teamgramming context I add a gang of comments if introducing new tech or use thereof. In introducing a new type of UI test to a project at Netflix, I decided to explain some of the Nightwatch parlance. I’ve transposed some of that here for y’all.
Elements start with an
@ and allow you to have improved semantics within a Nightwatch test context. CSS selectors are typical either more verbose or more terse than elements in Nightwatch parlance.
Commands give you the ability to extend the Nightwatch API w/ your own methods.
Tags allow you to flexibly group your tests according to your own organization principles, allowing you to execute subsets of all tests.
Within a spec it looks like this:
An example of leveraging this in concert w/ NPM scripts: