[GSoC-2017] : Built-In Reports for Reference Application

Hi @raff, @ssmusoke,

I’m facing a blocker situation with unit testing. Below is my commit.

When I try to use the snapshot testing, the snapshot file doesn’t have the expected component values. I have even checked it by passing the mock through my actual code flow and it rendered as I was expecting. Can you spot what I’m doing wrong there? @dkayiwa

Regards, Jude Niroshan

What are the steps to reproduce your problem?

Just clone and build the project.

  1. Open a command line

  2. npm run build:prod

Regards, Jude Niroshan

Hi, I was able to solve that problem by making the fakeRequestLibrary.js return value to run synchronously. Removed the Promise(). Now I’m facing a different issue when I run the jest.

I’m working on this. If you know how to sort this issue, please comment below. :slight_smile:

You can reproduce this issue by simply cloning the repo. I have committed this changes even though it gives a test failure.

Regards, Jude Niroshan

Hi @raff,

While I am trying to solve the problem with Jest Test case, I have modified the report column names in referenceMetaData module. Here is my PR,

I was limited to use a single word for those SQLDataSets. Because in usual SQL syntax, we cannot have space separated name for alias. Please let me know if there is anything that needs to be modified. :slight_smile:

Regards, Jude Niroshan

Merged! We’ll look into the Jest issue today.

1 Like

Hi @raff,

I have almost finishing up the things right now. I tried to pass an JS array to rowGetter function and it didn’t work. I looked in the official doc and I didn’t find that it supports for arrays. It says it accepts a function. So, currently I’m having an function and which made the snapshot file to be looks like this:

// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<ReportAsTableView />  component displays as expected 1`] = `
<div
  className="TableDivHolder"
>
  <ReactDataGrid
    columns={
      Array [
        Object {
          "key": "username",
          "name": "username",
          "resizable": true,
        },
        Object {
          "key": "date_created",
          "name": "date_created",
          "resizable": true,
        },
        Object {
          "key": "count",
          "name": "count",
          "resizable": true,
        },
      ]
    }
    minHeight={280}
    rowGetter={[Function]}
    rowsCount={5}
  />
</div>
`;

Meanwhile, I tried the test for chart objects and it has no luck on see the things inside the <canvas>. But for now, I have written the tests at least for those. :slight_smile:

Regards, Jude Niroshan

Hi @raff,

I have fixed the UI issues which we found on our last meeting. Now I am trying configure the continuous integration to this project. I have registered on bintray and also in Travis CI.

I have added the travis.yml file by following the cohort-builder-owa. But the build keeps failing.

https://travis-ci.org/JudeNiroshan/openmrs-owa-built-in-reports/builds/268817714?utm_source=email&utm_medium=notification

I think first I have to make a successful built before deploy it. So, I omitted the deploy section in the travis.yml file.

Any help is appreciated.

Thanks & regards, Jude Niroshan

Hi @raff,

I have tried to release new version by correcting small changes. TravisCI build is getting passed but the release is not made to bintray. In the build log there is a message as follows:

The command "npm run build:prod" exited with 0.
dpl.0
6.44sSuccessfully installed dpl-1.8.42
1 gem installed
7.29s
dpl.1
Installing deploy dependencies
[Bintray Upload] Reading descriptor file: bintray.json
[Bintray Upload] Creating version '0.9.3'...
[Bintray Upload] Bintray response: 201 Created. 
[Bintray Upload] Uploading file 'openmrs-owa-built-in-reports.zip' to openmrs-owa-built-in-reports.zip
[Bintray Upload] Bintray response: 409 Conflict. Unable to upload files: An artifact with the path 'openmrs-owa-built-in-reports.zip' already exists under another version
[Bintray Upload] Publishing version '0.9.3' of package 'openmrs-owa-built-in-reports'...
[Bintray Upload] Bintray response: 200 OK. 
Done. Your build exited with 0. 

I have even added a property to override the existing files in bintray. But it didn’t work.

{
    "package": {
        "name": "openmrs-owa-built-in-reports",
        "repo": "owa",
        "subject": "judeniroshan"
    },

    "version": {
        "name": "0.9.3",
        "released": "2017-08-29"
    },

    "files":[{"includePattern": "openmrs-owa-built-in-reports.zip", "uploadPattern": "openmrs-owa-built-in-reports.zip"}],
    "publish": true,
    "override": true
}

Regards, Jude Niroshan

Do you already have that in this file? https://github.com/openmrs/openmrs-contrib-addonindex/blob/master/src/main/resources/add-ons-to-index.json

You need to fix the produced zip to include a version number and correct both includePattern and uploadPattern to reflect that.

https://github.com/JudeNiroshan/openmrs-owa-built-in-reports/blob/master/webpack.config.js#L86 is where you need to include version. You can load version number from package.json e.g. https://github.com/rkorytkowski/openmrs-owa-conceptdictionary/blob/master/webpack.config.js#L87-L88

And then correct bintray.json as in https://github.com/rkorytkowski/openmrs-owa-conceptdictionary/blob/master/bintray.json#L13

You will need to set the version in both package.json and bintray.json. If you don’t like that you could try to produce bintray.json as part of the build with the version set automatically.

2 Likes

Hi @raff,

Thank you for your infomation. I was able to make it by manually putting the version number into the distribution file. Now it is shown in bintray as well :slight_smile:

https://bintray.com/judeniroshan/owa

Regards, Jude Niroshan

Hi @judeniroshan

I was trying to build the zip from https://github.com/JudeNiroshan/openmrs-owa-built-in-reports when I run npm run build:prod, it gives me an error ‘jest’ is not recognized as an internal or external command, operable program or batch file. npm ERR! code ELIFECYCLE

Could you please help me in getting the owa zip?

Regards -Srikanth

Hi @kshebbar

Have you tried this updated repo : https://github.com/openmrs/openmrs-owa-builtinreports

Cc : @sumangala28

Have tried and the result is same. It was looking for many modules and even after installing them no success.