I'm working on UI test automation and noticed Lightning avoids loading tabs in background. You can test yourself - cmd + click on some records and wait - then open new tab and it's only then Salesforce starts loading the page.

There's obviously some tab/window focus detection done, for a good reason to save bandwidth/memory for some users. But for UI testing it is a massive PITA as testing in multiple browsers/tabs at once means they keeps stalling.

  • I tested this with standard contact records in an org and did not observe any noticeable delay in the tabs loaded in background. I opened ten tabs and by the time I went to tabs 2 to 10, the record page was already loaded. Are you running any custom components in your page? Have you accounted for network latency? Any more details you could provide?
    – arut
    Aug 5 '20 at 8:50
  • Thanks @arut, I've tested more closely with Leads and it's a bit mixed result. Most of record detail loads in background, however Campaign History loads after tab focuses.
    – dzh
    Aug 5 '20 at 10:06
  • Indeed we are using a flexipage with an aura component on it. The loads in background, while remaining flexipage and component only starts loading on focus.
    – dzh
    Aug 5 '20 at 10:07
  • Hard to troubleshoot the root cause when I'm unable to replicate the scenario. However, I'm starting to wonder whether this may not be completely because of the way Salesforce loads the page. Have you given a thought on browser optimization features coming into play here? Also, were you able to replicate this behavior in other browsers?
    – arut
    Aug 6 '20 at 4:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.