@itwin/rpcinterface-full-stack-tests 3.0.0-extension.1 → 3.0.2
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/LICENSE.md +1 -1
- package/lib/common/Settings.d.ts +1 -1
- package/lib/common/Settings.d.ts.map +1 -1
- package/lib/common/Settings.js +3 -3
- package/lib/common/Settings.js.map +1 -1
- package/lib/dist/bundled-tests.js +34883 -57410
- package/lib/dist/bundled-tests.js.map +1 -1
- package/lib/frontend/DevToolsRpc.test.js +1 -1
- package/lib/frontend/DevToolsRpc.test.js.map +1 -1
- package/lib/frontend/Elements.test.js +1 -1
- package/lib/frontend/Elements.test.js.map +1 -1
- package/lib/frontend/setup/IModelSession.d.ts.map +1 -1
- package/lib/frontend/setup/IModelSession.js +34 -5
- package/lib/frontend/setup/IModelSession.js.map +1 -1
- package/lib/frontend/setup/TestContext.d.ts.map +1 -1
- package/lib/frontend/setup/TestContext.js +7 -3
- package/lib/frontend/setup/TestContext.js.map +1 -1
- package/lib/frontend/workflows/BasicScenarios.test.js +1 -1
- package/lib/frontend/workflows/BasicScenarios.test.js.map +1 -1
- package/package.json +27 -22
|
@@ -44,7 +44,7 @@ describe("DevTools", () => {
|
|
|
44
44
|
it("can get the versions", async () => {
|
|
45
45
|
const versions = await devTools.versions();
|
|
46
46
|
chai_1.assert.isDefined(versions.application);
|
|
47
|
-
chai_1.assert.isDefined(versions.
|
|
47
|
+
chai_1.assert.isDefined(versions.iTwinJs);
|
|
48
48
|
});
|
|
49
49
|
});
|
|
50
50
|
//# sourceMappingURL=DevToolsRpc.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevToolsRpc.test.js","sourceRoot":"","sources":["../../src/frontend/DevToolsRpc.test.ts"],"names":[],"mappings":";;AAAA;;;+FAG+F;AAC/F,+BAA8B;AAC9B,sDAA+C;AAC/C,wDAAkE;AAClE,qDAAkD;AAElD,QAAQ,CAAC,UAAU,EA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,cAAc,EAAE,UAAU,CAAC,CAAC;QACjF,aAAM,CAAC,KAAK,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;QACpC,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,CAAC;QAC3C,aAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACvC,aAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { assert } from \"chai\";\r\nimport { LogLevel } from \"@itwin/core-bentley\";\r\nimport { DevTools, IModelConnection } from \"@itwin/core-frontend\";\r\nimport { TestContext } from \"./setup/TestContext\";\r\n\r\ndescribe(\"DevTools\", () => {\r\n let iModel: IModelConnection;\r\n let devTools: DevTools;\r\n\r\n before(async function () {\r\n const testContext = await TestContext.instance();\r\n\r\n if (!testContext.settings.runDevToolsRpcTests)\r\n this.skip();\r\n\r\n iModel = await testContext.iModelWithChangesets!.getConnection();\r\n devTools = DevTools.connectToBackendInstance(iModel.getRpcProps());\r\n });\r\n\r\n it(\"can fetch stats from backend\", async () => {\r\n const stats = await devTools.stats();\r\n assert.isDefined(stats);\r\n assert.isDefined(stats.os);\r\n assert.isDefined(stats.process);\r\n });\r\n\r\n it(\"can ping backend\", async () => {\r\n const ret = await devTools.ping(10);\r\n assert.isDefined(ret.avg);\r\n assert.isDefined(ret.max);\r\n assert.isDefined(ret.min);\r\n });\r\n\r\n it(\"can set log level\", async () => {\r\n const loggerCategory = \"test-category\";\r\n\r\n const firstLevel = LogLevel.Info;\r\n await devTools.setLogLevel(loggerCategory, firstLevel);\r\n\r\n const secondLevel = LogLevel.Warning;\r\n const actualFirstLevel = await devTools.setLogLevel(loggerCategory, secondLevel);\r\n assert.equal(actualFirstLevel, firstLevel);\r\n\r\n const thirdLevel = LogLevel.Error;\r\n const acutalSecondLevel = await devTools.setLogLevel(loggerCategory, thirdLevel);\r\n assert.equal(acutalSecondLevel, secondLevel);\r\n });\r\n\r\n it(\"can get the versions\", async () => {\r\n const versions = await devTools.versions();\r\n assert.isDefined(versions.application);\r\n assert.isDefined(versions.iTwinJs);\r\n });\r\n});\r\n"]}
|
|
@@ -50,7 +50,7 @@ describe("Operational: Execute Query", () => {
|
|
|
50
50
|
const query = "select count(*) nRows from(SELECT ECInstanceId FROM Bis.Element LIMIT 50)";
|
|
51
51
|
const rows = [];
|
|
52
52
|
try {
|
|
53
|
-
for (var _b = __asyncValues(iModel.query(query, undefined, core_common_1.QueryRowFormat.UseJsPropertyNames)), _c; _c = await _b.next(), !_c.done;) {
|
|
53
|
+
for (var _b = __asyncValues(iModel.query(query, undefined, { rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames })), _c; _c = await _b.next(), !_c.done;) {
|
|
54
54
|
const row = _c.value;
|
|
55
55
|
rows.push(row);
|
|
56
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Elements.test.js","sourceRoot":"","sources":["../../src/frontend/Elements.test.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;AAE/F,6BAA6B;AAE7B,oDAAkE;AAClE,wDAA2E;AAC3E,qDAAkD;AAElD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;AAE3B,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,IAAI,MAAwB,CAAC;IAC7B,IAAI,QAAmC,CAAC;IAExC,MAAM,CAAC,KAAK;QACV,MAAM,WAAW,GAAG,MAAM,yBAAW,CAAC,QAAQ,EAAE,CAAC;QAEjD,IAAI,CAAC,WAAW,CAAC,Q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,GAAG,WAAA,CAAA;gBAClB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aAAA;;;;;;;;;QAEjB,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC;IAC/B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport * as chai from \"chai\";\r\nimport { Id64Set, Id64String } from \"@itwin/core-bentley\";\r\nimport { ElementProps, QueryRowFormat } from \"@itwin/core-common\";\r\nimport { IModelConnection, SpatialModelState } from \"@itwin/core-frontend\";\r\nimport { TestContext } from \"./setup/TestContext\";\r\n\r\nconst expect = chai.expect;\r\n\r\ndescribe(\"IModel Elements\", () => {\r\n let iModel: IModelConnection;\r\n let elements: IModelConnection.Elements;\r\n\r\n before(async function () {\r\n const testContext = await TestContext.instance();\r\n\r\n if (!testContext.settings.runiModelReadRpcTests)\r\n this.skip();\r\n\r\n iModel = await testContext.iModelWithChangesets!.getConnection();\r\n elements = iModel.elements;\r\n });\r\n\r\n it(\"should get props\", async () => {\r\n const elementIds: Id64String[] = [elements.rootSubjectId];\r\n const elementProps: ElementProps[] = await elements.getProps(elementIds);\r\n\r\n expect(elementProps).to.exist.and.be.not.empty;\r\n });\r\n\r\n it(\"should query props\", async () => {\r\n const elementProps: ElementProps[] = await elements.queryProps({ from: SpatialModelState.classFullName });\r\n\r\n expect(elementProps).to.exist.and.be.not.empty;\r\n });\r\n\r\n it(\"should query ids\", async () => {\r\n const ids: Id64Set = await elements.queryIds({ limit: 10, from: \"BisCore:Subject\" });\r\n\r\n expect(ids).to.exist;\r\n });\r\n});\r\n\r\ndescribe(\"Operational: Execute Query\", () => {\r\n it(\"should successfully execute a simple query\", async function () {\r\n const testContext = await TestContext.instance();\r\n\r\n if (!testContext.settings.runiModelReadRpcTests)\r\n this.skip();\r\n\r\n const iModel = await testContext.iModelWithChangesets!.getConnection();\r\n const query = \"select count(*) nRows from(SELECT ECInstanceId FROM Bis.Element LIMIT 50)\";\r\n\r\n const rows = [];\r\n for await (const row of iModel.query(query, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames }))\r\n rows.push(row);\r\n\r\n expect(rows).to.be.not.empty;\r\n });\r\n});\r\n\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelSession.d.ts","sourceRoot":"","sources":["../../../src/frontend/setup/IModelSession.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"IModelSession.d.ts","sourceRoot":"","sources":["../../../src/frontend/setup/IModelSession.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAa,MAAM,sBAAsB,CAAC;AAEvE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAIlD,qBAAa,aAAa;IAEjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,cAAc,CAAgB;IAEtC,OAAO,CAAC,OAAO,CAAC,CAAuB;IAEvC,OAAO;WAQa,MAAM,CAAC,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC;IAiD1F,aAAa,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAI9C,IAAI,IAAI,OAAO,CAAC,oBAAoB,CAAC;CAYnD"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
3
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4
|
+
var m = o[Symbol.asyncIterator], i;
|
|
5
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
6
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
7
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
8
|
+
};
|
|
2
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
10
|
exports.IModelSession = void 0;
|
|
4
11
|
/*---------------------------------------------------------------------------------------------
|
|
@@ -7,9 +14,10 @@ exports.IModelSession = void 0;
|
|
|
7
14
|
*--------------------------------------------------------------------------------------------*/
|
|
8
15
|
const chai_1 = require("chai");
|
|
9
16
|
const core_frontend_1 = require("@itwin/core-frontend");
|
|
10
|
-
const imodelhub_client_1 = require("@bentley/imodelhub-client");
|
|
11
17
|
const projects_client_1 = require("@itwin/projects-client");
|
|
12
18
|
const core_common_1 = require("@itwin/core-common");
|
|
19
|
+
const imodels_client_management_1 = require("@itwin/imodels-client-management");
|
|
20
|
+
const imodels_access_frontend_1 = require("@itwin/imodels-access-frontend");
|
|
13
21
|
class IModelSession {
|
|
14
22
|
constructor(iTwinId, imodelId, changesetId) {
|
|
15
23
|
this.iTwinId = iTwinId;
|
|
@@ -18,6 +26,8 @@ class IModelSession {
|
|
|
18
26
|
this._imodelVersion = changesetId ? core_common_1.IModelVersion.asOfChangeSet(changesetId) : core_common_1.IModelVersion.latest();
|
|
19
27
|
}
|
|
20
28
|
static async create(requestContext, iModelData) {
|
|
29
|
+
var e_1, _a;
|
|
30
|
+
var _b;
|
|
21
31
|
let iTwinId;
|
|
22
32
|
let imodelId;
|
|
23
33
|
// Turn the iTwin name into an id
|
|
@@ -41,11 +51,30 @@ class IModelSession {
|
|
|
41
51
|
else
|
|
42
52
|
iTwinId = iModelData.iTwinId;
|
|
43
53
|
if (iModelData.useName) {
|
|
44
|
-
const imodelClient = new
|
|
45
|
-
const imodels =
|
|
46
|
-
|
|
54
|
+
const imodelClient = new imodels_client_management_1.IModelsClient({ api: { baseUrl: `https://${(_b = process.env.IMJS_URL_PREFIX) !== null && _b !== void 0 ? _b : ""}api.bentley.com/imodels` } });
|
|
55
|
+
const imodels = imodelClient.iModels.getRepresentationList({
|
|
56
|
+
authorization: imodels_access_frontend_1.AccessTokenAdapter.toAuthorizationCallback(await core_frontend_1.IModelApp.getAccessToken()),
|
|
57
|
+
urlParams: {
|
|
58
|
+
projectId: iTwinId,
|
|
59
|
+
name: iModelData.name,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
try {
|
|
63
|
+
for (var imodels_1 = __asyncValues(imodels), imodels_1_1; imodels_1_1 = await imodels_1.next(), !imodels_1_1.done;) {
|
|
64
|
+
const iModel = imodels_1_1.value;
|
|
65
|
+
imodelId = iModel.id;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
70
|
+
finally {
|
|
71
|
+
try {
|
|
72
|
+
if (imodels_1_1 && !imodels_1_1.done && (_a = imodels_1.return)) await _a.call(imodels_1);
|
|
73
|
+
}
|
|
74
|
+
finally { if (e_1) throw e_1.error; }
|
|
75
|
+
}
|
|
76
|
+
if (!imodelId)
|
|
47
77
|
throw new Error(`The iModel ${iModelData.name} does not exist in iTwin ${iTwinId}.`);
|
|
48
|
-
imodelId = imodels[0].wsgId;
|
|
49
78
|
}
|
|
50
79
|
else
|
|
51
80
|
imodelId = iModelData.id;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelSession.js","sourceRoot":"","sources":["../../../src/frontend/setup/IModelSession.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IModelSession.js","sourceRoot":"","sources":["../../../src/fr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AAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;IACjE,CAAC;IAEM,KAAK,CAAC,IAAI;QACf,IAAI;YACF,sCAAsC;YACtC,OAAO,CAAC,GAAG,CAAC,gBAAgB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC;YAC3D,IAAI,CAAC,OAAO,GAAG,MAAM,oCAAoB,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;YACvG,IAAA,aAAM,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;SAC/B;QAAC,OAAO,CAAM,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;SACpE;QAED,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AAlFD,sCAkFC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { expect } from \"chai\";\r\nimport { CheckpointConnection, IModelApp } from \"@itwin/core-frontend\";\r\nimport { Project as ITwin, ProjectsAccessClient, ProjectsSearchableProperty } from \"@itwin/projects-client\";\r\nimport { IModelData } from \"../../common/Settings\";\r\nimport { IModelVersion } from \"@itwin/core-common\";\r\nimport { AccessToken } from \"@itwin/core-bentley\";\r\nimport { IModelsClient } from \"@itwin/imodels-client-management\";\r\nimport { AccessTokenAdapter } from \"@itwin/imodels-access-frontend\";\r\n\r\nexport class IModelSession {\r\n\r\n public iTwinId: string;\r\n public iModelId: string;\r\n public changesetId?: string;\r\n private _imodelVersion: IModelVersion;\r\n\r\n private _iModel?: CheckpointConnection;\r\n\r\n private constructor(iTwinId: string, imodelId: string, changesetId?: string) {\r\n this.iTwinId = iTwinId;\r\n this.iModelId = imodelId;\r\n this.changesetId = changesetId;\r\n\r\n this._imodelVersion = changesetId ? IModelVersion.asOfChangeSet(changesetId) : IModelVersion.latest();\r\n }\r\n\r\n public static async create(requestContext: AccessToken, iModelData: IModelData): Promise<IModelSession> {\r\n let iTwinId;\r\n let imodelId;\r\n\r\n // Turn the iTwin name into an id\r\n if (iModelData.useITwinName) {\r\n if (!iModelData.iTwinName)\r\n throw new Error(`The iModel has no iTwin name, so it cannot get the iTwin.`);\r\n\r\n const client = new ProjectsAccessClient();\r\n const iTwinList: ITwin[] = await client.getAll(requestContext, {\r\n search: {\r\n searchString: iModelData.iTwinName,\r\n propertyName: ProjectsSearchableProperty.Name,\r\n exactMatch: true,\r\n }});\r\n\r\n if (iTwinList.length === 0)\r\n throw new Error(`ITwin ${iModelData.iTwinName} was not found for the user.`);\r\n else if (iTwinList.length > 1)\r\n throw new Error(`Multiple iTwins named ${iModelData.iTwinName} were found for the user.`);\r\n\r\n iTwinId = iTwinList[0].id;\r\n } else\r\n iTwinId = iModelData.iTwinId!;\r\n\r\n if (iModelData.useName) {\r\n const imodelClient = new IModelsClient({ api: { baseUrl: `https://${process.env.IMJS_URL_PREFIX ?? \"\"}api.bentley.com/imodels`}});\r\n const imodels = imodelClient.iModels.getRepresentationList({\r\n authorization: AccessTokenAdapter.toAuthorizationCallback(await IModelApp.getAccessToken()),\r\n urlParams: {\r\n projectId: iTwinId,\r\n name: iModelData.name,\r\n },\r\n });\r\n for await (const iModel of imodels) {\r\n imodelId = iModel.id;\r\n break;\r\n }\r\n if (!imodelId)\r\n throw new Error(`The iModel ${iModelData.name} does not exist in iTwin ${iTwinId}.`);\r\n } else\r\n imodelId = iModelData.id!;\r\n\r\n console.log(`Using iModel { name:${iModelData.name}, id:${iModelData.id}, iTwinId:${iModelData.iTwinId}, changesetId:${iModelData.changeSetId} }`); // eslint-disable-line no-console\r\n\r\n return new IModelSession(iTwinId, imodelId, iModelData.changeSetId);\r\n }\r\n\r\n public async getConnection(): Promise<CheckpointConnection> {\r\n return undefined === this._iModel ? this.open() : this._iModel;\r\n }\r\n\r\n public async open(): Promise<CheckpointConnection> {\r\n try {\r\n // eslint-disable-next-line no-console\r\n console.log(`Environment: ${process.env.IMJS_URL_PREFIX}`);\r\n this._iModel = await CheckpointConnection.openRemote(this.iTwinId, this.iModelId, this._imodelVersion);\r\n expect(this._iModel).to.exist;\r\n } catch (e: any) {\r\n throw new Error(`Failed to open test iModel. Error: ${e.message}`);\r\n }\r\n\r\n return this._iModel;\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestContext.d.ts","sourceRoot":"","sources":["../../../src/frontend/setup/TestContext.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAoB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"TestContext.d.ts","sourceRoot":"","sources":["../../../src/frontend/setup/TestContext.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAoB,MAAM,qBAAqB,CAAC;AAQpE,OAAO,EAAoB,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAOhD,qBAAa,WAAW;IACf,oBAAoB,EAAG,WAAW,CAAC;IACnC,iBAAiB,CAAC,EAAE,WAAW,CAAC;IAEhC,oBAAoB,CAAC,EAAE,aAAa,CAAC;IACrC,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,QAAQ,EAAE,QAAQ,CAAC;IAE1B,OAAO;IAGP,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAA0B;WAE/B,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC;IAQpD,+EAA+E;IAC/E,OAAO,CAAC,uBAAuB;YAMjB,UAAU;CA2CzB"}
|
|
@@ -10,10 +10,11 @@ const core_bentley_1 = require("@itwin/core-bentley");
|
|
|
10
10
|
const core_common_1 = require("@itwin/core-common");
|
|
11
11
|
const core_frontend_1 = require("@itwin/core-frontend");
|
|
12
12
|
const frontend_1 = require("@itwin/oidc-signin-tool/lib/cjs/frontend");
|
|
13
|
+
const imodels_access_frontend_1 = require("@itwin/imodels-access-frontend");
|
|
14
|
+
const imodels_client_management_1 = require("@itwin/imodels-client-management");
|
|
13
15
|
const Settings_1 = require("../../common/Settings");
|
|
14
16
|
const SideChannels_1 = require("../../common/SideChannels");
|
|
15
17
|
const IModelSession_1 = require("./IModelSession");
|
|
16
|
-
const imodelhub_client_1 = require("@bentley/imodelhub-client");
|
|
17
18
|
/* eslint-disable no-console */
|
|
18
19
|
/* eslint-disable @typescript-eslint/indent */
|
|
19
20
|
class TestContext {
|
|
@@ -34,11 +35,12 @@ class TestContext {
|
|
|
34
35
|
core_common_1.BentleyCloudRpcManager.initializeClient({ info, uriPrefix }, (0, Settings_1.getRpcInterfaces)(this.settings));
|
|
35
36
|
}
|
|
36
37
|
async initialize() {
|
|
38
|
+
var _a;
|
|
37
39
|
(0, chai_1.expect)(this.settings.users.length).to.be.gte(1, `Unexpected number of users found in settings - got ${this.settings.users.length}, expected at least 2`);
|
|
38
40
|
(0, chai_1.expect)(this.settings.iModels.length).to.be.gte(1, `Unexpected number of iModels found in settings - got ${this.settings.iModels.length}, expected at least 1`);
|
|
39
41
|
// Print out the configuration
|
|
40
42
|
console.log(this.settings.toString());
|
|
41
|
-
// Configure
|
|
43
|
+
// Configure iTwin.js frontend logging to go to the console
|
|
42
44
|
core_bentley_1.Logger.initializeToConsole();
|
|
43
45
|
core_bentley_1.Logger.setLevelDefault(this.settings.logLevel === undefined ? core_bentley_1.LogLevel.Warning : this.settings.logLevel);
|
|
44
46
|
if (undefined !== this.settings.oidcClientId) {
|
|
@@ -49,16 +51,18 @@ class TestContext {
|
|
|
49
51
|
clientId: this.settings.oidcClientId,
|
|
50
52
|
redirectUri: this.settings.oidcRedirect,
|
|
51
53
|
scope: this.settings.oidcScopes,
|
|
54
|
+
authority: this.settings.oidcAuthority,
|
|
52
55
|
});
|
|
53
56
|
}
|
|
54
57
|
if (undefined !== this.settings.clientConfiguration)
|
|
55
58
|
this.clientAccessToken = await (0, SideChannels_1.getClientAccessTokenFromBackend)();
|
|
56
59
|
this.initializeRpcInterfaces({ title: this.settings.Backend.name, version: this.settings.Backend.version });
|
|
60
|
+
const iModelClient = new imodels_client_management_1.IModelsClient({ api: { baseUrl: `https://${(_a = process.env.IMJS_URL_PREFIX) !== null && _a !== void 0 ? _a : ""}api.bentley.com/imodels` } });
|
|
57
61
|
await core_frontend_1.NoRenderApp.startup({
|
|
58
62
|
applicationVersion: PACKAGE_VERSION,
|
|
59
63
|
applicationId: this.settings.gprid,
|
|
60
64
|
authorizationClient: new frontend_1.TestFrontendAuthorizationClient(this.adminUserAccessToken),
|
|
61
|
-
hubAccess: new
|
|
65
|
+
hubAccess: new imodels_access_frontend_1.FrontendIModelsAccess(iModelClient),
|
|
62
66
|
});
|
|
63
67
|
this.iModelWithChangesets = await IModelSession_1.IModelSession.create(this.adminUserAccessToken, this.settings.iModel);
|
|
64
68
|
this.iTwinId = this.iModelWithChangesets.iTwinId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestContext.js","sourceRoot":"","sources":["../../../src/frontend/setup/TestContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,+BAA8B;AAC9B,sDAAoE;AACpE,oDAAyE;AACzE,wDAAmD;AACnD,uEAEkD;AAClD,oDAAmE;AACnE,4DAAsG;AACtG,mDAAgD;
|
|
1
|
+
{"version":3,"file":"TestContext.js","sourceRoot":"","sources":["../../../src/frontend/setup/TestContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,+BAA8B;AAC9B,sDAAoE;AACpE,oDAAyE;AACzE,wDAAmD;AACnD,uEAEkD;AAClD,4EAAuE;AACvE,gFAAiE;AACjE,o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AO,CAAC,GAAG,CAAC,eAAe,mCAAI,EAAE,yBAAyB,EAAC,EAAC,CAAC,CAAC;QAClI,MAAM,2BAAW,CAAC,OAAO,CAAC;YACxB,kBAAkB,EAAE,eAAe;YACnC,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK;YAClC,mBAAmB,EAAE,IAAI,0CAA+B,CAAC,IAAI,CAAC,oBAAoB,CAAC;YACnF,SAAS,EAAE,IAAI,+CAAqB,CAAC,YAAY,CAAC;SACnD,CAAC,CAAC;QAEH,IAAI,CAAC,oBAAoB,GAAG,MAAM,6BAAa,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACxG,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC;QACjD,IAAI,IAAI,CAAC,QAAQ,CAAC,sBAAsB;YACtC,IAAI,CAAC,cAAc,GAAG,MAAM,6BAAa,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,EAAE,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAEzG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACjC,CAAC;;AAxEH,kCAyEC;AA5DgB,qBAAS,GAAiB,SAAS,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { expect } from \"chai\";\r\nimport { AccessToken, Logger, LogLevel } from \"@itwin/core-bentley\";\r\nimport { BentleyCloudRpcManager, OpenAPIInfo } from \"@itwin/core-common\";\r\nimport { NoRenderApp } from \"@itwin/core-frontend\";\r\nimport {\r\n getAccessTokenFromBackend, TestBrowserAuthorizationClientConfiguration, TestFrontendAuthorizationClient, TestUserCredentials,\r\n} from \"@itwin/oidc-signin-tool/lib/cjs/frontend\";\r\nimport { FrontendIModelsAccess } from \"@itwin/imodels-access-frontend\";\r\nimport { IModelsClient } from \"@itwin/imodels-client-management\";\r\nimport { getRpcInterfaces, Settings } from \"../../common/Settings\";\r\nimport { getClientAccessTokenFromBackend, getProcessEnvFromBackend } from \"../../common/SideChannels\";\r\nimport { IModelSession } from \"./IModelSession\";\r\n\r\ndeclare const PACKAGE_VERSION: string;\r\n\r\n/* eslint-disable no-console */\r\n/* eslint-disable @typescript-eslint/indent */\r\n\r\nexport class TestContext {\r\n public adminUserAccessToken!: AccessToken;\r\n public clientAccessToken?: AccessToken;\r\n\r\n public iModelWithChangesets?: IModelSession;\r\n public iModelForWrite?: IModelSession;\r\n public iTwinId?: string;\r\n\r\n public settings: Settings;\r\n\r\n private constructor(env: NodeJS.ProcessEnv) {\r\n this.settings = new Settings(env);\r\n }\r\n private static _instance?: TestContext = undefined;\r\n\r\n public static async instance(): Promise<TestContext> {\r\n if (this._instance === undefined) {\r\n this._instance = new TestContext(await getProcessEnvFromBackend());\r\n await this._instance.initialize();\r\n }\r\n return this._instance;\r\n }\r\n\r\n /** Initialize configuration for the rpc interfaces used by the application. */\r\n private initializeRpcInterfaces(info: OpenAPIInfo) {\r\n // Url without trailing slash\r\n const uriPrefix: string = this.settings.Backend.location.replace(/\\/$/, \"\");\r\n BentleyCloudRpcManager.initializeClient({ info, uriPrefix }, getRpcInterfaces(this.settings));\r\n }\r\n\r\n private async initialize() {\r\n expect(this.settings.users.length).to.be.gte(1, `Unexpected number of users found in settings - got ${this.settings.users.length}, expected at least 2`);\r\n expect(this.settings.iModels.length).to.be.gte(1, `Unexpected number of iModels found in settings - got ${this.settings.iModels.length}, expected at least 1`);\r\n\r\n // Print out the configuration\r\n console.log(this.settings.toString());\r\n\r\n // Configure iTwin.js frontend logging to go to the console\r\n Logger.initializeToConsole();\r\n Logger.setLevelDefault(this.settings.logLevel === undefined ? LogLevel.Warning : this.settings.logLevel);\r\n\r\n if (undefined !== this.settings.oidcClientId) {\r\n this.adminUserAccessToken = await getAccessTokenFromBackend({\r\n email: this.settings.users[0].email,\r\n password: this.settings.users[0].password,\r\n } as TestUserCredentials, {\r\n clientId: this.settings.oidcClientId,\r\n redirectUri: this.settings.oidcRedirect,\r\n scope: this.settings.oidcScopes,\r\n authority: this.settings.oidcAuthority,\r\n } as TestBrowserAuthorizationClientConfiguration);\r\n }\r\n\r\n if (undefined !== this.settings.clientConfiguration)\r\n this.clientAccessToken = await getClientAccessTokenFromBackend();\r\n\r\n this.initializeRpcInterfaces({ title: this.settings.Backend.name, version: this.settings.Backend.version });\r\n\r\n const iModelClient = new IModelsClient({ api: { baseUrl: `https://${process.env.IMJS_URL_PREFIX ?? \"\"}api.bentley.com/imodels`}});\r\n await NoRenderApp.startup({\r\n applicationVersion: PACKAGE_VERSION,\r\n applicationId: this.settings.gprid,\r\n authorizationClient: new TestFrontendAuthorizationClient(this.adminUserAccessToken),\r\n hubAccess: new FrontendIModelsAccess(iModelClient),\r\n });\r\n\r\n this.iModelWithChangesets = await IModelSession.create(this.adminUserAccessToken, this.settings.iModel);\r\n this.iTwinId = this.iModelWithChangesets.iTwinId;\r\n if (this.settings.runiModelWriteRpcTests)\r\n this.iModelForWrite = await IModelSession.create(this.adminUserAccessToken, this.settings.writeIModel);\r\n\r\n console.log(\"TestSetup: Done\");\r\n }\r\n}\r\n"]}
|
|
@@ -51,7 +51,7 @@ describe("Basic Scenarios", async () => {
|
|
|
51
51
|
const iModel = await testContext.iModelWithChangesets.getConnection();
|
|
52
52
|
const rows = [];
|
|
53
53
|
try {
|
|
54
|
-
for (var _b = __asyncValues(iModel.query("SELECT ECInstanceId AS id FROM BisCore.Element", undefined, core_common_1.QueryRowFormat.UseJsPropertyNames,
|
|
54
|
+
for (var _b = __asyncValues(iModel.query("SELECT ECInstanceId AS id FROM BisCore.Element", undefined, { rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames, limit: { count: 10 } })), _c; _c = await _b.next(), !_c.done;) {
|
|
55
55
|
const row = _c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C,oBAAqB,CAAC,QAAQ,CAAC;QAC5D,MAAM,sBAAsB,CAAC,OAAQ,EAAE,QAAQ,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sDAAsD,EAAE,KAAK,IAAI,EAAE;;QACpE,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,oBAAqB,CAAC,aAAa,EAAE,CAAC;QAEvE,MAAM,IAAI,GAAG,EAAE,CAAC;;YAChB,KAAwB,IAAA,KAAA,cAAA,MAAM,CAAC,KAAK,CAAC,gDAAgD,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,4BAAc,CAAC,kBAAkB,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA,IAAA;gBAA9J,MAAM,GAAG,WAAA,CAAA;gBAClB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aAAA;;;;;;;;;QAEjB,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6CC;AACH,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport * as chai from \"chai\";\r\nimport * as chaiAsPromised from \"chai-as-promised\";\r\nimport { QueryRowFormat } from \"@itwin/core-common\";\r\nimport { CheckpointConnection, IModelApp } from \"@itwin/core-frontend\";\r\nimport { TestFrontendAuthorizationClient } from \"@itwin/oidc-signin-tool/lib/cjs/frontend\";\r\nimport { TestContext } from \"../setup/TestContext\";\r\n\r\nconst expect = chai.expect;\r\n\r\nchai.use(chaiAsPromised);\r\n\r\ndescribe(\"Basic Scenarios\", async () => {\r\n let testContext: TestContext;\r\n\r\n before(async () => {\r\n testContext = await TestContext.instance();\r\n const accessToken = testContext.adminUserAccessToken;\r\n IModelApp.authorizationClient = new TestFrontendAuthorizationClient(accessToken);\r\n });\r\n\r\n async function openIModelAndQueryPage(iTwinId: string, iModelId: string) {\r\n const iModel = await CheckpointConnection.openRemote(iTwinId, iModelId);\r\n expect(iModel).to.exist;\r\n expect(iModel.elements).to.exist;\r\n\r\n const elements = iModel.elements;\r\n const elementProps = await elements.getProps(elements.rootSubjectId);\r\n expect(elementProps).to.exist;\r\n expect(elementProps.length).to.equal(1);\r\n }\r\n\r\n it(\"should successfully open a new IModel with changesets for read and Get Properties for an Element TestCase:819342\", async () => {\r\n const iTwinId = testContext.iTwinId;\r\n\r\n const iModelId = testContext.iModelWithChangesets!.iModelId;\r\n await openIModelAndQueryPage(iTwinId!, iModelId);\r\n });\r\n\r\n // imodeljs does not allow this -- changesetid must be non-empty for routing purposes.\r\n it.skip(\"should successfully open a new IModel without changesets for read and Get Properties for an Element TestCase:872675\", async () => {\r\n const iTwinId = testContext.iTwinId;\r\n\r\n const iModelId = testContext.iModelWithChangesets!.iModelId;\r\n await openIModelAndQueryPage(iTwinId!, iModelId);\r\n });\r\n\r\n it(\"should open iModel and Execute Query TestCase:819343\", async () => {\r\n const iModel = await testContext.iModelWithChangesets!.getConnection();\r\n\r\n const rows = [];\r\n for await (const row of iModel.query(\"SELECT ECInstanceId AS id FROM BisCore.Element\", undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames, limit: { count: 10 } }))\r\n rows.push(row);\r\n\r\n expect(rows).not.to.be.empty;\r\n });\r\n\r\n /* This test is wrong. If two users open the same imodel using the same mode in the same backend, then they\r\n will share a single briefcase in the backend. When either user closes the imodel, then the briefcase will\r\n be closed. The backend does not maintain some kind of ref count that would keep the briefcase open\r\n for the second connection.\r\n it(\"should not affect other users when iModel is closed TestCase:819344 #orchestrator\", async () => {\r\n const iModelId = testContext.iModelWithChangesets.iModelId;\r\n const iTwinId = testContext.iModelWithChangesets.iTwinId;\r\n const openMode = OpenMode.Readonly;\r\n\r\n const originalAppAuth = TestRpcClientManager.configuration.applicationAuthorizationValue;\r\n\r\n try {\r\n // Get access token of user that does not have permission to read given iModel\r\n const user1accessToken = await testContext.regularUser1.getAccessToken();\r\n const user1accessTokenString = user1accessToken.toTokenString() || \"\";\r\n\r\n TestRpcClientManager.configuration.applicationAuthorizationValue = user1accessTokenString;\r\n const iModel1 = await IModelConnection.open(user1accessToken, iTwinId, iModelId, openMode);\r\n\r\n // Open the same imodel for another user\r\n const user2accessToken = await testContext.regularUser2.getAccessToken();\r\n const user2accessTokenString = user2accessToken.toTokenString() || \"\";\r\n\r\n TestRpcClientManager.configuration.applicationAuthorizationValue = user2accessTokenString;\r\n const iModel2 = await IModelConnection.open(user2accessToken, iTwinId, iModelId, openMode);\r\n const query = \"SELECT ECInstanceId AS id FROM BisCore.Element\";\r\n\r\n // Act: Close the iModel for the same user\r\n {\r\n TestRpcClientManager.configuration.applicationAuthorizationValue = user1accessTokenString;\r\n const rows = await iModel1.queryPage(query);\r\n expect(rows).to.exist.and.be.not.empty;\r\n await iModel1.close(user1accessToken);\r\n }\r\n\r\n // Assert: Previous session close should not affect other users\r\n {\r\n TestRpcClientManager.configuration.applicationAuthorizationValue = user2accessTokenString;\r\n const rows = await iModel2.queryPage(query);\r\n expect(rows).to.exist.and.be.not.empty;\r\n }\r\n } finally {\r\n TestRpcClientManager.configuration.applicationAuthorizationValue = originalAppAuth;\r\n }\r\n });\r\n */\r\n});\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/rpcinterface-full-stack-tests",
|
|
3
|
-
"version": "3.0.
|
|
4
|
-
"description": "Test the full
|
|
3
|
+
"version": "3.0.2",
|
|
4
|
+
"description": "Test the full iTwin.js Core stack (frontend and backend) using standard RPC interfaces",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"keywords": [
|
|
11
11
|
"Bentley",
|
|
12
12
|
"Presentation",
|
|
13
|
-
"
|
|
13
|
+
"iTwin.js",
|
|
14
14
|
"Testing"
|
|
15
15
|
],
|
|
16
16
|
"author": {
|
|
@@ -18,19 +18,22 @@
|
|
|
18
18
|
"url": "http://www.bentley.com"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@itwin/
|
|
22
|
-
"@itwin/
|
|
23
|
-
"@itwin/
|
|
24
|
-
"@itwin/
|
|
25
|
-
"@itwin/
|
|
26
|
-
"@
|
|
27
|
-
"@itwin/core-common": "3.0.
|
|
28
|
-
"@itwin/core-frontend": "3.0.
|
|
29
|
-
"@itwin/core-
|
|
30
|
-
"@itwin/
|
|
31
|
-
"@itwin/
|
|
32
|
-
"@itwin/
|
|
33
|
-
"@itwin/
|
|
21
|
+
"@itwin/imodels-access-backend": "^1.0.1",
|
|
22
|
+
"@itwin/imodels-access-frontend": "^1.0.1",
|
|
23
|
+
"@itwin/imodels-client-authoring": "^1.0.1",
|
|
24
|
+
"@itwin/imodels-client-management": "^1.0.1",
|
|
25
|
+
"@itwin/build-tools": "3.0.2",
|
|
26
|
+
"@itwin/core-bentley": "3.0.2",
|
|
27
|
+
"@itwin/core-common": "3.0.2",
|
|
28
|
+
"@itwin/core-frontend": "3.0.2",
|
|
29
|
+
"@itwin/core-geometry": "3.0.2",
|
|
30
|
+
"@itwin/core-quantity": "3.0.2",
|
|
31
|
+
"@itwin/certa": "3.0.2",
|
|
32
|
+
"@itwin/eslint-plugin": "3.0.2",
|
|
33
|
+
"@itwin/oidc-signin-tool": "^3.2.2",
|
|
34
|
+
"@itwin/presentation-common": "3.0.2",
|
|
35
|
+
"@itwin/presentation-frontend": "3.0.2",
|
|
36
|
+
"@itwin/service-authorization": "^0.6.1",
|
|
34
37
|
"chai": "^4.1.2",
|
|
35
38
|
"chai-as-promised": "^7",
|
|
36
39
|
"dotenv": "^10.0.0",
|
|
@@ -40,16 +43,17 @@
|
|
|
40
43
|
"puppeteer": "chrome-86"
|
|
41
44
|
},
|
|
42
45
|
"devDependencies": {
|
|
43
|
-
"@itwin/
|
|
44
|
-
"@itwin/
|
|
45
|
-
"@itwin/
|
|
46
|
-
"@itwin/
|
|
46
|
+
"@itwin/core-backend": "3.0.2",
|
|
47
|
+
"@itwin/express-server": "3.0.2",
|
|
48
|
+
"@itwin/imodels-access-backend": "^1.0.1",
|
|
49
|
+
"@itwin/presentation-backend": "3.0.2",
|
|
50
|
+
"@itwin/projects-client": "^0.6.0",
|
|
47
51
|
"@types/chai": "^4.1.4",
|
|
48
52
|
"@types/chai-as-promised": "^7",
|
|
49
53
|
"@types/mocha": "^8.2.2",
|
|
50
54
|
"@types/node": "14.14.31",
|
|
51
55
|
"@types/puppeteer": "2.0.1",
|
|
52
|
-
"
|
|
56
|
+
"cpx2": "^3.0.0",
|
|
53
57
|
"eslint": "^7.11.0",
|
|
54
58
|
"internal-tools": "3.0.0-dev.69",
|
|
55
59
|
"npm-run-all": "^4.1.5",
|
|
@@ -80,5 +84,6 @@
|
|
|
80
84
|
"test:integration": "npm-run-all -r -p start:backend test:integration:chrome",
|
|
81
85
|
"test:integration:chrome": "certa -r chrome",
|
|
82
86
|
"webpack:frontend": "webpack --config webpack.config.js 1>&2"
|
|
83
|
-
}
|
|
87
|
+
},
|
|
88
|
+
"readme": "# iTwin.js RPC Interface Integration Tests\r\n\r\nCopyright © Bentley Systems, Incorporated. All rights reserved. See LICENSE.md for license terms and full copyright notice.\r\n\r\nThis package contains the iTwin.js RPC Interface integration tests and configuration setup to run them against a deployed backend.\r\n\r\n## Prerequisites\r\n\r\nRefer to the iTwin.js [prerequisites](https://github.com/iTwin/itwinjs-core#prerequisites)\r\n\r\n## Running the tests\r\n\r\nBefore running the tests, the environment needs to be setup. The easiest way is to configure a [.env] file in the working directory, the [template.env](./template.env) file has information about how to set one up and all the variables that need to be configured.\r\n\r\nAll test related settings are contained in the `process.env` variable and parsed by [Settings.ts](./setup/Settings.ts). If something required is missing or not configured properly, the tests will fail to setup.\r\n\r\n### Setting up the required context\r\n\r\nThe tests require an Project and iModel to be setup in order to run properly.\r\n\r\nThe iModel doesn't require anything special and can be a seed iModel.\r\n\r\n### Specifying users to be used for testing\r\n\r\nThe tests require a single user to be specified. The user's access rules required are:\r\n\r\n1. User1 - full access to the Project and an iModel (requires iModelHub Read iModel Project Role)\r\n - i.e., \"user_with_access_username\" in the `.env` file.\r\n\r\n### Specifying the backend\r\n\r\nIf the specified address for the backend is \"localhost\", you must have built a backend and start it.\r\n\r\nIf you do not specify the address to be \"localhost\" for the backend, you must specify a valid URL to a hosted backend.\r\n\r\n### Configuring OIDC\r\n\r\nBy default the tests will retrieve valid OIDC tokens on behalf of each user specified in `environment` in order to make API calls. However,\r\nif you wish to use JWTs instead, you may set the `oidc_client_id` environment variable which will use OIDC authentication instead of SAML.\r\n\r\nIn order to run the integration tests they need to have a valid OIDC client id which can be obtains by performing the following steps:\r\n\r\n1. Go to the \"[Register your application](https://developer.bentley.com/register/)\" page and sign in\r\n1. Click 'New App'\r\n1. Select \"SPA\" application\r\n1. Specify a client name (can be anything you want)\r\n1. Add `http://localhost:5000` as a redirect url\r\n1. Hit 'Next' to finish\r\n\r\n### Actually running the tests\r\n\r\nOnce all the required environment variables are setup, to run the integration tests:\r\n\r\n1. Install dependencies: `npm install`\r\n2. Clean output: `npm run clean`\r\n3. Build source: `npm run build`\r\n4. Run tests: `npm test:integration`\r\n\r\n## Development instructions\r\n\r\nThe base 'after all' and 'before all' hooks are implemented in TestSetup.test.ts. Any cleanup and setup steps should be added here.\r\n\r\nThe `TestContext` class follows the singleton pattern and will automatically be setup when its static instance is invoked via its `TestContext.instance()`.\r\nThe setup uses a [.env file](./.env) and `process.env` to populate the `TestContext`.\r\n"
|
|
84
89
|
}
|