Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
afd9481
commit a60a1a3
Showing
8 changed files
with
135 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 57 additions & 1 deletion
58
src/groovy/com/grailsrocks/functionaltest/HybridTestCase.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,61 @@ | ||
package com.grailsrocks.functionaltest | ||
|
||
class HybridTestCase extends TestCaseBase { | ||
import com.grailsrocks.functionaltest.client.* | ||
|
||
class HybridTestCase extends BrowserTestCase { | ||
private Class _defaultClientType = BrowserClient | ||
|
||
Class getDefaultClientType() { | ||
_defaultClientType | ||
} | ||
|
||
void defaultClientType(String clientType) { | ||
switch (clientType) { | ||
case 'API': _defaultClientType = APIClient; | ||
break; | ||
case 'Browser': _defaultClientType = BrowserClient; | ||
break; | ||
default: | ||
throw new IllegalArgumentException("Only 'API' and 'Browser' are supported values for client type") | ||
} | ||
} | ||
|
||
|
||
boolean __isDSLMethod(String name) { | ||
if (super.__isDSLMethod(name)) { | ||
return true | ||
} | ||
|
||
name == 'withAPI' || | ||
name == 'withBrowser' | ||
} | ||
|
||
|
||
def withAPI(Closure c) { | ||
def oldclient = currentClientId | ||
client('API', APIClient) | ||
c() | ||
client(oldclient) | ||
} | ||
|
||
def withAPI(String id, Closure c) { | ||
def oldclient = currentClientId | ||
client(id, APIClient) | ||
c() | ||
client(oldclient) | ||
} | ||
|
||
def withBrowser(String id, Closure c) { | ||
def oldclient = currentClientId | ||
client(id, BrowserClient) | ||
c() | ||
client(oldclient) | ||
} | ||
|
||
def withBrowser(Closure c) { | ||
def oldclient = currentClientId | ||
client('Browser', BrowserClient) | ||
c() | ||
client(oldclient) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters