Skip to main content

Using local storage

At times you may need to be able to put objects in the browser’s local storage. This is especially true if you are trying to login using pre-authenticated tokens and not by using username+password.

Here’s how you can do that in testRTC:
client
  .url(process.env.RTC_SERVICE_URL)
  .execute(function() {
    window.localStorage.setItem('key1', 'value1');
    window.localStorage.setItem('key2', 'value2');
    return true;
  }, [], function(result) {
    this.assert.ok(result.value);
  })
  .refresh()
  .waitForElementVisible('body', 2000);

This will open up the URL you want, populate the local storage objects for that URL, and then reload the same page.

Was this article helpful?

0 out of 0 found this helpful