Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
run: npm run test:formatting

test_service:
name: Test (Service Client)
name: Tests (Service Client)
runs-on: ubuntu-latest
environment: QA
needs: build
Expand All @@ -87,16 +87,16 @@ jobs:
name: build

- name: Test (Service Client)
run: npm run test:service
env:
ITP_API_URL: ${{ vars.ITP_API_URL }}
ITP_ISSUER_URL: ${{ vars.ITP_ISSUER_URL }}
ITP_SERVICE_CLIENT_ID: ${{ vars.ITP_SERVICE_CLIENT_ID }}
ITP_SERVICE_CLIENT_SECRET: ${{ secrets.ITP_SERVICE_CLIENT_SECRET }}
ITP_MAILINATOR_API_KEY: ${{ secrets.ITP_MAILINATOR_API_KEY }}
run: npm run test:service

test_native:
name: Test (Native Client)
name: Tests (Native Client)
runs-on: ubuntu-latest
environment: QA
needs: build
Expand All @@ -119,11 +119,11 @@ jobs:
name: build

- name: Test (Native Client)
run: npm run test:native
env:
ITP_API_URL: ${{ vars.ITP_API_URL }}
ITP_ISSUER_URL: ${{ vars.ITP_ISSUER_URL }}
ITP_MAILINATOR_API_KEY: ${{ secrets.ITP_MAILINATOR_API_KEY }}
ITP_NATIVE_TEST_CLIENT_ID: ${{ vars.ITP_NATIVE_TEST_CLIENT_ID }}
ITP_TEST_USER_EMAIL: ${{ vars.ITP_TEST_USER_EMAIL }}
ITP_TEST_USER_PASSWORD: ${{ secrets.ITP_TEST_USER_PASSWORD }}
run: npm run test:native
ITP_TEST_USER_PASSWORD: ${{ secrets.ITP_TEST_USER_PASSWORD }}
51 changes: 0 additions & 51 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,57 +47,6 @@
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"name": "Debug Formatting Tests",
"skipFiles": [
"<node_internals>/**"
],
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/mocha",
"args": [
"--forbid-only",
"--timeout",
"999999",
"integration-tests/main-cases/formatting.test.ts"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"name": "Debug Service Client Tests",
"skipFiles": [
"<node_internals>/**"
],
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/mocha",
"args": [
"--forbid-only",
"--timeout",
"999999",
"integration-tests/main-cases/service-client.test.ts"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"name": "Debug Native Client Tests",
"skipFiles": [
"<node_internals>/**"
],
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/mocha",
"args": [
"--forbid-only",
"--timeout",
"999999",
"integration-tests/main-cases/native-client.test.ts"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"name": "Debug Active Test",
"skipFiles": [
Expand Down
2 changes: 0 additions & 2 deletions integration-tests/imodel/imodel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import connectionTests from './connection.test';
import createDeleteTests from "./create-delete.test";
import infoTests from "./info.test";
import listTests from "./list.test";
import populateTests from './populate.test';
import updateTests from "./update.test";

const tests = () => describe('iModel Integration Tests', () => {
Expand All @@ -17,7 +16,6 @@ const tests = () => describe('iModel Integration Tests', () => {
updateTests();
listTests();
connectionTests();
populateTests();
});

export default tests;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/

import iModelPopulateTests from '../../imodel/populate.test';
import { nativeLoginToCli } from '../../utils/helpers';

describe('Native Client Tests (imodel populate)', async () => {
before(async () => {
await nativeLoginToCli();
})

iModelPopulateTests();
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/

import accessControlNativeTests from '../../access-control-native/access-control-native.test'
import { nativeLoginToCli } from '../../utils/helpers';
import sharedQuickUseCasesParallel from '../shared-quick-use-cases-parallel';

describe('Native Client Tests', async () => {
before(async () => {
await nativeLoginToCli();
})

accessControlNativeTests();
sharedQuickUseCasesParallel();

});
21 changes: 21 additions & 0 deletions integration-tests/main-cases/native-client-serial.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/

import authTests from '../auth/auth.test'
import { nativeLoginToCli } from '../utils/helpers';

describe('Native Client Tests (serial)', async () => {
before(async () => {
await nativeLoginToCli();
})

describe('Authentication Integration Tests', async () => {
after(async () => {
await nativeLoginToCli();
})

authTests();
})
});
47 changes: 0 additions & 47 deletions integration-tests/main-cases/native-client.test.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/

import iModelPopulateTests from '../../imodel/populate.test'
import { logoutFromCLI } from '../../utils/helpers';

describe('Service Client Tests (imodel populate)', () => {
before(async () => {
await logoutFromCLI();
})

iModelPopulateTests();
Comment thread
wolfo951 marked this conversation as resolved.
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/

import { logoutFromCLI } from '../../utils/helpers'
import sharedQuickUseCasesParallel from '../shared-quick-use-cases-parallel';

describe('Service Client Tests', () => {
before(async () => {
await logoutFromCLI();
})

sharedQuickUseCasesParallel();
});
18 changes: 18 additions & 0 deletions integration-tests/main-cases/service-client-serial.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/

import authTests from '../auth/auth.test'
import authTestsService from '../auth-service/auth-service.test'
import { logoutFromCLI } from '../utils/helpers'

describe('Service Client Tests (serial)', () => {
before(async () => {
await logoutFromCLI();
})
describe('Authentication Integration Tests', () => {
authTestsService();
authTests();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,22 @@

import accessControlTests from '../access-control/access-control.test'
import apiTests from '../api.test'
import authTests from '../auth/auth.test'
import authTestsService from '../auth-service/auth-service.test'
import changedElementsTests from '../changed-elements/changed-elements.test'
import contextTests from '../context/context.test'
import imodelTests from '../imodel/imodel.test'
import itwinTests from '../itwin/itwin.test'
import storageTests from '../storage/storage.test'
import userTests from '../user/user.test'
import { logoutFromCLI } from '../utils/helpers'

describe('Service Client Tests', () => {
before(async () => {
await logoutFromCLI();
})
const sharedQuickUseCasesParallel = () => {
accessControlTests();

describe('Authentication Integration Tests', () => {
authTestsService();
authTests();
});

apiTests();
changedElementsTests();
contextTests();
imodelTests();
itwinTests();
storageTests();
userTests();
});
}

export default sharedQuickUseCasesParallel;
35 changes: 22 additions & 13 deletions integration-tests/utils/run-suite-if-main-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,30 @@ import { isNativeAuthAccessTokenCached } from './helpers';
* @returns `true`, if the current file is not an import, otherwise `false`
*/
function isMainModule(meta: {url: string}) {
if (!meta || !process.argv[2]) {
return false;
}

const currentFilePath = fileURLToPath(meta.url)
.replaceAll("\\", "/");
for (const arg of process.argv) {
if(arg.match(/integration-tests\/.*\.test\.ts/) === null) {
continue;
}

const mainFilePath = process.argv[2];
const mainFilePathRegex = mainFilePath
.replaceAll("\\", "/")
.replaceAll(".", "\\.")
.replaceAll("**", ".*?")
.replaceAll("*", ".*?");
if (!meta || !arg) {
return false;
}

const currentFilePath = fileURLToPath(meta.url)
.replaceAll("\\", "/");

return currentFilePath.match(mainFilePathRegex) !== null;
const mainFilePath = arg;
const mainFilePathRegex = mainFilePath
.replaceAll("\\", "/")
.replaceAll(".", "\\.")
.replaceAll("**", ".*?")
.replaceAll("*", ".*?");

if(currentFilePath.match(mainFilePathRegex) !== null)
return true;
}

return false;
}

// eslint-disable-next-line valid-jsdoc
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@
"prepack": "oclif manifest && oclif readme",
"test": "mocha --forbid-only \"integration-tests/main-cases/*.test.ts\"",
"test:formatting": "mocha --forbid-only \"integration-tests/main-cases/formatting.test.ts\"",
"test:service": "mocha --forbid-only \"integration-tests/main-cases/service-client.test.ts\"",
"test:native": "mocha --forbid-only \"integration-tests/main-cases/native-client.test.ts\"",
"test:service": "mocha --forbid-only integration-tests/main-cases/service-client-serial.test.ts && mocha --forbid-only --parallel --jobs 4 integration-tests/main-cases/service-client-parallel/*.test.ts",
"test:native": "mocha --forbid-only integration-tests/main-cases/native-client-serial.test.ts && mocha --forbid-only --parallel --jobs 4 integration-tests/main-cases/native-client-parallel/*.test.ts",
"version": "oclif readme && git add README.md",
"docs-generator": "node ./bin/run.js docs-generator"
},
Expand Down