hotstaq 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +123 -0
- package/.eslintignore +17 -0
- package/.eslintrc.js +11 -0
- package/.vscode/launch.json +201 -0
- package/.vscode/settings.json +2 -0
- package/.vscode/tasks.json +88 -0
- package/CONTRIBUTING.md +157 -0
- package/LICENSE +21 -0
- package/README.md +128 -0
- package/bin/hotstaq +3 -0
- package/bin/hotstaq.cmd +1 -0
- package/build/src/Hot.d.ts +167 -0
- package/build/src/Hot.d.ts.map +1 -0
- package/build/src/Hot.js +365 -0
- package/build/src/Hot.js.map +1 -0
- package/build/src/HotAPI.d.ts +137 -0
- package/build/src/HotAPI.d.ts.map +1 -0
- package/build/src/HotAPI.js +353 -0
- package/build/src/HotAPI.js.map +1 -0
- package/build/src/HotAgentAPI.d.ts +22 -0
- package/build/src/HotAgentAPI.d.ts.map +1 -0
- package/build/src/HotAgentAPI.js +85 -0
- package/build/src/HotAgentAPI.js.map +1 -0
- package/build/src/HotAgentRoute.d.ts +17 -0
- package/build/src/HotAgentRoute.d.ts.map +1 -0
- package/build/src/HotAgentRoute.js +109 -0
- package/build/src/HotAgentRoute.js.map +1 -0
- package/build/src/HotBuilder.d.ts +52 -0
- package/build/src/HotBuilder.d.ts.map +1 -0
- package/build/src/HotBuilder.js +242 -0
- package/build/src/HotBuilder.js.map +1 -0
- package/build/src/HotClient.d.ts +31 -0
- package/build/src/HotClient.d.ts.map +1 -0
- package/build/src/HotClient.js +19 -0
- package/build/src/HotClient.js.map +1 -0
- package/build/src/HotComponent.d.ts +118 -0
- package/build/src/HotComponent.d.ts.map +1 -0
- package/build/src/HotComponent.js +89 -0
- package/build/src/HotComponent.js.map +1 -0
- package/build/src/HotCreator.d.ts +88 -0
- package/build/src/HotCreator.d.ts.map +1 -0
- package/build/src/HotCreator.js +445 -0
- package/build/src/HotCreator.js.map +1 -0
- package/build/src/HotDB.d.ts +69 -0
- package/build/src/HotDB.d.ts.map +1 -0
- package/build/src/HotDB.js +29 -0
- package/build/src/HotDB.js.map +1 -0
- package/build/src/HotDBConnectionInterface.d.ts +40 -0
- package/build/src/HotDBConnectionInterface.d.ts.map +1 -0
- package/build/src/HotDBConnectionInterface.js +3 -0
- package/build/src/HotDBConnectionInterface.js.map +1 -0
- package/build/src/HotFile.d.ts +134 -0
- package/build/src/HotFile.d.ts.map +1 -0
- package/build/src/HotFile.js +454 -0
- package/build/src/HotFile.js.map +1 -0
- package/build/src/HotGenerator.d.ts +80 -0
- package/build/src/HotGenerator.d.ts.map +1 -0
- package/build/src/HotGenerator.js +342 -0
- package/build/src/HotGenerator.js.map +1 -0
- package/build/src/HotHTTPServer.d.ts +162 -0
- package/build/src/HotHTTPServer.d.ts.map +1 -0
- package/build/src/HotHTTPServer.js +863 -0
- package/build/src/HotHTTPServer.js.map +1 -0
- package/build/src/HotIO.d.ts +47 -0
- package/build/src/HotIO.d.ts.map +1 -0
- package/build/src/HotIO.js +232 -0
- package/build/src/HotIO.js.map +1 -0
- package/build/src/HotLog.d.ts +60 -0
- package/build/src/HotLog.d.ts.map +1 -0
- package/build/src/HotLog.js +126 -0
- package/build/src/HotLog.js.map +1 -0
- package/build/src/HotPage.d.ts +125 -0
- package/build/src/HotPage.d.ts.map +1 -0
- package/build/src/HotPage.js +178 -0
- package/build/src/HotPage.js.map +1 -0
- package/build/src/HotRoute.d.ts +82 -0
- package/build/src/HotRoute.d.ts.map +1 -0
- package/build/src/HotRoute.js +83 -0
- package/build/src/HotRoute.js.map +1 -0
- package/build/src/HotRouteMethod.d.ts +129 -0
- package/build/src/HotRouteMethod.d.ts.map +1 -0
- package/build/src/HotRouteMethod.js +84 -0
- package/build/src/HotRouteMethod.js.map +1 -0
- package/build/src/HotServer.d.ts +152 -0
- package/build/src/HotServer.d.ts.map +1 -0
- package/build/src/HotServer.js +109 -0
- package/build/src/HotServer.js.map +1 -0
- package/build/src/HotSetAsWeb.d.ts +2 -0
- package/build/src/HotSetAsWeb.d.ts.map +1 -0
- package/build/src/HotSetAsWeb.js +5 -0
- package/build/src/HotSetAsWeb.js.map +1 -0
- package/build/src/HotStaq.d.ts +603 -0
- package/build/src/HotStaq.d.ts.map +1 -0
- package/build/src/HotStaq.js +1260 -0
- package/build/src/HotStaq.js.map +1 -0
- package/build/src/HotStaqWeb.d.ts +18 -0
- package/build/src/HotStaqWeb.d.ts.map +1 -0
- package/build/src/HotStaqWeb.js +44 -0
- package/build/src/HotStaqWeb.js.map +1 -0
- package/build/src/HotTestDriver.d.ts +63 -0
- package/build/src/HotTestDriver.d.ts.map +1 -0
- package/build/src/HotTestDriver.js +187 -0
- package/build/src/HotTestDriver.js.map +1 -0
- package/build/src/HotTestElement.d.ts +71 -0
- package/build/src/HotTestElement.d.ts.map +1 -0
- package/build/src/HotTestElement.js +37 -0
- package/build/src/HotTestElement.js.map +1 -0
- package/build/src/HotTestMap.d.ts +83 -0
- package/build/src/HotTestMap.d.ts.map +1 -0
- package/build/src/HotTestMap.js +58 -0
- package/build/src/HotTestMap.js.map +1 -0
- package/build/src/HotTestSeleniumDriver.d.ts +86 -0
- package/build/src/HotTestSeleniumDriver.d.ts.map +1 -0
- package/build/src/HotTestSeleniumDriver.js +400 -0
- package/build/src/HotTestSeleniumDriver.js.map +1 -0
- package/build/src/HotTester.d.ts +188 -0
- package/build/src/HotTester.d.ts.map +1 -0
- package/build/src/HotTester.js +622 -0
- package/build/src/HotTester.js.map +1 -0
- package/build/src/HotTesterAPI.d.ts +15 -0
- package/build/src/HotTesterAPI.d.ts.map +1 -0
- package/build/src/HotTesterAPI.js +161 -0
- package/build/src/HotTesterAPI.js.map +1 -0
- package/build/src/HotTesterMocha.d.ts +50 -0
- package/build/src/HotTesterMocha.d.ts.map +1 -0
- package/build/src/HotTesterMocha.js +205 -0
- package/build/src/HotTesterMocha.js.map +1 -0
- package/build/src/HotTesterMochaSelenium.d.ts +70 -0
- package/build/src/HotTesterMochaSelenium.d.ts.map +1 -0
- package/build/src/HotTesterMochaSelenium.js +257 -0
- package/build/src/HotTesterMochaSelenium.js.map +1 -0
- package/build/src/HotTesterServer.d.ts +114 -0
- package/build/src/HotTesterServer.d.ts.map +1 -0
- package/build/src/HotTesterServer.js +575 -0
- package/build/src/HotTesterServer.js.map +1 -0
- package/build/src/api copy.d.ts +2 -0
- package/build/src/api copy.d.ts.map +1 -0
- package/build/src/api copy.js +153 -0
- package/build/src/api copy.js.map +1 -0
- package/build/src/api-web.d.ts +2 -0
- package/build/src/api-web.d.ts.map +1 -0
- package/build/src/api-web.js +45 -0
- package/build/src/api-web.js.map +1 -0
- package/build/src/api.d.ts +33 -0
- package/build/src/api.d.ts.map +1 -0
- package/build/src/api.js +78 -0
- package/build/src/api.js.map +1 -0
- package/build/src/cli.d.ts +2 -0
- package/build/src/cli.d.ts.map +1 -0
- package/build/src/cli.js +1040 -0
- package/build/src/cli.js.map +1 -0
- package/build/src/schemas/HotDBInflux.d.ts +63 -0
- package/build/src/schemas/HotDBInflux.d.ts.map +1 -0
- package/build/src/schemas/HotDBInflux.js +239 -0
- package/build/src/schemas/HotDBInflux.js.map +1 -0
- package/build/src/schemas/HotDBMigration.d.ts +19 -0
- package/build/src/schemas/HotDBMigration.d.ts.map +1 -0
- package/build/src/schemas/HotDBMigration.js +15 -0
- package/build/src/schemas/HotDBMigration.js.map +1 -0
- package/build/src/schemas/HotDBMySQL.d.ts +65 -0
- package/build/src/schemas/HotDBMySQL.d.ts.map +1 -0
- package/build/src/schemas/HotDBMySQL.js +387 -0
- package/build/src/schemas/HotDBMySQL.js.map +1 -0
- package/build/src/schemas/HotDBSchema.d.ts +15 -0
- package/build/src/schemas/HotDBSchema.d.ts.map +1 -0
- package/build/src/schemas/HotDBSchema.js +19 -0
- package/build/src/schemas/HotDBSchema.js.map +1 -0
- package/build/src/schemas/influx/InfluxSchema.d.ts +14 -0
- package/build/src/schemas/influx/InfluxSchema.d.ts.map +1 -0
- package/build/src/schemas/influx/InfluxSchema.js +33 -0
- package/build/src/schemas/influx/InfluxSchema.js.map +1 -0
- package/build/src/schemas/mysql/MySQLSchema.d.ts +39 -0
- package/build/src/schemas/mysql/MySQLSchema.d.ts.map +1 -0
- package/build/src/schemas/mysql/MySQLSchema.js +151 -0
- package/build/src/schemas/mysql/MySQLSchema.js.map +1 -0
- package/build/src/schemas/mysql/MySQLSchemaField.d.ts +168 -0
- package/build/src/schemas/mysql/MySQLSchemaField.d.ts.map +1 -0
- package/build/src/schemas/mysql/MySQLSchemaField.js +260 -0
- package/build/src/schemas/mysql/MySQLSchemaField.js.map +1 -0
- package/build/src/schemas/mysql/MySQLSchemaTable.d.ts +49 -0
- package/build/src/schemas/mysql/MySQLSchemaTable.d.ts.map +1 -0
- package/build/src/schemas/mysql/MySQLSchemaTable.js +310 -0
- package/build/src/schemas/mysql/MySQLSchemaTable.js.map +1 -0
- package/build-web/HotStaq.js +2 -0
- package/build-web/HotStaq.min.js +119 -0
- package/build-web/HotStaqTests_HelloWorldAPI.js +133 -0
- package/builder/docker/Dockerfile.linux.gen +42 -0
- package/builder/docker/README.md +36 -0
- package/builder/docker/app/start.sh +8 -0
- package/builder/docker/dockerignore +3 -0
- package/builder/docker/scripts/build.bat +11 -0
- package/builder/docker/scripts/build.sh +11 -0
- package/builder/docker/scripts/start-app.bat +7 -0
- package/builder/docker/scripts/start-app.sh +7 -0
- package/builder/docker/scripts/stop-app.bat +5 -0
- package/builder/docker/scripts/stop-app.sh +5 -0
- package/builder/docker-compose/docker-compose.gen.yaml +41 -0
- package/builder/docker-compose/env-skeleton +4 -0
- package/creator/project/.vscode/launch.json +59 -0
- package/creator/project/README.md +20 -0
- package/creator/project/gitignore +118 -0
- package/creator/project/npmignore +118 -0
- package/creator/public/api-test.hott +28 -0
- package/creator/public/index.hott +12 -0
- package/creator/ts/src/AppAPI.ts +30 -0
- package/creator/ts/src/HelloWorld.ts +39 -0
- package/creator/ts/src/WebExport.ts +7 -0
- package/creator/ts/tsconfig-web.json +73 -0
- package/creator/ts/tsconfig.json +73 -0
- package/creator/ts/webpack-api.config.js +57 -0
- package/dbstart.sh +19 -0
- package/dbstop.sh +4 -0
- package/docs/.nojekyll +1 -0
- package/docs/README.md +130 -0
- package/docs/classes/Hot.md +477 -0
- package/docs/classes/HotAPI.md +369 -0
- package/docs/classes/HotClient.md +95 -0
- package/docs/classes/HotComponent.md +279 -0
- package/docs/classes/HotDB.md +247 -0
- package/docs/classes/HotDBInflux.md +404 -0
- package/docs/classes/HotDBMigration.md +80 -0
- package/docs/classes/HotDBMySQL.md +310 -0
- package/docs/classes/HotDBSchema.md +51 -0
- package/docs/classes/HotFile.md +353 -0
- package/docs/classes/HotHTTPServer.md +700 -0
- package/docs/classes/HotLog.md +162 -0
- package/docs/classes/HotPage.md +357 -0
- package/docs/classes/HotRoute.md +312 -0
- package/docs/classes/HotRouteMethod.md +271 -0
- package/docs/classes/HotServer.md +311 -0
- package/docs/classes/HotStaq.md +1155 -0
- package/docs/classes/HotTestDestination.md +58 -0
- package/docs/classes/HotTestDriver.md +332 -0
- package/docs/classes/HotTestElement.md +88 -0
- package/docs/classes/HotTestElementOptions.md +71 -0
- package/docs/classes/HotTestMap.md +92 -0
- package/docs/classes/HotTestSeleniumDriver.md +542 -0
- package/docs/classes/HotTester.md +653 -0
- package/docs/classes/HotTesterAPI.md +493 -0
- package/docs/classes/HotTesterMocha.md +843 -0
- package/docs/classes/HotTesterMochaSelenium.md +896 -0
- package/docs/classes/HotTesterServer.md +633 -0
- package/docs/classes/InfluxSchema.md +74 -0
- package/docs/classes/MySQLSchema.md +199 -0
- package/docs/classes/MySQLSchemaField.md +330 -0
- package/docs/classes/MySQLSchemaTable.md +176 -0
- package/docs/enums/ConnectionStatus.md +43 -0
- package/docs/enums/DeveloperMode.md +38 -0
- package/docs/enums/EventExecutionType.md +43 -0
- package/docs/enums/HTTPMethod.md +32 -0
- package/docs/enums/HotDBGenerationType.md +30 -0
- package/docs/enums/HotLogLevel.md +88 -0
- package/docs/interfaces/HotDBConnectionInterface.md +116 -0
- package/docs/interfaces/HotDestination.md +62 -0
- package/docs/interfaces/HotSite.md +187 -0
- package/docs/interfaces/HotSiteMapPath.md +37 -0
- package/docs/interfaces/HotSiteRoute.md +79 -0
- package/docs/interfaces/HotStartOptions.md +115 -0
- package/docs/interfaces/HotTestPage.md +44 -0
- package/docs/interfaces/HotTestStop.md +62 -0
- package/docs/interfaces/IHotComponent.md +135 -0
- package/docs/interfaces/IHotStaq.md +118 -0
- package/docs/interfaces/IHotTestElement.md +54 -0
- package/docs/interfaces/IHotTestElementOptions.md +43 -0
- package/docs/interfaces/MySQLResults.md +43 -0
- package/docs/interfaces/MySQLSchemaFieldResult.md +75 -0
- package/docs/modules.md +182 -0
- package/package.json +65 -0
- package/selenium-start.sh +7 -0
- package/selenium-stop.sh +3 -0
- package/src/Hot.ts +319 -0
- package/src/HotAPI.ts +386 -0
- package/src/HotAgentAPI.ts +43 -0
- package/src/HotAgentRoute.ts +44 -0
- package/src/HotBuilder.ts +221 -0
- package/src/HotClient.ts +40 -0
- package/src/HotComponent.ts +158 -0
- package/src/HotCreator.ts +470 -0
- package/src/HotDB.ts +79 -0
- package/src/HotDBConnectionInterface.ts +40 -0
- package/src/HotFile.ts +617 -0
- package/src/HotGenerator.ts +446 -0
- package/src/HotHTTPServer.ts +954 -0
- package/src/HotIO.ts +160 -0
- package/src/HotLog.ts +158 -0
- package/src/HotPage.ts +206 -0
- package/src/HotRoute.ts +137 -0
- package/src/HotRouteMethod.ts +216 -0
- package/src/HotServer.ts +211 -0
- package/src/HotSetAsWeb.ts +3 -0
- package/src/HotStaq.ts +1881 -0
- package/src/HotTestDriver.ts +171 -0
- package/src/HotTestElement.ts +97 -0
- package/src/HotTestMap.ts +130 -0
- package/src/HotTestSeleniumDriver.ts +381 -0
- package/src/HotTester.ts +696 -0
- package/src/HotTesterAPI.ts +126 -0
- package/src/HotTesterMocha.ts +133 -0
- package/src/HotTesterMochaSelenium.ts +189 -0
- package/src/HotTesterServer.ts +551 -0
- package/src/api-web.ts +48 -0
- package/src/api.ts +103 -0
- package/src/cli.ts +1225 -0
- package/src/schemas/HotDBInflux.ts +211 -0
- package/src/schemas/HotDBMigration.ts +24 -0
- package/src/schemas/HotDBMySQL.ts +312 -0
- package/src/schemas/HotDBSchema.ts +21 -0
- package/src/schemas/influx/InfluxSchema.ts +19 -0
- package/src/schemas/mysql/MySQLSchema.ts +90 -0
- package/src/schemas/mysql/MySQLSchemaField.ts +408 -0
- package/src/schemas/mysql/MySQLSchemaTable.ts +353 -0
- package/temp/HotStaqWeb.ts +59 -0
- package/tsconfig-generator.json +17 -0
- package/tsconfig-web.json +74 -0
- package/tsconfig.json +73 -0
- package/webpack.config.generator.js +41 -0
- package/webpack.config.js +53 -0
- package/webpack.config.tests.js +56 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { HotTestElement, HotTestElementOptions } from "./HotTestElement";
|
|
2
|
+
import { HotTestPage } from "./HotTestMap";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This actually executes the tests.
|
|
6
|
+
*/
|
|
7
|
+
export abstract class HotTestDriver
|
|
8
|
+
{
|
|
9
|
+
/**
|
|
10
|
+
* The current page.
|
|
11
|
+
*/
|
|
12
|
+
page: HotTestPage;
|
|
13
|
+
|
|
14
|
+
constructor (page: HotTestPage = null)
|
|
15
|
+
{
|
|
16
|
+
this.page = page;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Get a test object by it's name. If a * is used, it will be used as a
|
|
21
|
+
* wildcard for the object's name. If a > is used, then the name will
|
|
22
|
+
* be treated as a CSS selector.
|
|
23
|
+
*/
|
|
24
|
+
parseTestObject (name: string): string
|
|
25
|
+
{
|
|
26
|
+
let pos: number = name.indexOf ("*");
|
|
27
|
+
let wildcard: string = "";
|
|
28
|
+
|
|
29
|
+
if (pos > -1)
|
|
30
|
+
{
|
|
31
|
+
name = name.replace (/\*/, "");
|
|
32
|
+
wildcard = "*";
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
let selector: string = `[data-test-object-name${wildcard}='${name}']`;
|
|
36
|
+
pos = name.indexOf (">");
|
|
37
|
+
|
|
38
|
+
if (pos > -1)
|
|
39
|
+
{
|
|
40
|
+
name = name.replace (/\>/, "");
|
|
41
|
+
selector = name;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return (selector);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Wait for a number of milliseconds.
|
|
49
|
+
*/
|
|
50
|
+
async wait (numMilliseconds: number): Promise<void>
|
|
51
|
+
{
|
|
52
|
+
return (await new Promise ((resolve, reject) =>
|
|
53
|
+
{
|
|
54
|
+
setTimeout (() =>
|
|
55
|
+
{
|
|
56
|
+
resolve ();
|
|
57
|
+
}, numMilliseconds);
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Print a message.
|
|
63
|
+
*/
|
|
64
|
+
async print (message: string): Promise<void>
|
|
65
|
+
{
|
|
66
|
+
process.stdout.write (message);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Print a message line.
|
|
71
|
+
*/
|
|
72
|
+
async println (message: string): Promise<void>
|
|
73
|
+
{
|
|
74
|
+
await this.print (`${message}\n`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Disconnect this server or destroy anything associated with this HotTestDriver.
|
|
79
|
+
*/
|
|
80
|
+
abstract destroy (): Promise<void>;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Navigate to a url.
|
|
84
|
+
*/
|
|
85
|
+
abstract navigateToUrl (url: string): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Wait for a HotTestElement to load.
|
|
88
|
+
*/
|
|
89
|
+
abstract waitForTestElement (name: string | HotTestElement, options?: HotTestElementOptions): Promise<any>;
|
|
90
|
+
/**
|
|
91
|
+
* Find a HotTestElement to utilize.
|
|
92
|
+
*/
|
|
93
|
+
abstract findTestElement (name: string | HotTestElement, options?: HotTestElementOptions): Promise<any>;
|
|
94
|
+
/**
|
|
95
|
+
* Run a HotTestElement command.
|
|
96
|
+
*/
|
|
97
|
+
abstract runCommand (testElm: string | HotTestElement, funcName?: string, valueStr?: string): Promise<any>;
|
|
98
|
+
/**
|
|
99
|
+
* An expression to test.
|
|
100
|
+
*/
|
|
101
|
+
abstract assertElementValue (name: string | HotTestElement, value: any,
|
|
102
|
+
errorMessage?: string, options?: HotTestElementOptions): Promise<any>;
|
|
103
|
+
/**
|
|
104
|
+
* An expression to test.
|
|
105
|
+
*/
|
|
106
|
+
async assert (value: any, errorMessage: string = ""): Promise<any>
|
|
107
|
+
{
|
|
108
|
+
if (! (value))
|
|
109
|
+
throw new Error (errorMessage);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Run a series of test elements.
|
|
114
|
+
*/
|
|
115
|
+
async run (executions: string[] | string[][]): Promise<any[]>
|
|
116
|
+
{
|
|
117
|
+
let results: any[] = [];
|
|
118
|
+
|
|
119
|
+
for (let iIdx = 0; iIdx < executions.length; iIdx++)
|
|
120
|
+
{
|
|
121
|
+
let execution: any = executions[iIdx];
|
|
122
|
+
let testElm: HotTestElement = null;
|
|
123
|
+
let func: string = "";
|
|
124
|
+
let value: string = "";
|
|
125
|
+
|
|
126
|
+
if (typeof (execution) === "string")
|
|
127
|
+
{
|
|
128
|
+
testElm = this.page.testElements[execution];
|
|
129
|
+
|
|
130
|
+
/// @fixme This is going to wreck selecting test elements by wildcards.
|
|
131
|
+
if (testElm == null)
|
|
132
|
+
throw new Error (`HotTestDriver: Unable to find test element ${execution}`);
|
|
133
|
+
|
|
134
|
+
func = testElm.func;
|
|
135
|
+
value = testElm.value;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (execution instanceof Array)
|
|
139
|
+
{
|
|
140
|
+
let name: string = execution[0];
|
|
141
|
+
testElm = this.page.testElements[name];
|
|
142
|
+
|
|
143
|
+
// This null catch is specifically to help find wildcard test elements.
|
|
144
|
+
if (testElm == null)
|
|
145
|
+
{
|
|
146
|
+
testElm = new HotTestElement (name);
|
|
147
|
+
func = execution[1];
|
|
148
|
+
value = execution[2];
|
|
149
|
+
}
|
|
150
|
+
else
|
|
151
|
+
{
|
|
152
|
+
func = testElm.func;
|
|
153
|
+
value = testElm.value;
|
|
154
|
+
|
|
155
|
+
if (execution.length > 1)
|
|
156
|
+
func = execution[1];
|
|
157
|
+
|
|
158
|
+
if (execution.length > 2)
|
|
159
|
+
value = execution[2];
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
testElm.func = func;
|
|
164
|
+
testElm.value = value;
|
|
165
|
+
|
|
166
|
+
results.push (await this.runCommand (testElm));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return (results);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hot test element options.
|
|
3
|
+
*/
|
|
4
|
+
export interface IHotTestElementOptions
|
|
5
|
+
{
|
|
6
|
+
/**
|
|
7
|
+
* Indicates that the test element must be visible in
|
|
8
|
+
* order to select it.
|
|
9
|
+
*/
|
|
10
|
+
mustBeVisible?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* If the test element is missing, ignore the error. This
|
|
13
|
+
* will cause the rest of the function to return immediately
|
|
14
|
+
* without any exceptions being thrown.
|
|
15
|
+
*/
|
|
16
|
+
ignoreMissingElementError?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Hot test element options.
|
|
21
|
+
*/
|
|
22
|
+
export class HotTestElementOptions implements IHotTestElementOptions
|
|
23
|
+
{
|
|
24
|
+
/**
|
|
25
|
+
* Indicates that the test element must be visible in
|
|
26
|
+
* order to select it.
|
|
27
|
+
*/
|
|
28
|
+
mustBeVisible: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* If the test element is missing, ignore the error. This
|
|
31
|
+
* will cause the rest of the function to return immediately
|
|
32
|
+
* without any exceptions being thrown.
|
|
33
|
+
*/
|
|
34
|
+
ignoreMissingElementError: boolean;
|
|
35
|
+
|
|
36
|
+
constructor (copy: IHotTestElementOptions = {})
|
|
37
|
+
{
|
|
38
|
+
this.mustBeVisible = copy.mustBeVisible || true;
|
|
39
|
+
this.ignoreMissingElementError = copy.ignoreMissingElementError || false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* A test element.
|
|
45
|
+
*/
|
|
46
|
+
export interface IHotTestElement
|
|
47
|
+
{
|
|
48
|
+
/**
|
|
49
|
+
* The name of the element.
|
|
50
|
+
*/
|
|
51
|
+
name: string;
|
|
52
|
+
/**
|
|
53
|
+
* The name of the function to execute
|
|
54
|
+
* while executing the test.
|
|
55
|
+
*/
|
|
56
|
+
func?: string;
|
|
57
|
+
/**
|
|
58
|
+
* The value to use.
|
|
59
|
+
*/
|
|
60
|
+
value?: any;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* A test element.
|
|
65
|
+
*/
|
|
66
|
+
export class HotTestElement implements IHotTestElement
|
|
67
|
+
{
|
|
68
|
+
/**
|
|
69
|
+
* The name of the element.
|
|
70
|
+
*/
|
|
71
|
+
name: string;
|
|
72
|
+
/**
|
|
73
|
+
* The name of the function to execute
|
|
74
|
+
* while executing the test.
|
|
75
|
+
*/
|
|
76
|
+
func: string;
|
|
77
|
+
/**
|
|
78
|
+
* The value to use.
|
|
79
|
+
*/
|
|
80
|
+
value: any;
|
|
81
|
+
|
|
82
|
+
constructor (name: string | IHotTestElement, func: string = "", value: any = null)
|
|
83
|
+
{
|
|
84
|
+
if (typeof (name) === "string")
|
|
85
|
+
{
|
|
86
|
+
this.name = name;
|
|
87
|
+
this.func = func;
|
|
88
|
+
this.value = value;
|
|
89
|
+
}
|
|
90
|
+
else
|
|
91
|
+
{
|
|
92
|
+
this.name = name.name;
|
|
93
|
+
this.func = name.func || func;
|
|
94
|
+
this.value = name.value || value;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { HotTestElement } from "./HotTestElement";
|
|
2
|
+
import { HotTestDriver } from "./HotTestDriver";
|
|
3
|
+
import { HotSiteMapPath } from "./HotStaq";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Create a test path for later execution.
|
|
7
|
+
*/
|
|
8
|
+
export type HotTestPath = (driver: HotTestDriver, ...args: any) => Promise<any>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The destination to take in a map.
|
|
12
|
+
*/
|
|
13
|
+
export class HotTestDestination
|
|
14
|
+
{
|
|
15
|
+
/**
|
|
16
|
+
* The destination to take.
|
|
17
|
+
*/
|
|
18
|
+
destination: string;
|
|
19
|
+
/**
|
|
20
|
+
* If set to true, this will automatically start executing it's
|
|
21
|
+
* tests when it's time.
|
|
22
|
+
*/
|
|
23
|
+
autoStart: boolean;
|
|
24
|
+
|
|
25
|
+
constructor (destination: string | HotTestDestination | HotSiteMapPath = "", autoStart: boolean = true)
|
|
26
|
+
{
|
|
27
|
+
if (typeof (destination) === "string")
|
|
28
|
+
{
|
|
29
|
+
this.destination = destination;
|
|
30
|
+
this.autoStart = autoStart;
|
|
31
|
+
}
|
|
32
|
+
else
|
|
33
|
+
{
|
|
34
|
+
if (destination instanceof HotTestDestination)
|
|
35
|
+
{
|
|
36
|
+
this.destination = destination.destination;
|
|
37
|
+
this.autoStart = destination.autoStart;
|
|
38
|
+
}
|
|
39
|
+
else
|
|
40
|
+
{
|
|
41
|
+
this.destination = destination.path;
|
|
42
|
+
this.autoStart = destination.autoStart;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* A page containing only test related info.
|
|
50
|
+
*/
|
|
51
|
+
export interface HotTestPage
|
|
52
|
+
{
|
|
53
|
+
/**
|
|
54
|
+
* The elements to test on this map.
|
|
55
|
+
*/
|
|
56
|
+
testElements: { [name: string]: HotTestElement; };
|
|
57
|
+
/**
|
|
58
|
+
* The test paths to test on this map.
|
|
59
|
+
*/
|
|
60
|
+
testPaths: { [name: string]: HotTestPath; };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Maps the paths that are taken to complete a test.
|
|
65
|
+
*/
|
|
66
|
+
export class HotTestMap
|
|
67
|
+
{
|
|
68
|
+
/**
|
|
69
|
+
* The order in which paths are to be taken. Each destination is a string
|
|
70
|
+
* in a type -> path order. The type could be either a page or api route.
|
|
71
|
+
* For example:
|
|
72
|
+
* ```
|
|
73
|
+
* [
|
|
74
|
+
* "page:signin_page -> signin_path",
|
|
75
|
+
* "page:account_page -> change_username_path",
|
|
76
|
+
* "page:account_page -> change_password_path",
|
|
77
|
+
* "page:account_page -> change_name_path -> change_address_path",
|
|
78
|
+
* "page:account_page -> signout_path",
|
|
79
|
+
* "api:account_api_route -> signout_route_method -> signout_test_path"
|
|
80
|
+
* ]
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* The first string to the left of the -> will always be the type, such as a
|
|
84
|
+
* page or an api route. Any strings to the right of the -> will be a path, even
|
|
85
|
+
* when chaining addtional ->'s.
|
|
86
|
+
*/
|
|
87
|
+
destinations: HotTestDestination[] | { [name: string]: HotTestDestination; };
|
|
88
|
+
/**
|
|
89
|
+
* The order in which destinations are supposed to execute. This is
|
|
90
|
+
* ignored if the destinations are an array.
|
|
91
|
+
*/
|
|
92
|
+
destinationOrder: string[];
|
|
93
|
+
/**
|
|
94
|
+
* The test pages to execute.
|
|
95
|
+
*/
|
|
96
|
+
pages: {
|
|
97
|
+
[name: string]: HotTestPage
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
constructor (destinations: string[] | HotTestDestination[] | { [name: string]: string | HotTestDestination; } = [],
|
|
101
|
+
pages: { [name: string]: HotTestPage } = {}, destinationOrder: string[] = [])
|
|
102
|
+
{
|
|
103
|
+
// Go through and convert any strings into HotTestDestinations.
|
|
104
|
+
if (destinations instanceof Array)
|
|
105
|
+
{
|
|
106
|
+
this.destinations = [];
|
|
107
|
+
|
|
108
|
+
for (let iIdx = 0; iIdx < destinations.length; iIdx++)
|
|
109
|
+
{
|
|
110
|
+
let dest = destinations[iIdx];
|
|
111
|
+
|
|
112
|
+
this.destinations.push (new HotTestDestination (dest));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
else
|
|
116
|
+
{
|
|
117
|
+
this.destinations = {};
|
|
118
|
+
|
|
119
|
+
for (let key in destinations)
|
|
120
|
+
{
|
|
121
|
+
let dest = destinations[key];
|
|
122
|
+
|
|
123
|
+
this.destinations[key] = new HotTestDestination (dest);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
this.destinationOrder = destinationOrder;
|
|
128
|
+
this.pages = pages;
|
|
129
|
+
}
|
|
130
|
+
}
|