OpenCerts / legacy-templates

Apache License 2.0
0 stars 25 forks source link

npm run integration failed #9

Closed ccewuz closed 5 years ago

ccewuz commented 5 years ago

Hi, Looks the integration failed for all templates. For example, with govtech demo error is like below. Anything wrong?

Frameless Viewer × Govtech Demo certificate is rendered correctly

1) An error occurred in eval code:

  TypeError: Cannot read property 'renderDocument' of undefined

  Browser: Chrome 75.0.3770 / Windows 10.0.0

     19 |test("Govtech Demo certificate is rendered correctly", async t => {
     20 |  // Inject javascript and execute window.opencerts.renderDocument
     21 |  const certificateContent = getData(
     22 |    JSON.parse(readFileSync(join(__dirname, Certificate)).toString())
     23 |  );
   > 24 |  await t.eval(() => window.opencerts.renderDocument(certificateContent), {
     25 |    dependencies: { certificateContent }
     26 |  });
     27 |
     28 |  // Check content of window.opencerts.templates
     29 |  await t.wait(500);

     at eval (c:\data\personal\jobs\EIS\ISIS\RT223084 OpenCerts Project - Integration with
  EduRec\_js\legacy-templates\src\components\CertificateTemplates\tlds\sg\gov\tech\Govtech-Demo-Cert\integration.spec.js:24:11)
     at step (c:\data\personal\jobs\EIS\ISIS\RT223084 OpenCerts Project - Integration with
  EduRec\_js\legacy-templates\node_modules\babel-runtime\helpers\asyncToGenerator.js:17:30)
     at <anonymous> (c:\data\personal\jobs\EIS\ISIS\RT223084 OpenCerts Project - Integration with
  EduRec\_js\legacy-templates\node_modules\babel-runtime\helpers\asyncToGenerator.js:35:14)
     at new F (c:\data\personal\jobs\EIS\ISIS\RT223084 OpenCerts Project - Integration with
  EduRec\_js\legacy-templates\node_modules\core-js\library\modules\_export.js:36:28)
     at <anonymous> (c:\data\personal\jobs\EIS\ISIS\RT223084 OpenCerts Project - Integration with
  EduRec\_js\legacy-templates\node_modules\babel-runtime\helpers\asyncToGenerator.js:14:12)
     at test (c:\data\personal\jobs\EIS\ISIS\RT223084 OpenCerts Project - Integration with
  EduRec\_js\legacy-templates\src\components\CertificateTemplates\tlds\sg\gov\tech\Govtech-Demo-Cert\integration.spec.js:19:1)
     at markeredfn (c:\data\personal\jobs\EIS\ISIS\RT223084 OpenCerts Project - Integration with
  EduRec\_js\legacy-templates\node_modules\testcafe\src\api\wrap-test-function.js:17:28)
     at step (c:\data\personal\jobs\EIS\ISIS\RT223084 OpenCerts Project - Integration with
  EduRec\_js\legacy-templates\node_modules\babel-runtime\helpers\asyncToGenerator.js:17:30)
     at <anonymous> (c:\data\personal\jobs\EIS\ISIS\RT223084 OpenCerts Project - Integration with
  EduRec\_js\legacy-templates\node_modules\babel-runtime\helpers\asyncToGenerator.js:35:14)
     at new F (c:\data\personal\jobs\EIS\ISIS\RT223084 OpenCerts Project - Integration with
  EduRec\_js\legacy-templates\node_modules\core-js\library\modules\_export.js:36:28)

1/1 failed (27s)

samuellye98 commented 5 years ago

Hi, could you try running npm rebuild node-sass in the terminal before running npm run integration?

ccewuz commented 5 years ago

Tried but the error persists.

npm rebuild node-sass looks successful as result shows "Binary is fine".

npm run test passes.

samuellye98 commented 5 years ago

Hi, did you run npm run dev before running npm run integration. There needs to be a server on localhost:3000 in order for the integration tests to work.

ccewuz commented 5 years ago

Certainly. I managed to see all my templates rendered correctly in index.html before running integration scripts. Below is a sample. I did some changes to display all templates w/o copying and pasting the JSON content.

image

samuellye98 commented 5 years ago

Could you commit this branch to a new repository on your own Github and we will git clone it and see what's wrong

ccewuz commented 5 years ago

Already create a pull request at https://github.com/OpenCerts/legacy-templates/pull/8. Please check out.

samuellye98 commented 5 years ago

Hi, it seems that your certificate is failing the integration tests on Travis CI - https://travis-ci.org/OpenCerts/legacy-templates/jobs/567789663

Try fixing that and see if the travis CI test passes

ccewuz commented 5 years ago

Ok, fixed. All checks pass now, including integration test. But locally it still fails. Strange!

ccewuz commented 5 years ago

Any update on this?

Also, I have created a pull request which passed all checks. Can you help merge it?

rjchow commented 5 years ago

have responded with some comments