Using TestBox with an integration test with Wirebox (Livewire)

Can one do a get() or post() to a wirebox wire?

var event = this.post(“livewire/messages/wire.updateProfileModal”, {name=“Pete”, lastName=“Nelson”}); for example.

Can that be done. It runs without error and the event.getResponse().getStatusCode() returns a 200, however none of the profile data was updated. This leads me to believe that nothing actually happened.

I assume that anything ran in the textbox virtual environment would actually update a database record?

Yes, it should be a full integration test, so everything should work as normal. Can you post your code so we can assist. Also is this using cbwire? @gcopley

@lmajano Yes, that is a CBWIRE endpoint.

We have a section in the CBWIRE docs on testing. Have you tried any of those yet @webguy?

Thanks for the guidance!

No, I was unaware that a testing section was present on the CBWIRE docs. I took a look just now. It appears that this would require a separate CFC in the integration directory that mirrors the sample one except that it would extend cbwire.models.BaseWireTest vs. coldbox.system.testing.BaseTestCase?

@webguy That’s correct. Please let me know if you run into any issues.

@gcopley I’m having some difficulty.

I was originally not placing a valid value in the .see part and got this message:

The needle [SUCCESS101] was not found in [

Email Address
Submit
]

I did have one question from the output:

http:///root/login/D8A5FF89-9E0B-4A47-BC62-87FDEC2A2167/0

I’m confused: I don’t have a url or anything that I know of that places “root” into the url. Root should not be in the URL and I’ve not been able to decipher why it is put in. I don’t have much experience with CBWire/Livewire.

I want to test the wire on: https://testing.expologic.com/registration/v2/forgot/D8A5FF89-9E0B-4A47-BC62-87FDEC2A2167/0

I have:
wire( “forgotLogin” )
// Sets our data properties
.data( {event_key = ‘D8A5FF89-9E0B-4A47-BC62-87FDEC2A2167’, email = ‘robert.bryant@communitybrands.com’} )
// Verifies output in our template rendering
.see( “Email Address” )
// Runs the ‘clearTasks’ action
.call( “retrieveAccount” )
// Verifies updated template rendering
.dontSee( “An email with login details have been submitted” );
} );

I get in response from the testing harness: Value must be initialized before use.Its possible that a method called on a Java object created by CreateObject returned null.

Do I need to “pull up” so the forgot login page and then have the wire () part? Or is my approach above correct?

Thank you for your assistance.