|
1 | 1 | <cfscript> |
2 | 2 | // No cf debugging |
3 | 3 | cfsetting( showdebugoutput="false" ); |
4 | | - // Path Navigation |
5 | | - param name="url.path" default=""; |
6 | | - // Root Tests Directory |
7 | | - rootMapping = "/tests/specs"; |
| 4 | + // GLOBAL VARIABLES |
| 5 | + ASSETS_DIR = expandPath( "/testbox/system/reports/assets" ); |
| 6 | + TESTBOX_VERSION = new testBox.system.TestBox().getVersion(); |
| 7 | + // TEST LOCATIONS -> UPDATE AS YOU SEE FIT |
| 8 | + rootMapping = "/tests"; |
| 9 | +
|
| 10 | + // Local Variables |
8 | 11 | rootPath = expandPath( rootMapping ); |
9 | 12 | targetPath = rootPath; |
10 | | - // Append navigation path |
| 13 | +
|
| 14 | + // Incoming Navigation |
| 15 | + param name="url.path" default=""; |
11 | 16 | if( len( url.path ) ){ |
12 | 17 | targetPath = getCanonicalPath( rootpath & "/" & url.path ); |
13 | | - // Avoid traversals |
| 18 | + // Avoid traversals, reset to root |
14 | 19 | if( !findNoCase( rootpath, targetPath ) ){ |
15 | 20 | targetPath = rootpath; |
16 | 21 | } |
17 | 22 | } |
| 23 | +
|
18 | 24 | // Get the actual execution path |
19 | 25 | executePath = rootMapping & ( len( url.path ) ? "/#url.path#" : "/" ); |
20 | | - // Directory Runner |
| 26 | + // Execute an incoming path |
21 | 27 | if( !isNull( url.action ) ){ |
22 | 28 | if( directoryExists( targetPath ) ){ |
23 | 29 | writeOutput( "#new testbox.system.TestBox( directory=executePath ).run()#" ); |
|
26 | 32 | } |
27 | 33 | abort; |
28 | 34 | } |
29 | | - // Get target path listing |
| 35 | +
|
| 36 | + // Get the tests to navigate |
30 | 37 | qResults = directoryList( targetPath, false, "query", "", "name" ); |
31 | | - // Get the back path |
| 38 | +
|
| 39 | + // Calculate the back navigation path |
32 | 40 | if( len( url.path ) ){ |
33 | 41 | backPath = url.path.listToArray( "/\" ); |
34 | 42 | backPath.pop(); |
35 | 43 | backPath = backPath.toList( "/" ); |
36 | 44 | } |
37 | | - // TestBox Assets |
38 | | - ASSETS_DIR = expandPath( "/testbox/system/reports/assets" ); |
39 | | - TESTBOX_VERSION = new testBox.system.TestBox().getVersion(); |
40 | 45 | </cfscript> |
41 | 46 | <!DOCTYPE html> |
42 | 47 | <html> |
|
82 | 87 | <div class="col-md-12 mb-4"> |
83 | 88 | <h2>Availble Test Runners: </h2> |
84 | 89 | <p> |
85 | | - Below is a listing of the runners matching the "runner*.cfm" pattern. |
| 90 | + Below is a listing of the runners matching the "runner*.(cfm|bxm)" pattern. |
86 | 91 | </p> |
87 | 92 |
|
88 | | - <cfset runners = directoryList( expandPath( "./" ), false, "query", "runner*.cfm" )> |
89 | | - <cfloop query="runners"> |
90 | | - <a href="#runners.name#" target="_blank" class="btn btn-secondary btn-sm my-1 mx-1">#runners.name#</a> |
91 | | - </cfloop> |
| 93 | + <cfset runners = directoryList( targetPath, false, "query", "runner*.cfm|runner*.bxm" )> |
| 94 | + <cfif runners.recordCount eq 0> |
| 95 | + <p class="alert alert-warning">No runners found in this directory</p> |
| 96 | + <cfelse> |
| 97 | + <cloop query="runners"> |
| 98 | + <a |
| 99 | + href="#runners.name#" |
| 100 | + target="_blank" |
| 101 | + <cfif listLast( runners.name, "." ) eq "bxm"> |
| 102 | + class="btn btn-success btn-sm my-1 mx-1" |
| 103 | + <cfelse> |
| 104 | + class="btn btn-info btn-sm my-1 mx-1" |
| 105 | + </cfif> |
| 106 | + > |
| 107 | + #runners.name# |
| 108 | + </a> |
| 109 | + </cloop> |
| 110 | + </cfif> |
92 | 111 | </div> |
93 | 112 | </div> |
94 | 113 |
|
|
116 | 135 | </cfif> |
117 | 136 |
|
118 | 137 | <cfloop query="qResults"> |
119 | | - <!--- Skip . folder file names ---> |
120 | | - <cfif refind( "^\.", qResults.name )> |
| 138 | + <!--- Skip . folder file names and runners and Application.bx, cfc---> |
| 139 | + <cfif |
| 140 | + refind( "^\.", qResults.name ) |
| 141 | + OR |
| 142 | + ( listLast( qresults.name, ".") eq "cfm" OR listLast( qresults.name, ".") eq "bxm" ) |
| 143 | + OR |
| 144 | + ( qResults.name eq "Application.cfc" OR qResults.name eq "Application.bx" ) |
| 145 | + > |
121 | 146 | <cfcontinue> |
122 | 147 | </cfif> |
123 | 148 |
|
|
129 | 154 | &##x271A; #qResults.name# |
130 | 155 | </a> |
131 | 156 | <br /> |
132 | | - <cfelseif listLast( qresults.name, ".") eq "cfm"> |
| 157 | + <cfelseif listLast( qresults.name, ".") eq "cfm" OR listLast( qresults.name, ".") eq "bxm"> |
133 | 158 | <a |
134 | 159 | class="btn btn-primary btn-sm my-1" |
135 | 160 | href="#executePath & "/" & qResults.name#" |
|
138 | 163 | #qResults.name# |
139 | 164 | </a> |
140 | 165 | <br /> |
141 | | - <cfelseif listLast( qresults.name, ".") eq "cfc" and qresults.name neq "Application.cfc"> |
| 166 | + <cfelseif |
| 167 | + listLast( qresults.name, ".") eq "cfc" OR listLast( qresults.name, ".") eq "bx" |
| 168 | + > |
142 | 169 | <a |
143 | | - class="btn btn-primary btn-sm my-1" |
| 170 | + <cfif listLast( qresults.name, ".") eq "bx"> |
| 171 | + data-bx="true" |
| 172 | + class="btn btn-success btn-sm my-1" |
| 173 | + <cfelse> |
| 174 | + data-bx="false" |
| 175 | + class="btn btn-info btn-sm my-1" |
| 176 | + </cfif> |
144 | 177 | href="#executePath & "/" & qResults.name#?method=runRemote" |
145 | 178 | target="_blank" |
146 | 179 | > |
147 | 180 | #qResults.name# |
148 | 181 | </a> |
149 | 182 | <br /> |
150 | | - <cfelse> |
151 | | - #qResults.name# |
152 | | - <br/> |
153 | 183 | </cfif> |
154 | 184 |
|
155 | 185 | </cfloop> |
|
0 commit comments