Skip to content

Commit

Permalink
Merge dev to main for site-ui-4-July-24-Start-Direct Release
Browse files Browse the repository at this point in the history
  • Loading branch information
drbgfc committed Jul 31, 2024
2 parents 3ccf7a4 + 1b4bb61 commit 9df1718
Show file tree
Hide file tree
Showing 219 changed files with 127,469 additions and 1,959 deletions.
6 changes: 6 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
NEXT_PUBLIC_CCDA_VALIDATOR_CURES_USCDIV3_SENDER_URL=https://api.github.com/repos/onc-healthit/2015-edition-cures-update-uscdi-v3-testdata/contents/Cures Update Svap Uscdiv3 Sender SUT Test Data
NEXT_PUBLIC_CCDA_VALIDATOR_CURES_USCDIV3_RECEIVER_URL=https://api.github.com/repos/onc-healthit/2015-edition-cures-update-uscdi-v3-testdata/contents/Cures Update Svap Uscdiv3 Receiver SUT Test Data
NEXT_PUBLIC_CCDA_VALIDATOR_CURES_USCDIV3_DOWNLOAD_URL=https://codeload.github.com/onc-healthit/2015-edition-cures-update-uscdi-v3-testdata/zip/master
NEXT_PUBLIC_CCDA_VALIDATOR_CURES_V1_SENDER_URL=https://api.github.com/repos/onc-healthit/2015-edition-cures-update-data/contents/Cures Update Sender SUT Test Data
NEXT_PUBLIC_CCDA_VALIDATOR_CURES_V1_RECEIVER_URL=https://api.github.com/repos/onc-healthit/2015-edition-cures-update-data/contents/Cures Update Receiver SUT Test Data
NEXT_PUBLIC_CCDA_VALIDATOR_CURES_DOWNLOAD_URL=https://codeload.github.com/onc-healthit/2015-edition-cures-update-data/zip/master
111 changes: 111 additions & 0 deletions .github/workflows/create-deploy-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
name: Create Build
on:
push:
branches:
- dev
- main
pull_request:
types: [opened, reopened, synchronize]
branches:
- dev
- main

jobs:
code-quality-check:
name: Test and Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install Dependencies
run: npm ci --force
- name: Lint
run: npm run lint
build:
name: Build
runs-on: ubuntu-latest
needs: code-quality-check
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install Dependencies
run: npm ci --force
- name: Run Build
run: npm run build
- name: Create Build Artifact
run: |
mkdir ./build
cp ./.next -pR ./build/.next
cp ./next.config.js ./build/next.config.js
cp ./package.json ./build/package.json
cp ./package-lock.json ./build/package-lock.json
- name: Upload build folder
uses: actions/upload-artifact@v4
with:
name: BuildArtifact
path: ./build
retention-days: 7
deploy:
name: Deploy to Dev
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main'
needs: build
steps:
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/development.key
chmod 600 ~/.ssh/development.key
cat >>~/.ssh/config <<END
Host development
HostName $SSH_HOST
User $SSH_USERNAME
Port $SSH_PORT
IdentityFile ~/.ssh/development.key
StrictHostKeyChecking no
END
env:
SSH_PORT: ${{secrets.SSH_PORT}}
SSH_HOST: ${{secrets.SSH_HOST}}
SSH_USERNAME: ${{secrets.SSH_USERNAME}}
SSH_KEY: ${{secrets.SSH_KEY}}
- name: Download Build Artifact
uses: actions/download-artifact@v4
with:
name: BuildArtifact
path: ./
- name: Copy Artifact to Environment
run: |
zip -r -o BuildArtifact.zip ./
scp BuildArtifact.zip development:
ssh development 'ls -la'
- name: Stop application
run: |
ssh development /bin/bash<< EOF
sudo bash
export PATH=$PATH:/root/.nvm/versions/node/v20.12.1/bin
pm2 stop site-ui-4
EOF
- name: Update site-ui-4 files
run: |
ssh development /bin/bash<< EOF
sudo bash
ls -la
unzip -o BuildArtifact.zip -d /opt/site-ui-4
EOF
- name: Restart application
run: |
ssh development /bin/bash<< EOF
sudo bash
export PATH=$PATH:/root/.nvm/versions/node/v20.12.1/bin
pm2 startOrRestart /opt/site-ui-4/ecosystem.config.js --env production && pm2 save
EOF
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
# misc
.DS_Store
*.pem
.project
.settings/

# debug
npm-debug.log*
Expand All @@ -36,4 +38,8 @@ yarn-error.log*
next-env.d.ts

#node
.node-version
.node-version

# Cypress file
cypress/screenshots/
cypress/videos/
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,15 @@ You can check out [the Next.js GitHub repository](https://github.com/vercel/next
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

## E2E tests

1. Run npm install
2. Update cypress/config/cypress.config.dev.ts with credentials- When login functionality is implemented. Not needed now.
3. Run npm run test which will open cypress window -> choose E2E testing -> Choose browser to run the tests against -> choose test files to run. This will use dev config file.
4. Running test through cmd, npm run test:dev. This will use electron headless browser to run the tests.

## Component tests

1. Run npx cypress open which will open cypress window -> choose Component Testing -> Choose browser to run the tests against -> choose test files to run.
2. Running test through cmd, npx cypress run --component. This will run all specs.
16 changes: 16 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { defineConfig } from "cypress";

export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
},

component: {
devServer: {
framework: "next",
bundler: "webpack",
},
},
});
18 changes: 18 additions & 0 deletions cypress/config/cypress.config.dev.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { defineConfig } from 'cypress'

export default defineConfig({
env: {
auth_username: 'ADD_USERNAME',
auth_password: 'ADD_PASSWORD',
okta_domain: 'ADD_OKTA_URL',
},
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
testIsolation: false,
baseUrl: 'http://localhost:3000',
viewportWidth: 1280,
viewportHeight: 720,
},
})
75 changes: 75 additions & 0 deletions cypress/e2e/CCDAValidator/ccdaValidatorV1.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import 'cypress-file-upload'

describe('C-CDA USCDI V1 Validator form', () => {
beforeEach(() => {
cy.visit('/c-cda')
cy.get(`*[title="C-CDA Validator: USCDI v1"]`).click()
cy.get(`*[value="Sender"]`).click()
})

it(`should pass validation for file that meets USCDI v1 standards`, () => {
cy.get('#uscdi-v3-full-criteria-select')
.click()
.then(() => {
cy.get(`*[data-value='170.315_b1_ToC_Amb']`).click()
})
.then(() => {
cy.get('#uscdi-v3-full-scenario-select').click()
})
.then(() => {
cy.get(`*[data-value='170.315_b1_toc_amb_sample2_v2.pdf']`).click()
})
cy.get('input[name=ccdaFile]').selectFile('./cypress/e2e/testdata/CCDAValidatorV1/170.315_b1_toc_amb_sample2.xml', {
action: 'drag-drop',
force: true,
})
cy.get('#validate').click()
cy.get('#validating-dialog-title').should('be.visible')
cy.contains('Results', { timeout: 50000 }).should('exist')
cy.get('#result').should('contain.text', 'Pass')
})

it(`should fail validation for file that contain errors or do not comply with USCDI v1 standards`, () => {
cy.get('#uscdi-v3-full-criteria-select')
.click()
.then(() => {
cy.get(`*[data-value='170.315_b1_ToC_Amb']`).click()
})
.then(() => {
cy.get('#uscdi-v3-full-scenario-select').click()
})
.then(() => {
cy.get(`*[data-value='170.315_b1_toc_amb_sample1_v2.pdf']`).click()
})
cy.get('input[name=ccdaFile]').selectFile(
'./cypress/e2e/testdata/CCDAValidatorV1/170.315_b1_toc_amb_sample1_v1.xml',
{
action: 'drag-drop',
force: true,
}
)
cy.get('#validate').click()
cy.get('#validating-dialog-title').should('be.visible')
cy.contains('Results', { timeout: 150000 }).should('exist')
cy.get('#result').should('contain.text', 'Fail')
})
})

describe('USCDI V1 Validator- Validate with CCDA implementation guide', () => {
beforeEach(() => {
cy.visit('/c-cda')
cy.get(`*[title="C-CDA Validator: USCDI v1"]`).click()
cy.contains(`VALIDATE WITH THE C-CDA IMPLEMENTATION GUIDE ONLY`).click()
})

it(`should pass validation for file that meets USCDI v1 standards`, () => {
cy.get('input[name=ccdaFile]').selectFile('./cypress/e2e/testdata/CCDAValidatorV1/170.315_b1_toc_amb_sample2.xml', {
action: 'drag-drop',
force: true,
})
cy.get('#validate').click()
cy.get('#validating-dialog-title').should('be.visible')
cy.contains('Results', { timeout: 50000 }).should('exist')
cy.get('#result').should('contain.text', 'Pass')
})
})
Loading

0 comments on commit 9df1718

Please sign in to comment.