Skip to content

Commit

Permalink
added tests for papi and json play and stop in the middle of a run
Browse files Browse the repository at this point in the history
  • Loading branch information
TamarZanzouri committed Apr 4, 2024
1 parent c5249d3 commit 6c812d6
Show file tree
Hide file tree
Showing 4 changed files with 277 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
test_name: Test python protocol run commands are failed when stopped.

marks:
- usefixtures:
- ot2_server_base_url
stages:
- name: Upload a python protocol
request:
url: '{ot2_server_base_url}/protocols'
method: POST
files:
files: 'tests/integration/protocols/wait_for_resume_stop_papi.py'
response:
status_code: 201
save:
json:
protocol_id: data.id

- name: Create run from protocol
request:
url: '{ot2_server_base_url}/runs'
method: POST
json:
data:
protocolId: '{protocol_id}'
response:
status_code: 201
save:
json:
run_id: data.id

- name: Play the run
request:
url: '{ot2_server_base_url}/runs/{run_id}/actions'
method: POST
json:
data:
actionType: play
response:
status_code: 201

- name: Stop the run
request:
url: '{ot2_server_base_url}/runs/{run_id}/actions'
method: POST
json:
data:
actionType: stop
response:
status_code: 201

- name: Wait for the run to complete
max_retries: 10
delay_after: 0.2
request:
url: '{ot2_server_base_url}/runs/{run_id}'
method: GET
response:
status_code: 200
strict:
- json:off
json:
data:
status: stopped

- name: Get run commands
max_retries: 10
delay_after: 0.2
request:
url: '{ot2_server_base_url}/runs/{run_id}/commands'
method: GET
response:
status_code: 200
strict:
- json:off
json:
data:
- id: !anystr
key: !anystr
commandType: home
createdAt: !anystr
startedAt: !anystr
completedAt: !anystr
status: succeeded
params: {}
notes: []
- id: !anystr
key: !anystr
commandType: home
createdAt: !anystr
startedAt: !anystr
completedAt: !anystr
status: succeeded
params: { }
notes: [ ]
- id: !anystr
key: !anystr
commandType: waitForResume
createdAt: !anystr
startedAt: !anystr
completedAt: !anystr
status: failed
params: { }
notes: [ ]
error:
createdAt: !anystr
detail: 'Run was cancelled'
errorCode: '4000'
errorInfo: { }
errorType: 'RunStoppedError'
id: !anystr
wrappedErrors: [ ]


Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
test_name: Test a JSONv6 run can be paused and then cancelled.

marks:
- usefixtures:
- ot2_server_base_url
stages:
- name: Upload a JSONv6 protocol
request:
url: '{ot2_server_base_url}/protocols'
method: POST
files:
files: 'tests/integration/protocols/wait_for_resume_stop_v6.json'
response:
status_code: 201
save:
json:
protocol_id: data.id

- name: Create run from protocol
request:
url: '{ot2_server_base_url}/runs'
method: POST
json:
data:
protocolId: '{protocol_id}'
response:
status_code: 201
save:
json:
run_id: data.id

- name: Play the run
request:
url: '{ot2_server_base_url}/runs/{run_id}/actions'
method: POST
json:
data:
actionType: play
response:
status_code: 201

- name: Stop the run
request:
url: '{ot2_server_base_url}/runs/{run_id}/actions'
method: POST
json:
data:
actionType: stop
response:
status_code: 201

- name: Wait for the run to complete
max_retries: 10
delay_after: 0.2
request:
url: '{ot2_server_base_url}/runs/{run_id}'
method: GET
response:
status_code: 200
strict:
- json:off
json:
data:
status: stopped

- name: Get run commands
max_retries: 10
delay_after: 0.2
request:
url: '{ot2_server_base_url}/runs/{run_id}/commands'
method: GET
response:
status_code: 200
strict:
- json:off
json:
data:
- id: !anystr
key: !anystr
commandType: home
createdAt: !anystr
startedAt: !anystr
completedAt: !anystr
status: succeeded
params: {}
notes: []
- id: !anystr
key: !anystr
commandType: home
createdAt: !anystr
startedAt: !anystr
completedAt: !anystr
status: succeeded
params: { }
notes: [ ]
- id: !anystr
key: !anystr
commandType: waitForResume
createdAt: !anystr
startedAt: !anystr
completedAt: !anystr
status: failed
params: { }
notes: [ ]
error:
createdAt: !anystr
detail: 'Run was cancelled'
errorCode: '4000'
errorInfo: { }
errorType: 'RunStoppedError'
id: !anystr
wrappedErrors: [ ]


Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from opentrons.protocol_api import ProtocolContext

metadata = {
"protocolName": "stop while waiting test",
"author": "Opentrons <[email protected]>",
"apiLevel": "2.15",
}


def run(ctx: ProtocolContext) -> None:
ctx.home()
ctx.pause()
ctx.set_rail_lights(on=True)
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"$otSharedSchema": "#/protocol/schemas/6",
"schemaVersion": 6,
"metadata": {
"protocolName": "Simple test protocol",
"author": "engineering <[email protected]>",
"description": "A short test protocol",
"created": 1223131231,
"tags": ["unitTest"]
},
"robot": {
"model": "OT-2 Standard",
"deckId": "ot2_standard"
},
"pipettes": {},
"modules": {},
"labware": {},
"liquids": {},
"labwareDefinitions": {},
"commands": [
{
"commandType": "home",
"params": {}
},
{
"commandType": "waitForResume",
"params": {
}
},
{
"commandType": "home",
"params": {}
}
],
"commandAnnotations": []
}

0 comments on commit 6c812d6

Please sign in to comment.