Skip to content

Commit 10f3ac2

Browse files
Update index.cfm
Updated to reflect `testbox/cfml/browser/index.cfm`
1 parent da6d328 commit 10f3ac2

File tree

1 file changed

+55
-25
lines changed

1 file changed

+55
-25
lines changed

tests/index.cfm

+55-25
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
11
<cfscript>
22
// No cf debugging
33
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
811
rootPath = expandPath( rootMapping );
912
targetPath = rootPath;
10-
// Append navigation path
13+
14+
// Incoming Navigation
15+
param name="url.path" default="";
1116
if( len( url.path ) ){
1217
targetPath = getCanonicalPath( rootpath & "/" & url.path );
13-
// Avoid traversals
18+
// Avoid traversals, reset to root
1419
if( !findNoCase( rootpath, targetPath ) ){
1520
targetPath = rootpath;
1621
}
1722
}
23+
1824
// Get the actual execution path
1925
executePath = rootMapping & ( len( url.path ) ? "/#url.path#" : "/" );
20-
// Directory Runner
26+
// Execute an incoming path
2127
if( !isNull( url.action ) ){
2228
if( directoryExists( targetPath ) ){
2329
writeOutput( "#new testbox.system.TestBox( directory=executePath ).run()#" );
@@ -26,17 +32,16 @@
2632
}
2733
abort;
2834
}
29-
// Get target path listing
35+
36+
// Get the tests to navigate
3037
qResults = directoryList( targetPath, false, "query", "", "name" );
31-
// Get the back path
38+
39+
// Calculate the back navigation path
3240
if( len( url.path ) ){
3341
backPath = url.path.listToArray( "/\" );
3442
backPath.pop();
3543
backPath = backPath.toList( "/" );
3644
}
37-
// TestBox Assets
38-
ASSETS_DIR = expandPath( "/testbox/system/reports/assets" );
39-
TESTBOX_VERSION = new testBox.system.TestBox().getVersion();
4045
</cfscript>
4146
<!DOCTYPE html>
4247
<html>
@@ -82,13 +87,27 @@
8287
<div class="col-md-12 mb-4">
8388
<h2>Availble Test Runners: </h2>
8489
<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.
8691
</p>
8792
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>
92111
</div>
93112
</div>
94113
@@ -116,8 +135,14 @@
116135
</cfif>
117136
118137
<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+
>
121146
<cfcontinue>
122147
</cfif>
123148
@@ -129,7 +154,7 @@
129154
&##x271A; #qResults.name#
130155
</a>
131156
<br />
132-
<cfelseif listLast( qresults.name, ".") eq "cfm">
157+
<cfelseif listLast( qresults.name, ".") eq "cfm" OR listLast( qresults.name, ".") eq "bxm">
133158
<a
134159
class="btn btn-primary btn-sm my-1"
135160
href="#executePath & "/" & qResults.name#"
@@ -138,18 +163,23 @@
138163
#qResults.name#
139164
</a>
140165
<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+
>
142169
<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>
144177
href="#executePath & "/" & qResults.name#?method=runRemote"
145178
target="_blank"
146179
>
147180
#qResults.name#
148181
</a>
149182
<br />
150-
<cfelse>
151-
#qResults.name#
152-
<br/>
153183
</cfif>
154184
155185
</cfloop>

0 commit comments

Comments
 (0)