Search in sources :

Example 1 with InstrumentPage

use of uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.InstrumentPage in project miso-lims by miso-lims.

the class InstrumentPageIT method testStatusEffects.

@Test
public void testStatusEffects() throws Exception {
    // goal: ensure the Status radio buttons affect the visible fields as expected
    InstrumentPage page = InstrumentPage.get(getDriver(), getBaseUrl(), 102L);
    // check initial values
    Map<Field, String> fields = Maps.newLinkedHashMap();
    fields.put(Field.ID, "102");
    fields.put(Field.INSTRUMENT_MODEL, "Illumina - Illumina HiSeq 2500");
    fields.put(Field.NAME, "OldHiSeq_102");
    fields.put(Field.COMMISSIONED, "2017-01-01");
    fields.put(Field.STATUS, "Upgraded");
    fields.put(Field.DECOMMISSIONED, "2017-02-01");
    fields.put(Field.UPGRADED_INSTRUMENT, "NewHiSeq_101");
    fields.put(Field.DEFAULT_PURPOSE, "Production");
    assertFieldValues("loaded (upgraded)", fields, page);
    // set status to retired
    Map<Field, String> retired = Maps.newLinkedHashMap();
    retired.put(Field.STATUS, "Retired");
    page.setFields(retired);
    // copy unchanged except for Upgraded Instrument name, which should be hidden
    fields.forEach((key, val) -> {
        if (!retired.containsKey(key) && !Field.UPGRADED_INSTRUMENT.equals(key))
            retired.put(key, val);
    });
    assertFieldValues("changes pre-save (retired)", retired, page);
    InstrumentPage retiredPage = page.save();
    assertNotNull(retiredPage);
    assertFieldValues("changes post-save (retired)", retired, retiredPage);
    // set status to production
    Map<Field, String> production = Maps.newLinkedHashMap();
    production.put(Field.STATUS, "Production");
    page.setFields(production);
    // copy unchanged except for Decommissioned date, which should be hidden
    retired.forEach((key, val) -> {
        if (!production.containsKey(key) && !Field.DECOMMISSIONED.equals(key))
            production.put(key, val);
    });
    assertFieldValues("changes pre-save (production)", production, page);
    InstrumentPage productionPage = page.save();
    assertNotNull(productionPage);
    assertFieldValues("changes post-save (production)", production, productionPage);
}
Also used : InstrumentPage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.InstrumentPage) Field(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.InstrumentPage.Field) Test(org.junit.Test)

Example 2 with InstrumentPage

use of uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.InstrumentPage 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)

Example 3 with InstrumentPage

use of uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.InstrumentPage in project miso-lims by miso-lims.

the class InstrumentPageIT method testChangeValues.

@Test
public void testChangeValues() throws Exception {
    // goal: test editing all editable fields on an instrument
    InstrumentPage page = InstrumentPage.get(getDriver(), getBaseUrl(), 100L);
    // check initial values
    Map<Field, String> fields = Maps.newLinkedHashMap();
    fields.put(Field.ID, "100");
    fields.put(Field.COMMISSIONED, "2017-01-01");
    fields.put(Field.INSTRUMENT_MODEL, "Illumina - Illumina HiSeq 2500");
    fields.put(Field.SERIAL_NUMBER, "100");
    fields.put(Field.NAME, "HiSeq_100");
    fields.put(Field.STATUS, "Production");
    fields.put(Field.DEFAULT_PURPOSE, "Production");
    assertFieldValues("loaded", fields, page);
    // make changes
    Map<Field, String> changes = Maps.newLinkedHashMap();
    changes.put(Field.NAME, "HiSeq_changed_100");
    changes.put(Field.SERIAL_NUMBER, "100100");
    changes.put(Field.COMMISSIONED, "2017-01-31");
    changes.put(Field.STATUS, "Retired");
    changes.put(Field.DECOMMISSIONED, "2017-10-31");
    page.setFields(changes);
    // need to make sure this is done after the status change is made
    // copy unchanged
    fields.forEach((key, val) -> {
        if (!changes.containsKey(key))
            changes.put(key, val);
    });
    assertFieldValues("changes pre-save", changes, page);
    InstrumentPage page2 = page.save();
    assertNotNull(page2);
    assertFieldValues("changes post-save", changes, page2);
    Instrument sr = (Instrument) getSession().get(InstrumentImpl.class, 100L);
    assertInstrumentAttributes(changes, sr);
}
Also used : InstrumentPage(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.InstrumentPage) Field(uk.ac.bbsrc.tgac.miso.webapp.integrationtest.page.InstrumentPage.Field) InstrumentImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.InstrumentImpl) Instrument(uk.ac.bbsrc.tgac.miso.core.data.Instrument) Test(org.junit.Test)

Aggregations

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