Questions tagged [lightning-testing-service]

The Lightning Testing Service, or LTS, is a set of tools and services that let you create test suites for your Lightning components using standard JavaScript test frameworks, such as Jasmine and Mocha.

Filter by
Sorted by
Tagged with
1 vote
0 answers
61 views

unable to install Lightning testing service- aura

I'm reading LTS article. I was trying on install it via Salesforce dx. When I use this command as per above article: sfdx force:lightning:test:install it gives me below error : Warning: force:...
sfdc_Qrius's user avatar
1 vote
1 answer
181 views

Cannot install Lightning testing service in scratch orgs anymore

It seems starting last week or so, installing managed packages in scratch orgs require specifying security type. However, SecurityType is not a valid parameter for the LTS install command: $ sfdx ...
dzh's user avatar
  • 4,086
0 votes
0 answers
112 views

Lightning Testing service failing for apex

I am trying to mock the apex method response and trying to test attributes with the fake response.But It is failing. I am getting error message: Error:Expected 0 to be 1 Error:Expected false to be ...
Vidhyasagaran Muralidharan's user avatar
1 vote
1 answer
193 views

LTS and sfdx/developer orgs

I was reviewing the capabilities of the LTS (lightning testing service) and there is a cool sentence in the documentation: Lightning Testing Service can only run in scratch orgs, because tests can ...
lopez.regalado.fj's user avatar
2 votes
1 answer
107 views

Jasmine or Mocha wrapper in Lightning Testing Service does not provide actual code coverage. How to measure JavaScript code coverage?

I have to test JavaScript code in lightning components with % code coverage. Lightning testing service report does not include code coverage information. Is there any way to measure JavaScript code ...
Onkar Pawar's user avatar
0 votes
1 answer
286 views

Unable to execute lightning sample test for non-Chrome browser

So, I've never done this before, so I beg a pardon if the answer is quite obvious. I wanna dive into lightning testing service, but I've faced the following problem at the very beginning. So, after ...
being of habits's user avatar
5 votes
0 answers
100 views

Stub Lightning Data Service response in Lightning Test Service (Jasmine)

Using Jasmine I can simply stub response as this before $T.createComponent: $A.enqueueAction = jasmine.createSpy().and.callFake((action) => { var cb = action.getCallback("SUCCESS") cb.fn....
dzh's user avatar
  • 4,086
3 votes
1 answer
897 views

Testing Lightning component that fires event based upon a child component's `onchange` action

I'm trying to write Jasmine/LTS tests for a component that embeds a <lightning:combobox>. The method I'm attempting to test fires a component event within a controller method that is bound to ...
David Reed's user avatar
  • 92.6k
17 votes
1 answer
2k views

What do you use to automate the testing of your Lightning Components?

We've written some Lightning Testing Service tests but its been hard work given the asynchronous nature of the code and that the LockerService blocks access to the underlying DOM. I'm now wondering if ...
Keith C's user avatar
  • 136k
2 votes
1 answer
92 views

Lightning test service: test static resource code

I've moved some code to shared static resource using the approach described here. And now I wonder: is it possible to directly test this code using Lightning Test Service?
Demarsch's user avatar
  • 391
9 votes
1 answer
395 views

Does the LockerService make Selenium tests impossible?

When running Lightning Testing Service tests, the impact of the LockerService is evident such as not being able to see the DOM nodes of a lightning:... component (different namespace) wrapped by one ...
Keith C's user avatar
  • 136k
6 votes
1 answer
658 views

How to use lightning testing service without using Salesforce DX?

I am working on a salesforce managed package project which is not in DX. I want to start writing unit test cases for lightning component using lightning test service. I have gone through the github ...
user360's user avatar
  • 445
9 votes
0 answers
304 views

LTS: How to test behavior dependent on afterScriptsLoaded

I’m looking for help/examples for setting up tests of a component which calls a load() method via afterScriptsLoaded, then renders data based on the result of the load (which calls a server-side ...
Kat's user avatar
  • 91
9 votes
0 answers
387 views

Is is possible to spyOn a helper function in a Lightning Testing Service (LTS) test?

In How to mock or configure lightning:workspaceAPI in Lightning Testing Service (LTS) tests? the answer suggests using Jasmine's spyOn to call a fake function in a test and so work-around an API that ...
Keith C's user avatar
  • 136k
6 votes
1 answer
528 views

How to mock or configure lightning:workspaceAPI in Lightning Testing Service (LTS) tests?

I have a Lightning Component that uses the lightning:workspaceAPI component to detect that it is (or is not) running in the console view. I'm starting to look at setting up some Lightning Testing ...
Keith C's user avatar
  • 136k
6 votes
1 answer
654 views

How to run Lightning Test Service (LTS) from Jenkins hosted on AWS against e.g. BrowserStack?

We run Karma and Protractor Angular tests from a Jenkins continuous integration (CI) server hosted on AWS. Those two frameworks allow the browser to be run remotely in e.g. https://www.browserstack....
Keith C's user avatar
  • 136k
0 votes
0 answers
43 views

Lightning Test Service - can you call actions directly or do they have to be wrapped in aura:method first?

Looking in couple of examples, I can't seem find a way to call actions and action helpers directly. Is that not supported? Edit: I think it's not possible, here's a similar issue (test click of a ...
dzh's user avatar
  • 4,086
21 votes
1 answer
2k views

How will Lightning Testing Service (LTS) be delivered when it is GA?

Took a first look at the Lightning Testing Service (LTS) that is in (open) pilot today: The Lightning Testing Service, or LTS, is a set of tools and services that let you create test suites for ...
Keith C's user avatar
  • 136k
33 votes
3 answers
3k views

What to Javascript-test in Lightning components and what not

Let's be honest. As an Apex developer used to provide near-100% test coverage for Apex the same should be true for Lightning components. As we move more code from the server to the client more test ...
Robert Sösemann's user avatar