Search in sources :

Example 1 with Field

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);
}
Also used : InstrumentPage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.InstrumentPage) Field(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.ServiceRecordPage.Field) InstrumentImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.InstrumentImpl) Instrument(uk.ac.bbsrc.tgac.miso.core.data.Instrument) ServiceRecordPage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.ServiceRecordPage) ServiceRecord(uk.ac.bbsrc.tgac.miso.core.data.ServiceRecord) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 Instrument (uk.ac.bbsrc.tgac.miso.core.data.Instrument)1 ServiceRecord (uk.ac.bbsrc.tgac.miso.core.data.ServiceRecord)1 InstrumentImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.InstrumentImpl)1 InstrumentPage (uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.InstrumentPage)1 ServiceRecordPage (uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.ServiceRecordPage)1 Field (uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.ServiceRecordPage.Field)1