-
Notifications
You must be signed in to change notification settings - Fork 0
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
X1062 probe hybridisation qc #377
Merged
Merged
Changes from 9 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
52efa40
fixes x1062—As a PO (Minal), I want users to record probe hybridisati…
sabrine33 539d46e
Merge branch 'devel' of github.com:sanger/stan-client into x1062_prob…
sabrine33 2972700
resolving sdk.ts conflicts with devel branch
sabrine33 6141a5f
fixes x1056 As TS (Katy) I would like the visium concentration unit t…
sabrine33 165da6b
Merge branch 'devel' of github.com:sanger/stan-client into x1062_prob…
sabrine33 a9028b3
validate the labware as soon as the user scans the barcode
sabrine33 dcf5d72
Merge branch 'devel' of github.com:sanger/stan-client into x1062_prob…
sabrine33 c0963a3
update cypress ProbeHybridisationQC tests
sabrine33 d996002
update sdk for Probe Hybridisation QC
sabrine33 6578cb0
fix merging conflicts
sabrine33 139cbf7
remove unused variable
sabrine33 82b33e4
Merge branch 'devel' of github.com:sanger/stan-client into x1062_prob…
sabrine33 3ef2508
merging conflicts
sabrine33 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
import { selectOption, selectSGPNumber } from '../shared/customReactSelect.cy'; | ||
import { | ||
FindLatestOperationQuery, | ||
FindLatestOperationQueryVariables, | ||
RecordCompletionMutation, | ||
RecordCompletionMutationVariables | ||
} from '../../../src/types/sdk'; | ||
|
||
describe('Probe Hybridisation QC', () => { | ||
before(() => { | ||
cy.visit('/lab/probe_hybridisation_qc'); | ||
}); | ||
describe('On load', () => { | ||
it('displays the correct title', () => { | ||
cy.get('h1').should('have.text', 'Probe Hybridisation QC'); | ||
}); | ||
it('displays the SGP number select box', () => { | ||
cy.findByText('SGP Number').should('be.visible'); | ||
}); | ||
it('displays the labware scanner', () => { | ||
cy.findByTestId('input').should('be.visible'); | ||
}); | ||
it('save button should be hidden', () => { | ||
cy.findByText('Save').should('not.exist'); | ||
}); | ||
}); | ||
describe('When a labware is scanned', () => { | ||
describe('labware has no Probe Hybridisation Xenium operation recorded', () => { | ||
before(() => { | ||
cy.msw().then(({ worker, graphql }) => { | ||
worker.use( | ||
graphql.query<FindLatestOperationQuery, FindLatestOperationQueryVariables>( | ||
'FindLatestOperation', | ||
(req, res, ctx) => { | ||
return res.once(ctx.data({ findLatestOp: null })); | ||
} | ||
) | ||
); | ||
}); | ||
cy.get('#labwareScanInput').type('STAN-3111{enter}'); | ||
}); | ||
it('shows an error message', () => { | ||
cy.findByText( | ||
'No Probe Hybridisation Xenium operation has been recorded on the following labware: STAN-3111' | ||
).should('be.visible'); | ||
}); | ||
it('should not render the labware image', () => { | ||
cy.findByTestId('labware').should('not.exist'); | ||
}); | ||
it('should not show the save button', () => { | ||
cy.findByText('Save').should('not.exist'); | ||
}); | ||
}); | ||
describe('labware has a Probe Hybridisation Xenium operation recorded', () => { | ||
before(() => { | ||
cy.msw().then(({ worker, graphql }) => { | ||
worker.use( | ||
graphql.query<FindLatestOperationQuery, FindLatestOperationQueryVariables>( | ||
'FindLatestOperation', | ||
(req, res, ctx) => { | ||
return res.once(ctx.data({ findLatestOp: { id: 1 } })); | ||
} | ||
) | ||
); | ||
}); | ||
cy.get('#labwareScanInput').type('STAN-3112{enter}'); | ||
}); | ||
it('shows the labware image', () => { | ||
cy.findByTestId('labware').should('be.visible'); | ||
}); | ||
it('shows the completion Date time select box', () => { | ||
cy.findByLabelText('Completion Time').should('be.visible'); | ||
}); | ||
it('should init completed time to the current time', () => { | ||
cy.findByLabelText('Completion Time').should('contain.value', new Date().toISOString().split('T')[0]); | ||
}); | ||
it('shows the global comments select box', () => { | ||
cy.findByTestId('globalComment').should('be.visible'); | ||
}); | ||
it('shows the save button', () => { | ||
cy.findByText('Save').should('be.visible'); | ||
}); | ||
describe('When a selecting a comment from the global comment select box', () => { | ||
before(() => { | ||
selectOption('globalComment', 'Issue with thermal cycler'); | ||
}); | ||
it('populates table rows comment column automatically with the selected value(s)', () => { | ||
cy.get('tbody tr').eq(0).find('td').eq(6).should('have.text', 'Issue with thermal cycler'); | ||
}); | ||
}); | ||
}); | ||
}); | ||
describe('Validation', () => { | ||
describe('When the SCP number is not selected', () => { | ||
before(() => { | ||
cy.findByText('Save').click(); | ||
}); | ||
it('should display an error message requires SGP number', () => { | ||
cy.findByText('SGP Number is required').should('be.visible'); | ||
}); | ||
}); | ||
describe('When completion time is selected in the future', () => { | ||
const currentDate = new Date().toLocaleString('en-GB', { hour12: false }).split(' '); | ||
before(() => { | ||
cy.findByLabelText('Completion Time').clear().type('2075-01-01T10:00'); | ||
cy.findByText('Save').click(); | ||
}); | ||
it('should display an error message', () => { | ||
cy.findByText('Please select a time on or before current time').should('be.visible'); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('Submission', () => { | ||
context('when repeated comment specified for the same section', () => { | ||
before(() => { | ||
cy.visit('/lab/probe_hybridisation_qc'); | ||
cy.msw().then(({ worker, graphql }) => { | ||
worker.use( | ||
graphql.query<FindLatestOperationQuery, FindLatestOperationQueryVariables>( | ||
'FindLatestOperation', | ||
(req, res, ctx) => { | ||
return res.once(ctx.data({ findLatestOp: { id: 1 } })); | ||
} | ||
) | ||
); | ||
}); | ||
|
||
cy.msw().then(({ worker, graphql }) => { | ||
worker.use( | ||
graphql.mutation<RecordCompletionMutation, RecordCompletionMutationVariables>( | ||
'RecordCompletion', | ||
(req, res, ctx) => { | ||
return res.once( | ||
ctx.errors([ | ||
{ | ||
message: 'The request could not be validated.', | ||
extensions: { | ||
problems: ['Repeated comment specified in: [STAN-0EB01]'] | ||
} | ||
} | ||
]) | ||
); | ||
} | ||
) | ||
); | ||
}); | ||
selectSGPNumber('SGP1008'); | ||
cy.get('#labwareScanInput').type('STAN-0EB01{enter}'); | ||
cy.findByText('Save').click(); | ||
}); | ||
it('shows an error message', () => { | ||
cy.findByText('Repeated comment specified in: [STAN-0EB01]').should('be.visible'); | ||
}); | ||
}); | ||
context('When there is no server error', () => { | ||
before(() => { | ||
cy.msw().then(({ worker, graphql }) => { | ||
worker.use( | ||
graphql.mutation<RecordCompletionMutation, RecordCompletionMutationVariables>( | ||
'RecordCompletion', | ||
(req, res, ctx) => { | ||
return res.once( | ||
ctx.data({ | ||
recordCompletion: { | ||
operations: [ | ||
{ | ||
id: 10426 | ||
} | ||
] | ||
} | ||
}) | ||
); | ||
} | ||
) | ||
); | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a global mock handler for this as we do with all other operations in stan-client |
||
cy.findByText('Save').click(); | ||
}); | ||
|
||
it('shows a success message', () => { | ||
cy.findByText('Probe Hybridisation QC recorded for all labware(s)').should('be.visible'); | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The context name doesn't match with what it does