Skip to content

Commit

Permalink
test(pd): typescript and test pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
y3rsh committed Nov 10, 2024
1 parent ff4a13f commit 5d96ec2
Show file tree
Hide file tree
Showing 24 changed files with 793 additions and 434 deletions.
30 changes: 30 additions & 0 deletions protocol-designer/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,33 @@ test:
.PHONY: test-cov
test-cov:
make -C .. test-js-protocol-designer tests=$(tests) test_opts="$(test_opts)" cov_opts="$(cov_opts)"

CYPRESS_GLOB := "cypress/**/*.{js,ts,md}"

.PHONY: cy-lint-check
cy-lint-check: cy-lint-eslint-check cy-lint-prettier-check
@echo "Cypress lint check completed."

.PHONY: cy-lint-fix
cy-lint-fix: cy-lint-eslint-fix cy-lint-prettier-fix
@echo "Cypress lint fix applied."

.PHONY: cy-lint-eslint-check
cy-lint-eslint-check:
yarn eslint --ignore-path ../.eslintignore $(CYPRESS_GLOB)
@echo "Cypress ESLint check completed."

.PHONY: cy-lint-eslint-fix
cy-lint-eslint-fix:
yarn eslint --fix --ignore-pattern ../.eslintignore $(CYPRESS_GLOB)
@echo "Cypress ESLint fix applied."

.PHONY: cy-lint-prettier-check
cy-lint-prettier-check:
yarn prettier --ignore-path ../.eslintignore --check $(CYPRESS_GLOB)
@echo "Cypress Prettier check completed."

.PHONY: cy-lint-prettier-fix
cy-lint-prettier-fix:
yarn prettier --ignore-path ../.eslintignore --write $(CYPRESS_GLOB)
@echo "Cypress Prettier fix applied."
43 changes: 43 additions & 0 deletions protocol-designer/cypress/e2e/createNew.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import {
Actions,
Verifications,
runCreateTest,
verifyCreateProtocolPage,
} from '../support/createNew'
import { UniversalActions } from '../support/universalActions'

describe('The Redesigned Create Protocol Landing Page', () => {
beforeEach(() => {
cy.visit('/')
})

it('content and step 1 flow works', () => {
cy.clickCreateNew()
cy.verifyCreateNewHeader()
verifyCreateProtocolPage()
const steps: Array<Actions | Verifications | UniversalActions> = [
Verifications.OnStep1,
Verifications.FlexSelected,
UniversalActions.Snapshot,
Actions.SelectOT2,
Verifications.OT2Selected,
UniversalActions.Snapshot,
Actions.SelectFlex,
Verifications.FlexSelected,
UniversalActions.Snapshot,
Actions.Confirm,
Verifications.OnStep2,
Verifications.NinetySixChannel,
UniversalActions.Snapshot,
Actions.GoBack,
Verifications.OnStep1,
Actions.SelectOT2,
Actions.Confirm,
Verifications.OnStep2,
Verifications.NotNinetySixChannel,
UniversalActions.Snapshot,
]

runCreateTest(steps)
})
})
29 changes: 0 additions & 29 deletions protocol-designer/cypress/e2e/home.cy.js

This file was deleted.

14 changes: 14 additions & 0 deletions protocol-designer/cypress/e2e/home.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
describe('The Home Page', () => {
beforeEach(() => {
cy.visit('/')
})

it('successfully loads', () => {
// JTM20241109
// Normally we want to read our test and understand the validations,
// but I forsee wanting to be able to call these functions from multiple
// places so we will abstract it
cy.verifyFullHeader()
cy.verifyHomePage()
})
})
14 changes: 14 additions & 0 deletions protocol-designer/cypress/e2e/import.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { TestFilePath, getTestFile } from '../support/testFiles'
import { verifyOldProtocolModal } from '../support/import'

describe('The Import Page', () => {
beforeEach(() => {
cy.visit('/')
})

it('successfully loads', () => {
const protocol = getTestFile(TestFilePath.DoItAllV8)
cy.importProtocol(protocol.path)
verifyOldProtocolModal()
})
})
52 changes: 0 additions & 52 deletions protocol-designer/cypress/e2e/redesignCreateLanding.cy.js

This file was deleted.

14 changes: 0 additions & 14 deletions protocol-designer/cypress/e2e/redesignHome.cy.js

This file was deleted.

161 changes: 0 additions & 161 deletions protocol-designer/cypress/e2e/settings.cy.js

This file was deleted.

Loading

0 comments on commit 5d96ec2

Please sign in to comment.