Ignore:
Timestamp:
Mar 22, 2011, 4:33:49 PM (10 years ago)
Author:
t.w.abma@…
Message:
  • importer wizard webtest working
  • native file input HTML element didn't work inside AjaxFlow, so used hidden importfile variable
  • added check for development or test environment in configuration file
  • added webtestfiles folder to web-apps containing Excel files to test
File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/test/webtest/gscf/ImportWizardWebTests.groovy

    r1655 r1658  
    33import org.dbnp.gdt.*
    44
    5 class CreateStudyWebTests extends grails.util.WebTest {
     5class ImportWizardWebTests extends grails.util.WebTest {
    66
    77        // Unlike unit tests, functional tests are sometimes sequence dependent.
     
    1010        // e.g. test001XclassNameXListNewDelete
    1111
    12         void testCreateStudy() {
     12        void testImportWizard() {
    1313                // reset Identity to be able to predict identifiers
    1414                Identity.resetIdentifier()
     
    2222                setInputField(description: "Set password field j_password: useR123!", name: "j_password", value: "useR123!")
    2323                clickButton "Login"
    24                 clickLink "Studies"
    25 
    26                 clickLink "Create a new study"
    27                 setSelectField(name: "template", text: "Academic study")
    28                 setInputField(name: "title", value: "Test create study")
    29                 setInputField(name: "description", value: "Test study from CreateStudyWebTests.testCreateStudy()")
    30                 setInputField(name: "code", value: "TESTCREATE")
    31                 setInputField(name: "startdate", value: "01/01/2011")
    32                 clickButton "next »"
    33 
    34                 // Add 10 human subjects
    35                 setSelectField(name: "species", text: "Homo sapiens")
    36                 setSelectField(name: "template", text: "Human")
    37                 setInputField(name: "addNumber", value: "10")
    38                 clickButton "Add"
    39 
    40                 /* Stub code for testing of the template editor
    41                            setSelectField(name: "template", text: "add / modify..")
    42                            clickLink "Create new field"
    43                            setInputField(name: "name", value: "Second Species")
    44                            setSelectField(name: "type", text: "ONTOLOGYTERM")
    45                            setSelectField(name: "ontologies", text: "NCBI organismal classification")
    46                            clickButton "Save"
    47                            clickButton "Close"
    48                            setSelectField(name: "subject_793_second_species", text: "add more...")
    49                            setInputField(name: "term", value: "rat")
    50                            clickLink "Rattus norvegicus (Synonym) from: Rattus norvegicus"
    51                            clickButton "Add term"
    52                            clickButton "Close"   */
    53                 clickButton "next »"
    54 
    55                 // Add some events, sampling events, and groups
    56                 setSelectField(name: "eventTemplate", text: "Compound challenge")
    57                 setSelectField(name: "compound", text: "glucose")
    58                 clickButton "Add"
    59                 clickButton "add a new eventgroup"
    60                 setCheckbox(name: "event_13_group_11") // 51_49
    61                 setCheckbox(name: "event_13_group_14") // 51_52
    62                 setRadioButton(description: "Check radio button eventType: sample", name: "eventType", value: "sample")
    63                 setSelectField(name: "sampleTemplate", text: "Blood extraction")
    64                 setSelectField(name: "sampletemplate", text: "Human blood sample")
    65                 clickButton "Add"
    66                 setSelectField(name: "sampleTemplate", text: "Blood extraction")
    67                 setSelectField(name: "sampletemplate", text: "Human blood sample")
    68                 setInputField(name: "starttime", value: "1w")
    69                 clickButton "Add"
    70                 setCheckbox(name: "event_16_group_11") // 54_49
    71                 setCheckbox(name: "event_17_group_14") // 55_52
    72                 setRadioButton(description: "Check radio button eventType: event", name: "eventType", value: "event")
    73                 setSelectField(name: "eventTemplate", text: "Compound challenge")
    74                 setSelectField(name: "compound", text: "glucose")
    75                 clickButton "Add"
    76                 setCheckbox(name: "event_18_group_11")  // 56_49
    77                 setCheckbox(name: "event_18_group_14")  // 56_52
    78 
    79                 /* stub to test ontology term widget
    80                            setSelectField(name: "event_20_compound", text: "add more...")
    81                            setInputField(name: "term", value: "glu")
    82                            clickLink "L-glutamic acid (Synonym) from: L-glutamic acid"
    83                            clickButton "Add term"
    84                            clickButton "Close"
    85                            setSelectField(name: "event_1648_compound", text: "L-glutamic acid")
    86                            */
    87                 clickButton "next »"
    88 
    89                 // assign subjects to event groups
    90                 setCheckbox(name: "subject_1_group_11") // 39_49
    91                 setCheckbox(name: "subject_2_group_11") // 40_49
    92                 setCheckbox(name: "subject_3_group_11") // 41_49
    93                 setCheckbox(name: "subject_4_group_14") // 42_52
    94                 setCheckbox(name: "subject_5_group_14") // 43_52
    95                 setCheckbox(name: "subject_6_group_14") // 44_52
    96                 clickButton "next »"
    97 
    98                 // accept the generated samples, check if the right names are in place
    99                 /* For some reason enabling this causes the whole webtest to blow. TODO: find out why...
    100            verifyInputField(name: "sample_21_name", value="Subject1_BloodExtraction_Group1_0s")
    101            verifyInputField(name: "sample_22_name", value="Subject2_BloodExtraction_Group1_0s")
    102            verifyInputField(name: "sample_23_name", value="Subject3_BloodExtraction_Group1_0s")
    103            verifyInputField(name: "sample_24_name", value="Subject4_BloodExtraction_Group2_1w")
    104            verifyInputField(name: "sample_25_name", value="Subject5_BloodExtraction_Group2_1w")
    105            verifyInputField(name: "sample_26_name", value="Subject6_BloodExtraction_Group2_1w")
    106 
    107                    and this doesnt work apparently inside textfields: verifyText(text: "Subject1_BloodExtraction_Group1_0s")
    108 
    109                 */
    110                 clickButton "next »"
    111 
    112 
    113                 setSelectField(name: "template", text: "Clinical chemistry assay")
    114                 setInputField(name: "name", value: "test assay")
    115                 clickButton "Add"
    116                 clickButton "next »"
    117 
    118                 setCheckbox(name: "sample_22_assay_25") // 60_63
    119                 clickButton "next »"
    120                 clickButton "next »"
    121 
    122                 // and we should be done, without exceptions
    123                 // verifyText(text:'Done')
    124                 // does not seem to work, also see --> http://grails.1312388.n4.nabble.com/webtest-verifyText-doesn-t-see-AJAX-update-with-easyAjax-td2225674.html
    125 
    126                 // and view the study
    127                 clickLink "view the study"
     24       
     25        clickLink "Studies"
     26        clickLink "Import study data"
     27       
     28        setSelectField(name: "entity", text: "Study")       
     29        clickButton "next »"
     30       
     31        // Set column properties (TemplateFields)
     32        setSelectField(name: "columnproperty.index.0", text: "startDate")
     33        setSelectField(name: "columnproperty.index.1", text: "code (IDENTIFIER)")
     34        setSelectField(name: "columnproperty.index.15", text: "title")
     35        setSelectField(name: "columnproperty.index.16", text: "description")
     36        clickButton "next »"
     37       
     38        // Validate and store
     39        clickButton "next »"
     40       
     41       
    12842        }
    12943
Note: See TracChangeset for help on using the changeset viewer.