Closed pgonzaleznetwork closed 6 years ago
If I understand correctly you installed the LTS package into an org and then also created an additional static resource that contains your test. Are you using sfdx or working in an org directly? In either case you don’t really have to zip the resource so not sure about that. As you are using LTS with examples, once you have an additional test spec file, edit jasmineTests.app to pull in your additional test spec file (at that point you can stop the samples to be pulled in also if you want).
Thank you. Yes, that's exactly it.
I got this to work by:
1- uploading the suite as a js file 2- Adding the suite name under jasmineTests.app as follows
So, is this the flow that one is expected to follow? From the documentation, it's not clear to me how you can easily upload new tests and run them. It would be counter productive if I need to be editing this file all the time, or creating my own. Can you point me in the right direction?
SFDX workflow would be,
sfdx force:org:create -s -f config/project-scratch-def.json -a scratch1
sfdx force:lightning:test:install -t jasmine
sfdx force:source:push
sfdx force:lightning:test:run -a <MY_TEST_APP>.app
Thank you very much. Just some feedback: The documentation is not clear on this flow, like I said, it only says that you should upload the suites as static resources and then run them, it doesn't say that you need to create your own wrapper application and somehow pass a list of test files to use at run time...if this is indeed documented please let me know.
Last question, as it's related to the same topic, do you have an example of the 4th step on your comment above?
_In your sfdx project, create one or more test wrapper applications that use ltsjasmineRunner and provide a list of test files to it.
Assuming I'm using the sample, out of the box application, jasmineTests.app which is a wrapper of lts_jasmineRunner , how would I specify a list of files to test using the SFDX CLI, or do I need to go in an manually edit the source code and specify the files?
Thanks again for your help, much appreciated.
As you pointed out jasmineTests.app
would be an example. If you add new resources you would need to update it. Alternatively you could use something like gulp or a wrapper build script to add more magic if you prefer.
This is similar to what you do when using jasmine/mocha to test standalone projects. For example look inside (SpecRunner.html) the bundle at https://github.com/jasmine/jasmine/releases/tag/v2.8.0
Got it, thank you very much!
@esalman-sfdc Updating this just in case anyone is reading this. I managed to do what you suggested with gulp, for example
gulp.task('Assemble-LTS-Specs',function(){ return gulp.src('src/*.js') .pipe(concat('LightningComponentsTest.js')) .pipe(gulp.dest('output')) });
Upload the output file (LightningComponentsTest.js) as a static resource.
This file would be the only one referenced in jasmineTests.app
<c:lts_jasmineRunner testFiles="{!join(',', $Resource.LightningComponentsTests )}" />
Thank you very much for your help on this.
Hi there,
I'm having trouble getting a new suite to be recognised. Steps
describe("Lightning Component Testing Examples", function(){ afterEach(function() { // Each spec (test) renders its components into the same div, // so we need to clear that div out at the end of each spec. $T.clearRenderedTestComponents(); });
});
The documentation doesn't say anything more than "uploaded the suite as a static resource", which I've done as per the above steps. The syntax appears to be correct and I'm not getting any errors or warnings.
Is there anything I need to do for this suite to be tested?