Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test cases for dwapi - Dashboard,EMRSettings,and Registry test cases #105

Open
wants to merge 7 commits into
base: unit-tests
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Run DWAPI Unit Tests

on:
push:
branches: [ dev ]


jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.1.805
- name: Install dependencies
run: dotnet restore Dwapi.sln
- name: Build
run: dotnet build src/Dwapi/Dwapi.csproj --configuration Release --no-restore
- name: Test
run: ls test/*/*.Tests.csproj | xargs -L 1 dotnet test
- name: Setup Angular
uses: actions/setup-node@v1
with:
node-version: '14.x'
- run: npm install --prefix src/Dwapi
- run: npm run build --prefix src/Dwapi

- name: Pub .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.201
- name: Publish
run: dotnet publish src/Dwapi/Dwapi.csproj --configuration Release -o dwapi
- name: Zip Folder
run: zip -r dwapi.zip dwapi
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,5 @@ logs
# DWAPI dev files
*.Development.json
!*kenyahmis.pfx

node_modules/
2 changes: 1 addition & 1 deletion src/Dwapi/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"https_port": 5753,
"ConnectionStrings": {
"Provider": 0,
"DwapiConnection": "Data Source=.;Initial Catalog=dwapi;Persist Security Info=True;User ID=sa;Password=c0nstella;Pooling=True;MultipleActiveResultSets=True"
"DwapiConnection": "Data Source=.;Initial Catalog=dwapi;Persist Security Info=True;User ID=sa;Password=home;Pooling=True;MultipleActiveResultSets=True"
},
"AllowedHosts": "*",
"Kestrel": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { async, ComponentFixture, TestBed } from "@angular/core/testing";
import { RouterTestingModule } from "@angular/router/testing";
import { BreadcrumbService } from "../breadcrumb.service";
import { AppBreadcrumbComponent } from "./app-breadcrumb.component";

import { AppBreadcrumbComponent } from './app-breadcrumb.component';
describe("AppBreadcrumbComponent", () => {
let component: AppBreadcrumbComponent;
let fixture: ComponentFixture<AppBreadcrumbComponent>;
//let service: BreadcrumbService;

describe('AppBreadcrumbComponent', () => {
let component: AppBreadcrumbComponent;
let fixture: ComponentFixture<AppBreadcrumbComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [RouterTestingModule],
declarations: [AppBreadcrumbComponent],
providers:[BreadcrumbService]
}).compileComponents();
}));

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AppBreadcrumbComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AppBreadcrumbComponent);
component = fixture.componentInstance;

beforeEach(() => {
fixture = TestBed.createComponent(AppBreadcrumbComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
it("should create", () => {
expect(component).toBeTruthy();
});
});
3 changes: 3 additions & 0 deletions src/Dwapi/cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"baseUrl": "http://localhost:4200"
}
5 changes: 5 additions & 0 deletions src/Dwapi/cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
77 changes: 77 additions & 0 deletions src/Dwapi/cypress/integration/EMRSettings/emrsystems.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
before(function () {
//something ...
cy.visit("/#/emrconfig", { timeout: 100000 });
});

describe("Emr Settings configuration", () => {
const host_address = Cypress.env("host_address");
const host_port = Cypress.env("host_port");
const host_user = Cypress.env("host_user");
const host_password = Cypress.env("host_password");
it("visit the emr config page", () => {
cy.visit("/#/emrconfig", { timeout: 100000 });
});

it("Get list of emr", () => {
cy.request("GET", "/api/EmrManager").then(function (response) {
cy.log(response);
expect(response.status).equal(200);
expect(response.body).to.not.be.null;
console.log(response);
expect(response.body).to.be.a("array");
});
});

it("Set the default emr to KenyaEMR", () => {
cy.xpath(
"/html/body/liveapp-root/div/div/div[2]/div[1]/liveapp-emr-settings/div/div[1]/div/div/p-datatable/div/div[2]/table/tbody/tr[3]/td[2]/span/p-splitbutton/div/button[2]"
).click();

cy.xpath(
"/html/body/liveapp-root/div/div/div[2]/div[1]/liveapp-emr-settings/div/div[1]/div/div/p-datatable/div/div[2]/table/tbody/tr[3]/td[2]/span/p-splitbutton/div/div/ul/li[1]/a/span[2]"
).click();
});

it("Set the Database settings", () => {
cy.xpath(
'//*[@id="ui-tabpanel-0"]/div/liveapp-db-protocol/div/p-datatable/div/div[1]/table/tbody/tr/td[4]/span/button'
).click();
cy.xpath('//*[@id="host"]').clear().type(`${host_address}`);
cy.xpath('//*[@id="port"]').clear().type(`${host_port}`);
cy.xpath('//*[@id="username"]').clear().type(`${host_user}`);
cy.xpath(
"/html/body/liveapp-root/div/div/div[2]/div[1]/liveapp-emr-settings/div/div[2]/div[1]/p-tabview/div/div/p-tabpanel[1]/div/div/liveapp-db-protocol/p-dialog/div/div[2]/form/div/div[5]/div[2]/input"
)
.clear()
.type(`${host_password}`);
cy.xpath('//*[@id="databaseName"]').clear().type("openmrs");
cy.xpath(
'//*[@id="ui-tabpanel-0"]/div/liveapp-db-protocol/p-dialog/div/div[2]/form/div/div[8]/div[2]/button'
).click();

cy.xpath(
'//*[@id="ui-tabpanel-0"]/div/liveapp-db-protocol/p-dialog/div/div[2]/form/div/div[8]/div[1]/button'
).click();
});

it("set Openmrs End Point", () => {
cy.wait(10000);

cy.xpath(
"/html/body/liveapp-root/div/div/div[2]/div[1]/liveapp-emr-settings/div/div[1]/div/div/p-datatable/div/div[2]/table/tbody/tr[3]/td[1]/span/span"
).click();

cy.xpath('//*[@id="ui-tabpanel-1-label"]/span[1]').click();
cy.xpath(
'//*[@id="ui-tabpanel-1"]/div/liveapp-rest-protocol/div/p-datatable/div/div[1]/table/tbody/tr/td[2]/span/button'
).click();
cy.xpath('//*[@id="url"]')
.clear()
.type(
"http://prod.kenyahmis.org:8600/openmrs/ws/rest/v1/smartcard"
);
cy.xpath(
'//*[@id="ui-tabpanel-1"]/div/liveapp-rest-protocol/p-dialog/div/div[2]/form/div/div[2]/div[1]/button'
).click();
});
});
24 changes: 24 additions & 0 deletions src/Dwapi/cypress/integration/Registry/HIVRegistry.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
before(function () {
//something ...
cy.visit("/#/registry/HTS", { timeout: 100000 });
});

describe("HIV Testing Services Registry", () => {

it("Edit the url registry", () => {
cy.wait(1000);
cy.xpath('//*[@id="url"]')
.clear()
.type("https://auth.kenyahmis.org:7773");
});
it("Verify the url registry", () => {
cy.xpath(
"/html/body/liveapp-root/div/div/div[2]/div[1]/liveapp-registry-manager/div/div/div[2]/liveapp-registry-config/div/form/div/div[5]/div[2]/button"
).click();
});
it("Save the url registry", () => {
cy.xpath(
"/html/body/liveapp-root/div/div/div[2]/div[1]/liveapp-registry-manager/div/div/div[2]/liveapp-registry-config/div/form/div/div[5]/div[1]/button"
).click();
});
});
22 changes: 22 additions & 0 deletions src/Dwapi/cypress/integration/Registry/MNCHRegistry.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
before(function () {
//something ...
cy.visit("/#/registry/MNCH", { timeout: 100000 });
});

describe("Care and Treatment MNCH Registry", () => {
it("Edit the url registry", () => {
cy.xpath('//*[@id="url"]')
.clear()
.type("https://auth.kenyahmis.org/MNCH");
});
it("Verify the url registry", () => {
cy.xpath(
"/html/body/liveapp-root/div/div/div[2]/div[1]/liveapp-registry-manager/div/div/div[2]/liveapp-registry-config/div/form/div/div[5]/div[2]/button"
).click();
});
it("Save the url registry", () => {
cy.xpath(
"/html/body/liveapp-root/div/div/div[2]/div[1]/liveapp-registry-manager/div/div/div[2]/liveapp-registry-config/div/form/div/div[5]/div[1]/button"
).click();
});
});
21 changes: 21 additions & 0 deletions src/Dwapi/cypress/integration/Registry/NDWHRegistry.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
before(function () {
//something ...
cy.visit("/#/registry/NDWH", { timeout: 100000 });
});

describe("Care and Treatment NDWH Registry", () => {
it("Edit the url registry", () => {
cy.xpath('//*[@id="url"]').clear()
.type("https://auth.kenyahmis.org/dwapi");
});
it("Verify the url registry", () => {
cy.xpath(
"/html/body/liveapp-root/div/div/div[2]/div[1]/liveapp-registry-manager/div/div/div[2]/liveapp-registry-config/div/form/div/div[5]/div[2]/button"
).click();
});
it("Save the url registry", () => {
cy.xpath(
"/html/body/liveapp-root/div/div/div[2]/div[1]/liveapp-registry-manager/div/div/div[2]/liveapp-registry-config/div/form/div/div[5]/div[1]/button"
).click();
});
});
17 changes: 17 additions & 0 deletions src/Dwapi/cypress/integration/Registry/PKVRegistry.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
before(function () {
cy.visit("/#/registry/CBS", { timeout: 100000 });
});

describe("PKV Services configuration", () => {
it("Edit the URL registry", () => {
cy.xpath('//*[@id="url"]')
.clear()
.type("https://auth.kenyahmis.org:6763");
});

it("Verify the url Registry", () => {
cy.xpath(
"/html/body/liveapp-root/div/div/div[2]/div[1]/liveapp-registry-manager/div/div/div[2]/liveapp-registry-config/div/form/div/div[5]/div[2]/button"
).click();
});
});
Loading