I would like to write a behavior-driven test to test the following:
- User enters a record in a particular way (e.g., using VFPageOne).
- User searches for that record in a particular way (e.g., using VFPageTwo).
- Assert that the record is returned.
My only problem is that VFPageTwo uses SOSL to query. Currently, SOSL queries have to be pre-populated in unit tests (see https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_SOSL.htm). However, I am trying to test that VFPageOne and VFPageTwo play nicely together - that is, the way I enter data on VFPageOne should create a record that's findable on VFPageTwo. Since the SOSL query is part of my test,
doesn't really help.
I propose a new method,
which triggers a SOSL indexing (or waits for a SOSL indexing) of the test data, so we can accurately test a user flow like above.