use of uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.ServiceRecordPage.Field in project miso-lims by miso-lims.
the class ServiceRecordPageIT method testCreate.
@Test
public void testCreate() throws Exception {
// goal: add one service record
Instrument seq = (Instrument) getSession().get(InstrumentImpl.class, 200L);
assertNotNull(seq);
assertEquals(0, seq.getServiceRecords().size());
InstrumentPage seqPage = InstrumentPage.get(getDriver(), getBaseUrl(), 200L);
ServiceRecordPage page = seqPage.addServiceRecord();
assertNotNull(page);
assertEquals(seq.getName(), page.getField(Field.INSTRUMENT));
Map<Field, String> fields = Maps.newLinkedHashMap();
fields.put(Field.TITLE, "Test Service Record");
fields.put(Field.DETAILS, "Many details, all of them important");
fields.put(Field.SERVICED_BY, "Technician");
fields.put(Field.REFERENCE_NUMBER, "123456");
fields.put(Field.SERVICE_DATE, "2017-09-01");
fields.put(Field.START_TIME, "2017-08-31 16:00:00");
fields.put(Field.OUT_OF_SERVICE, "true");
fields.put(Field.END_TIME, "2017-09-01 09:00:00");
page.setFields(fields);
assertFieldValues("pre-save", fields, page);
ServiceRecordPage page2 = page.save();
assertNotNull(page2);
assertFieldValues("post-save", fields, page2);
String newId = page2.getField(Field.ID);
ServiceRecord sr = (ServiceRecord) getSession().get(ServiceRecord.class, Long.valueOf(newId));
assertServiceRecordAttributes(fields, sr);
}
Aggregations