Changeset 1389


Ignore:
Timestamp:
Jan 13, 2011, 12:51:17 PM (6 years ago)
Author:
work@…
Message:
  • adding a simple edit study webtest
Location:
trunk/test/webtest/gscf
Files:
1 added
1 edited

Legend:

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

    r1384 r1389  
    55class CreateStudyWebTests extends grails.util.WebTest {
    66
    7     // Unlike unit tests, functional tests are sometimes sequence dependent.
    8     // Methods starting with 'test' will be run automatically in alphabetical order.
    9     // If you require a specific sequence, prefix the method name (following 'test') with a sequence
    10     // e.g. test001XclassNameXListNewDelete
     7        // Unlike unit tests, functional tests are sometimes sequence dependent.
     8        // Methods starting with 'test' will be run automatically in alphabetical order.
     9        // If you require a specific sequence, prefix the method name (following 'test') with a sequence
     10        // e.g. test001XclassNameXListNewDelete
    1111
    12    void testCreateStudy() {
     12        void testCreateStudy() {
    1313
    14            // make sure Canoo waits for AJAX calls
    15            config(easyajax:true)
     14                // make sure Canoo waits for AJAX calls
     15                config(easyajax: true)
    1616
    17            invoke "http://localhost:8080/gscf/"
    18            clickLink(description: "Click link: Log In | Register", htmlId: "open")
    19            setInputField(name: "j_username", value: "user")
    20            setInputField(description: "Set password field j_password: useR123!", name: "j_password", value: "useR123!")
    21            clickButton "Login"
    22            clickLink "Studies"
     17                invoke "http://localhost:8080/gscf/"
     18                clickLink(description: "Click link: Log In | Register", htmlId: "open")
     19                setInputField(name: "j_username", value: "user")
     20                setInputField(description: "Set password field j_password: useR123!", name: "j_password", value: "useR123!")
     21                clickButton "Login"
     22                clickLink "Studies"
    2323
    24            clickLink "Create a new study"
    25            setSelectField(name: "template", text: "Academic study")
    26            setInputField(name: "title", value: "Test create study")
    27            setInputField(name: "description", value: "Test study from CreateStudyWebTests.testCreateStudy()")
    28            setInputField(name: "code", value: "TESTCREATE")
    29            setInputField(name: "startdate", value: "01/01/2011")
    30            clickButton "next »"
     24                clickLink "Create a new study"
     25                setSelectField(name: "template", text: "Academic study")
     26                setInputField(name: "title", value: "Test create study")
     27                setInputField(name: "description", value: "Test study from CreateStudyWebTests.testCreateStudy()")
     28                setInputField(name: "code", value: "TESTCREATE")
     29                setInputField(name: "startdate", value: "01/01/2011")
     30                clickButton "next »"
    3131
    32            // Add 10 human subjects
    33            setSelectField(name: "species", text: "Homo sapiens")
    34            setSelectField(name: "template", text: "Human")
    35            setInputField(name: "addNumber", value: "10")
    36            clickButton "Add"
     32                // Add 10 human subjects
     33                setSelectField(name: "species", text: "Homo sapiens")
     34                setSelectField(name: "template", text: "Human")
     35                setInputField(name: "addNumber", value: "10")
     36                clickButton "Add"
    3737
    38            /* Stub code for testing of the template editor
    39            setSelectField(name: "template", text: "add / modify..")
    40            clickLink "Create new field"
    41            setInputField(name: "name", value: "Second Species")
    42            setSelectField(name: "type", text: "ONTOLOGYTERM")
    43            setSelectField(name: "ontologies", text: "NCBI organismal classification")
    44            clickButton "Save"
    45            clickButton "Close"
    46            setSelectField(name: "subject_793_second_species", text: "add more...")
    47            setInputField(name: "term", value: "rat")
    48            clickLink "Rattus norvegicus (Synonym) from: Rattus norvegicus"
    49            clickButton "Add term"
    50            clickButton "Close"   */
    51            clickButton "next »"
     38                /* Stub code for testing of the template editor
     39                           setSelectField(name: "template", text: "add / modify..")
     40                           clickLink "Create new field"
     41                           setInputField(name: "name", value: "Second Species")
     42                           setSelectField(name: "type", text: "ONTOLOGYTERM")
     43                           setSelectField(name: "ontologies", text: "NCBI organismal classification")
     44                           clickButton "Save"
     45                           clickButton "Close"
     46                           setSelectField(name: "subject_793_second_species", text: "add more...")
     47                           setInputField(name: "term", value: "rat")
     48                           clickLink "Rattus norvegicus (Synonym) from: Rattus norvegicus"
     49                           clickButton "Add term"
     50                           clickButton "Close"   */
     51                clickButton "next »"
    5252
    53            // Add some events, sampling events, and groups
    54            setSelectField(name: "eventTemplate", text: "Compound challenge")
    55            setSelectField(name: "compound", text: "glucose")
    56            clickButton "Add"
    57            clickButton "add a new eventgroup"
    58            setCheckbox(name: "event_15_group_13")
    59            setCheckbox(name: "event_15_group_16")
    60            setRadioButton(description: "Check radio button eventType: sample", name: "eventType", value: "sample")
    61            setSelectField(name: "sampleTemplate", text: "Blood extraction")
    62            setSelectField(name: "sampletemplate", text: "Human blood sample")
    63            clickButton "Add"
    64            setSelectField(name: "sampleTemplate", text: "Blood extraction")
    65            setSelectField(name: "sampletemplate", text: "Human blood sample")
    66            setInputField(name: "starttime", value: "1w")
    67            clickButton "Add"
    68            setCheckbox(name: "event_18_group_13")
    69            setCheckbox(name: "event_19_group_16")
    70            setRadioButton(description: "Check radio button eventType: event", name: "eventType", value: "event")
    71            setSelectField(name: "eventTemplate", text: "Compound challenge")
    72            setSelectField(name: "compound", text: "glucose")
    73            clickButton "Add"
    74            setCheckbox(name: "event_20_group_13")
    75            setCheckbox(name: "event_20_group_16")
     53                // Add some events, sampling events, and groups
     54                setSelectField(name: "eventTemplate", text: "Compound challenge")
     55                setSelectField(name: "compound", text: "glucose")
     56                clickButton "Add"
     57                clickButton "add a new eventgroup"
     58                setCheckbox(name: "event_15_group_13")
     59                setCheckbox(name: "event_15_group_16")
     60                setRadioButton(description: "Check radio button eventType: sample", name: "eventType", value: "sample")
     61                setSelectField(name: "sampleTemplate", text: "Blood extraction")
     62                setSelectField(name: "sampletemplate", text: "Human blood sample")
     63                clickButton "Add"
     64                setSelectField(name: "sampleTemplate", text: "Blood extraction")
     65                setSelectField(name: "sampletemplate", text: "Human blood sample")
     66                setInputField(name: "starttime", value: "1w")
     67                clickButton "Add"
     68                setCheckbox(name: "event_18_group_13")
     69                setCheckbox(name: "event_19_group_16")
     70                setRadioButton(description: "Check radio button eventType: event", name: "eventType", value: "event")
     71                setSelectField(name: "eventTemplate", text: "Compound challenge")
     72                setSelectField(name: "compound", text: "glucose")
     73                clickButton "Add"
     74                setCheckbox(name: "event_20_group_13")
     75                setCheckbox(name: "event_20_group_16")
    7676
    77            /* stub to test ontology term widget
    78            setSelectField(name: "event_20_compound", text: "add more...")
    79            setInputField(name: "term", value: "glu")
    80            clickLink "L-glutamic acid (Synonym) from: L-glutamic acid"
    81            clickButton "Add term"
    82            clickButton "Close"
    83            setSelectField(name: "event_1648_compound", text: "L-glutamic acid")
    84            */
    85            clickButton "next »"
     77                /* stub to test ontology term widget
     78                           setSelectField(name: "event_20_compound", text: "add more...")
     79                           setInputField(name: "term", value: "glu")
     80                           clickLink "L-glutamic acid (Synonym) from: L-glutamic acid"
     81                           clickButton "Add term"
     82                           clickButton "Close"
     83                           setSelectField(name: "event_1648_compound", text: "L-glutamic acid")
     84                           */
     85                clickButton "next »"
    8686
     87                // assign subjects to event groups
     88                setCheckbox(name: "subject_3_group_13")
     89                setCheckbox(name: "subject_4_group_13")
     90                setCheckbox(name: "subject_5_group_13")
     91                setCheckbox(name: "subject_6_group_16")
     92                setCheckbox(name: "subject_7_group_16")
     93                setCheckbox(name: "subject_8_group_16")
     94                clickButton "next »"
    8795
    88            // assign subjects to event groups
    89            setCheckbox(name: "subject_3_group_13")
    90            setCheckbox(name: "subject_4_group_13")
    91            setCheckbox(name: "subject_5_group_13")
    92            setCheckbox(name: "subject_6_group_16")
    93            setCheckbox(name: "subject_7_group_16")
    94            setCheckbox(name: "subject_8_group_16")
    95            clickButton "next »"
    96 
    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...
     96                // accept the generated samples, check if the right names are in place
     97                /* For some reason enabling this causes the whole webtest to blow. TODO: find out why...
    10098           verifyInputField(name: "sample_21_name", value="Subject1_BloodExtraction_Group1_0s")
    10199           verifyInputField(name: "sample_22_name", value="Subject2_BloodExtraction_Group1_0s")
     
    105103           verifyInputField(name: "sample_26_name", value="Subject6_BloodExtraction_Group2_1w")
    106104
    107                and this doesnt work apparently inside textfields: verifyText(text: "Subject1_BloodExtraction_Group1_0s")
     105                   and this doesnt work apparently inside textfields: verifyText(text: "Subject1_BloodExtraction_Group1_0s")
    108106
    109107                */
    110            clickButton "next »"
     108                clickButton "next »"
    111109
    112110
    113            setSelectField(name: "template", text: "Clinical chemistry assay")
    114            setInputField(name: "name", value: "test assay")
    115            clickButton "Add"
    116            clickButton "next »"
     111                setSelectField(name: "template", text: "Clinical chemistry assay")
     112                setInputField(name: "name", value: "test assay")
     113                clickButton "Add"
     114                clickButton "next »"
    117115
    118            setCheckbox(name: "sample_21_assay_27")
    119            clickButton "next »"
    120            clickButton "next »"
    121            clickLink "view the study"
    122     }
     116                setCheckbox(name: "sample_21_assay_27")
     117                clickButton "next »"
     118                clickButton "next »"
     119
     120                // and we should be done, without exceptions
     121                // verifyText(text:'Done')
     122                // does not seem to work, also see --> http://grails.1312388.n4.nabble.com/webtest-verifyText-doesn-t-see-AJAX-update-with-easyAjax-td2225674.html
     123
     124                // and view the study
     125                clickLink "view the study"
     126        }
    123127
    124128}
Note: See TracChangeset for help on using the changeset viewer.