Skip to content

Instantly share code, notes, and snippets.

@joegaudet
Created February 3, 2025 16:54
Show Gist options
  • Save joegaudet/4d7e12e5725b8af63c0735f831cd3a6c to your computer and use it in GitHub Desktop.
Save joegaudet/4d7e12e5725b8af63c0735f831cd3a6c to your computer and use it in GitHub Desktop.
class FormFixture extends Fixture {
@element submitButton;
submit() {
this.submitButton.click();
}
}
class FooFixture extends FormFixture {
constructor() {
super('data-test-root');
}
@element emailField;
@element commitButton;
@element label;
async enterEmail(email) {
await this.emailField.fillIn(email);
return this.commitButton.click();
}
}
const fixture = new FooFixture();
describe("foo form', function() {
// embjs front matter
it('renders', function() {
fixture.should.be.rendered
});
it('submits the form', function() {
fixture.enterEmail('[email protected]');
fxiture.submit();
label.should.haveText('Success');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment