Skip to content

Commit

Permalink
Merge pull request #391 from lunit-io/chore/VIEWER-110-test-github-ac…
Browse files Browse the repository at this point in the history
…tions

VIEWER-110 / Add unit, e2e test github actions
  • Loading branch information
LTakhyunKim authored Apr 17, 2023
2 parents e950881 + c209cca commit 7fa3ccb
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 4 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/dev-e2e-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 'dev e2e test'

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
cypress-run:
name: Cypress run
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Cypress run
uses: cypress-io/github-action@v5
with:
build: npm run build
start: npm run start
project: ./apps/insight-viewer-dev-e2e
browser: chrome
18 changes: 18 additions & 0 deletions .github/workflows/insight-viewer-unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'insight viewer unit test coverage'
on: pull_request

jobs:
coverage:
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v3
- uses: ArtiomTr/jest-coverage-report-action@v2
id: coverage
with:
package-manager: npm
test-script: npm run test:unit
output: report-markdown
- uses: marocchino/sticky-pull-request-comment@v2
with:
message: ${{ steps.coverage.outputs.report }}
2 changes: 1 addition & 1 deletion apps/insight-viewer-dev-e2e/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import { defineConfig } from 'cypress'
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset'

export default defineConfig({
e2e: nxE2EPreset(__dirname),
e2e: { ...nxE2EPreset(__dirname), baseUrl: 'http://localhost:4200' },
})
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ describe(
})

it('shows initial annotation', () => {
cy.get($LOADED).should('be.exist')
cy.get('[data-cy-tab="drawer"]').click()
cy.get($LOADED).should('be.exist')
})

describe('Polygon Annotation', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ describe(
})

it('shows initial measurement drawer', () => {
cy.get($LOADED).should('be.exist')
cy.get('[data-cy-tab="drawer"]').click()
cy.get($LOADED).should('be.exist')
})

describe('Ruler Measurement', () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/insight-viewer-dev-e2e/src/support/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export const drawMeasurements = (measurements: Measurement[]): void => {
export const moveMeasurement = (measurement: Measurement, distance: number): void => {
const targetDataAttr = `[data-cy-id="${measurement.id}"]`
const targetDrawingAttr = '[data-cy-move]'
const startPoint = measurement.type === 'circle' ? measurement.centerPoint : measurement.startAndEndPoint[0]
const startPoint = measurement.type === 'area' ? measurement.centerPoint : measurement.startAndEndPoint[0]

cy.get(targetDataAttr).click({ force: true })

Expand Down

0 comments on commit 7fa3ccb

Please sign in to comment.