Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

1
vote
1answer
16 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 ...
2
votes
1answer
20 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 ...
0
votes
0answers
36 views

“TypeError: component.find is not a function” When trying to test by using LTS: Jasmine install through sfdx

Since I have install jasmine LTS from sfdx am using jasmine/2.6.1 . Write a test as said in the example for c:egGlobalValueProvider But I am getting an error in scratch org :TypeError: component.find ...
0
votes
1answer
50 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 ...
5
votes
0answers
76 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....
3
votes
1answer
350 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 ...
16
votes
1answer
853 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 ...
2
votes
1answer
49 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?
9
votes
1answer
217 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 ...
6
votes
1answer
392 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 ...
9
votes
0answers
179 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 ...
8
votes
0answers
214 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 ...
6
votes
1answer
285 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 ...
6
votes
1answer
377 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....
0
votes
0answers
38 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 ...
19
votes
1answer
1k 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 ...
30
votes
3answers
2k 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 ...