Skip to content

Commit

Permalink
Merge pull request #52 from hisptz/develop
Browse files Browse the repository at this point in the history
Upgrade to v1.0.3
  • Loading branch information
ericchingalo authored Apr 5, 2024
2 parents 18519d1 + 20d266c commit 1aceae3
Show file tree
Hide file tree
Showing 188 changed files with 46,048 additions and 1,386 deletions.
Binary file added .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .eslintcache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"/Users/megamind/projects/hisptz/etls-dat-app/d2.config.js":"1"},{"size":135,"mtime":1699255828525,"results":"2","hashOfConfig":"3"},{"filePath":"4","messages":"5","suppressedMessages":"6","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"zbbu9v","/Users/megamind/projects/hisptz/etls-dat-app/d2.config.js",[],[]]
2 changes: 2 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"env": {
"browser": true,
"amd": true,
"node": true,
"es2021": true
},
"extends": [
Expand Down
36 changes: 18 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
name: Build
on:
pull_request:
types:
- synchronize
- opened
pull_request:
types:
- synchronize
- opened

jobs:
build:
runs-on: ubuntu-22.04
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Sets up a Node.js environment, with yarn as the package manager
- uses: actions/setup-node@v3
with:
node-version: 16.20.1
cache: yarn
- name: Install JS dependencies
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
build:
runs-on: ubuntu-22.04
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Sets up a Node.js environment, with yarn as the package manager
- uses: actions/setup-node@v3
with:
node-version: 18.18.0
cache: yarn
- name: Install JS dependencies
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
45 changes: 22 additions & 23 deletions .github/workflows/dev_deployment.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
name: DHIS2 development server deployment

on:
pull_request:
types:
- closed
branches:
- develop
pull_request:
types:
- closed
branches:
- develop

jobs:
deploy:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.20.1
cache: yarn
- name: Install JS dependencies
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Deploy
run: yarn deploy:manager ${{ vars.DHIS2_PROXY }} --username ${{ secrets.DHIS2_USERNAME }}
env:
D2_PASSWORD: ${{ secrets.DHIS2_PASSWORD }}

deploy:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.18.0
cache: yarn
- name: Install JS dependencies
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Deploy
run: yarn deploy:manager ${{ vars.DHIS2_PROXY }} --username ${{ secrets.DHIS2_USERNAME }}
env:
D2_PASSWORD: ${{ secrets.DHIS2_PASSWORD }}
50 changes: 24 additions & 26 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
name: Tests

env:
DHIS2_PROXY: '${{vars.DHIS2_PROXY}}'
DHIS2_PROXY: "${{vars.DHIS2_PROXY}}"
on:
pull_request:
types:
- synchronize
- opened
pull_request:
types:
- synchronize
- opened

jobs:
tests:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.20.1
cache: yarn
- name: Install JS dependencies
run: yarn install --frozen-lockfile
- name: Run tests
run: yarn test
env:
BROWSER: none
DHIS2_PROXY: ${{ vars.DHIS2_PROXY }}
CYPRESS_dhis2Username: ${{ secrets.DHIS2_USERNAME }}
CYPRESS_dhis2Password: ${{ secrets.DHIS2_PASSWORD }}
CYPRESS_dhis2BaseUrl: 'http://localhost:8080'


tests:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.18.0
cache: yarn
- name: Install JS dependencies
run: yarn install --frozen-lockfile
- name: Run tests
run: yarn test
env:
BROWSER: none
DHIS2_PROXY: ${{ vars.DHIS2_PROXY }}
CYPRESS_dhis2Username: ${{ secrets.DHIS2_USERNAME }}
CYPRESS_dhis2Password: ${{ secrets.DHIS2_PASSWORD }}
CYPRESS_dhis2BaseUrl: "http://localhost:8080"
132 changes: 66 additions & 66 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,77 +1,77 @@
import {defineConfig} from "cypress";
import {chromeAllowXSiteCookies, networkShim} from "@dhis2/cypress-plugins";
import { defineConfig } from "cypress";
import { chromeAllowXSiteCookies, networkShim } from "@dhis2/cypress-plugins";
import path from "path";

async function cucumberPreprocessor(on: any, config: any) {
const preprocessor = require("@badeball/cypress-cucumber-preprocessor");
const webpack = require("@cypress/webpack-preprocessor");
// This is required for the preprocessor to be able to generate JSON reports after each run, and more,
await preprocessor.addCucumberPreprocessorPlugin(on, config);
const preprocessor = require("@badeball/cypress-cucumber-preprocessor");
const webpack = require("@cypress/webpack-preprocessor");
// This is required for the preprocessor to be able to generate JSON reports after each run, and more,
await preprocessor.addCucumberPreprocessorPlugin(on, config);

on(
"file:preprocessor",
webpack({
webpackOptions: {
context: path.resolve(__dirname, "cypress"),
resolve: {
extensions: [".ts", ".js"],
},
module: {
rules: [
{
test: /\.ts$/,
exclude: [/node_modules/],
use: [
{
loader: "ts-loader",
options: {
transpileOnly: true
}
},
],
},
{
test: /\.feature$/,
use: [
{
loader: "@badeball/cypress-cucumber-preprocessor/webpack",
options: config,
},
],
},
],
},
},
})
);
on(
"file:preprocessor",
webpack({
webpackOptions: {
context: path.resolve(__dirname, "cypress"),
resolve: {
extensions: [".ts", ".js"],
},
module: {
rules: [
{
test: /\.ts$/,
exclude: [/node_modules/],
use: [
{
loader: "ts-loader",
options: {
transpileOnly: true,
},
},
],
},
{
test: /\.feature$/,
use: [
{
loader: "@badeball/cypress-cucumber-preprocessor/webpack",
options: config,
},
],
},
],
},
},
}),
);
}

async function setupNodeEvents(on: any, config: any) {
chromeAllowXSiteCookies(on, config);
await cucumberPreprocessor(on, config);
networkShim(on, config);
return config;
chromeAllowXSiteCookies(on, config);
await cucumberPreprocessor(on, config);
networkShim(on, config);
return config;
}

export default defineConfig({
e2e: {
viewportWidth: 1368,
viewportHeight: 768,
setupNodeEvents,
defaultCommandTimeout: 20000,
requestTimeout: 20000,
responseTimeout: 20000,
retries: 2,
taskTimeout: 20000,
pageLoadTimeout: 10000,
baseUrl: "http://localhost:3000",
specPattern: "cypress/e2e/**/*.feature",
env: {
dhis2DataTestPrefix: "d2-poe",
networkMode: "live",
dhis2ApiVersion: 40,
},
experimentalInteractiveRunEvents: true,
experimentalStudio: true
},
e2e: {
viewportWidth: 1368,
viewportHeight: 768,
setupNodeEvents,
defaultCommandTimeout: 20000,
requestTimeout: 20000,
responseTimeout: 20000,
retries: 2,
taskTimeout: 20000,
pageLoadTimeout: 10000,
baseUrl: "http://localhost:3000",
specPattern: "cypress/e2e/**/*.feature",
env: {
dhis2DataTestPrefix: "d2-dat",
networkMode: "live",
dhis2ApiVersion: 40,
},
experimentalInteractiveRunEvents: true,
experimentalStudio: true,
},
});
8 changes: 4 additions & 4 deletions cypress/e2e/AppRuns/AppRuns.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

Feature: App runs
# Feature: App runs

Scenario: App opens
When the user visits the app
Then the words "DAT Custom App" should be displayed
# Scenario: App opens
# When the user visits the app
# Then the words "DAT Custom App" should be displayed
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {Then, When} from "@badeball/cypress-cucumber-preprocessor"
import { Then, When } from "@badeball/cypress-cucumber-preprocessor";

When(/^the user visits the app$/, function () {
cy.visit('/');
cy.visit("/");
});

Then(/^the words "([^"]*)" should be displayed$/, function (label: string) {
cy.get('h1').contains(label);
cy.get("h1").contains(label);
});
59 changes: 59 additions & 0 deletions cypress/e2e/Configurations/Configurations.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
Feature: Configuration features

