I am working on introducing cypress testing to my app with rescript bindings. You might be able to help just looking at the TLDR at the end
This is my current progress:
%%raw("import '@testing-library/cypress/add-commands'")
open TestRunner
@val external context : string => (unit => unit) => unit = "context"
@val external beforeEach : (unit => unit) => unit = "beforeEach"
@val external it : string => (unit => unit) => unit = "it"
context("Basic navigation demo", () => {
beforeEach(() => {
Cy.visit("http://localhost:3000")
})
it("should go to markets", () => {
Cy.RTF.findByAltText("start-trading")
})
})
Which produces the following output:
import '@testing-library/cypress/add-commands'
;
context("Basic navigation demo", (function (param) {
beforeEach(function (param) {
cy.visit("http://localhost:3000");
});
it("should go to markets", (function (param) {
cy.findByAltText("start-trading");
}));
}));
This code unfortunately creates an error, it thinks that param
is meant to be done (I tried making the library use done
but that caused other issues I won’t go into now). (see image)
Now if I manually update the javascript output and remove the param
, all the tests work fine.
Manual edits:
import '@testing-library/cypress/add-commands'
;
context("Basic navigation demo", (function (param) {
beforeEach(function () {
cy.visit("http://localhost:3000");
});
it("should go to markets", (function () {
cy.findByAltText("start-trading");
}));
}));
TLDR
How do I make these bindings make output like this (below image)? Code on left doesn’t work, code on right works - how do I make my bindings output code like on the right?