Skip to content

Commit

Permalink
test: basic tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sciator committed Mar 10, 2021
1 parent 9df94db commit c4df4ad
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 12 deletions.
25 changes: 24 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2
jobs:
build:
test:
docker:
- image: circleci/node:lts
working_directory: ~/repo
Expand Down Expand Up @@ -35,3 +35,26 @@ jobs:
# else \
# yarn run chromatic -- --auto-accept-changes
# fi
update-snapshots:
docker:
- image: circleci/node:lts
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "yarn.lock" }}
- run: yarn install --frozen-lockfile
- run: yarn --cwd stories cy:update


workflows:
version: 2
test:
jobs:
- test
- update-snapshots:
type: approval
requires:
- test

59 changes: 48 additions & 11 deletions stories/cypress/integration/test.test.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,62 @@

describe('testing test', () => {
it.only('should fix geo data', () => {
cy.visitTest('Geo', 'Circle Markers')
it('should make Gauge snapshot', () => {
cy.visitTest('Gauge', 'Gauge')
cy.inputKnobs('Fixed data', true, 'boolean')
})

it('should make snapsot of band chart', () => {
cy.visitTest('Band Chart', 'Static: groupBy applied')
cy.inputKnobs('Time Format', 'HH:mm', 'select')
it('should make snapshot of gauge', () => {
cy.visitTest('Gauge', 'Gauge')
cy.inputKnobs('Fixed data', true, 'boolean')
cy.inputKnobs('Gauge Lines', 12, 'number')
cy.wait(4000)
cy.inputKnobs('Ticks between lines', 3, 'number')

cy.snapshotComponent('gauge-test-3-ticks-between-lines-12-gauge-lines')

cy.inputKnobs('Gauge Min', 10, 'number')

cy.inputKnobs('Prefix', 'haf ', 'text')
cy.wait(2000)

cy.snapshotComponent('gauge-test-Haf-prefix-10-gauge-min')
})

it('should make snapshot of gauge', () => {
cy.visitTest('Gauge', 'Gauge')
cy.inputKnobs('Fixed data', true, 'boolean')

cy.inputKnobs('Ticks between lines', 3, 'number')

cy.snapshotComponent('gauge-test-1')
cy.snapshotComponent('gauge-test-3-ticks-between-lines')
cy.wait(2000)

cy.inputKnobs('Decimal Places', 2, 'number')
cy.inputKnobs('Gauge Max', 23, 'number')
cy.inputKnobs('Suffix', 'HKS', 'text')
cy.wait(2000)
cy.inputKnobs('Suffix', 'halsper ', 'text')

cy.snapshotComponent('gauge-test-2-decimal-places')
cy.snapshotComponent('gauge-test-suffix-prefix-type')

cy.inputKnobs('Gauge Min', 20, 'number')

cy.snapshotComponent('gauge-test-start-20')
})
})

it('should make snapchot of gauge', () => {
cy.visitTest('Gauge', 'Gauge')
cy.inputKnobs('Fixed data', true, 'boolean')

cy.inputKnobs('Decimal Places', 1, 'number')
cy.wait(3000)

cy.inputKnobs('Gauge Lines', 1, 'number')
cy.inputKnobs('Ticks between lines', 39, 'number')

cy.inputKnobs('TickPrefix', 'kdfakdhj', 'text')
cy.snapshotComponent('gauge-test-tick-prefix')

cy.inputKnobs('TickPrefix', ' ', 'text')
cy.inputKnobs('TickSuffix', 'kdkdhj', 'text')
cy.snapshotComponent('gaure-test-ticksSuffix')
}
)
})
1 change: 1 addition & 0 deletions stories/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export const snapshotComponent = (

export const inputKnobs: {
(label: string, value: string): void
(label: string, value: string, type: 'text'): void
(label: string, value: string, type: 'select'): void
(label: string, value: number, type: 'number'): void
(label: string, value: boolean, type: 'boolean'): void
Expand Down

0 comments on commit c4df4ad

Please sign in to comment.