WCT script with error outside of test: "Error thrown outside of test function"

I have a custom polymer element that creates another polymer element in its properties. The code is the same:

Polymer({
is: 'pg-create-ad-new',

properties:{
  creative: {
    type: "String"
  },

  storyId: {
    type: "String",
    value: ()=>{
      var storyIdRegEx = /.*(storyId=(.+))/i,
          storyId = '';
        var context = document.createElement('page-router').getContext();
        var matches = storyIdRegEx.exec(context.querystring);  

      if(matches){
        storyId = matches[2];
      }
      return storyId;
    }
  }
},

      

Now I am trying to test this page using WCT. Code for it:

<test-fixture id="createNewFixture">
    <template>
        <pg-create-ad-new>
        </pg-create-ad-new>
    </template>
</test-fixture>

      

And I have a very simple relevant test case. However, all tests fail with the following error:

Failed to execute tests: Error thrown outside of test function: Unable to read property "querystring" of undefined

Where / what am I doing wrong? Failed to set point. Please, help!

+3


source to share





All Articles