Scenario: User navigates to configuration
When the user clicks on the "configuration" page
Then the user should be navigated to the "configuration" page


Scenario: User performs program mappping
When the user clicks on the "configuration" page
And the user clicks on the "program mapping" tab
Then user waits for "3" seconds
And the user clicks on the "Edit" button
And inputs the "select" field "mappedTbProgram" as "tj4u1ip0tTF"
And inputs the "select" field "firstName" as "iAaQt0MfyFj"
And inputs the "select" field "surname" as "yaNdF4auOw6"
And inputs the "select" field "patientNumber" as "aihxG1tTqba"
And inputs the "select" field "age" as "ycm08j1RuKr"
And inputs the "select" field "sex" as "lYMzXiSb00n"
And inputs the "select" field "regimen" as "JjySGEpaVza"
And inputs the "select" field "phoneNumber" as "b11aBXG3igq"
And inputs the "select" field "deviceIMEInumber" as "ayhQ0Uu3DHx"
And inputs the "text" field "mediatorUrl" as "https://evrimed.wisepill.com/api/v1"
And inputs the "text" field "apiKey" as "davedavedavedave"
And the user clicks on the "Save" button


Scenario: User adds a device
When the user clicks on the "configuration" page
And the user clicks on the "dat device lists" tab
And the user clicks on the "Add Device" button
And inputs the device as "3290212112989132"
And the user saves the device
Then the devices list should be updated succesfully

Scenario: User edits a device
When the user clicks on the "configuration" page
And the user clicks on the "dat device lists" tab
And the user clicks on the Edit icon
And edits the device as "32902121177777777"
And the user saves the device
Then the devices list should be updated succesfully

Scenario: User deletes a device
When the user clicks on the "configuration" page
And the user clicks on the "dat device lists" tab
And the user clicks on the Delete icon
And the user clicks on the "Delete" button
Then the devices list should be updated succesfully


Scenario: User adds a regimen setting
When the user clicks on the "configuration" page
And the user clicks on the "regimen setup" tab
And the user clicks on the "Add Setting" button
# And the user saves the device
# Then the devices list should be updated succesfully



Loading

0 comments on commit 1aceae3

Please sign in to comment.