Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0836431

Browse files
Zoltan VargaxirzecHarshaNalluru
authored
DigitalTwins: Add E2E tests (Azure#13135)
* feat(azure-digitaltwins): update swagger * feat(azure-digitaltwins): update client to swagger * chore(azure-digitaltwins-core): rename package * chore(azure-digitaltwins-core): rename package * feat(azure-digital-twins-core): add span * feat(azure-digital-twins-core): update for GA * chore(azure-digital-twins-core): fix readme * Update Readme.md * chore(azure-digital-twins-core): fix exports * chore(azure-digital-twins-core): fix broken links * chore(azure-digital-twins-core): update changelog * chore(azure-digital-twins-core): comment changelog * chore(azure-digital-twins-core): more comment * Update CHANGELOG.md * fix(azure-digital-twins-core): address feedbacks * fix(azure-digital-twins-core): add ifmatch * fix(azure-digital-twins-core): add ifMatch * fix(digitaltwins): hide ifmatch to options * chore(digitaltwin): autofix * fix(digitaltwins): fix export warnings * fix(digitaltwins): fix diagnostic namespace * fix(digitaltwins): improve tracing * chore(digitaltwins): autofix * fix(digitaltwins: fix tracing * chore(digitaltwins): autofix * fix(digitaltwins): delete parameter grouping * chore(digitaltwins): autofix * chore(digitaltwins): clean up * Add E2E tests * Add E2E tests * Update recordings * Remove comments * --harmony flag for async iterators * Update CHANGELOG.md * Update version in package.json Co-authored-by: Jeff Fisher <[email protected]> Co-authored-by: HarshaNalluru <[email protected]>
1 parent 0c5d711 commit 0836431

File tree

186 files changed

+29345
-62
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

186 files changed

+29345
-62
lines changed

sdk/digitaltwins/digital-twins-core/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Release History
22

3+
## 1.0.1 (2021-01-12)
4+
5+
- This release is an update the GA release containing the following changes:
6+
- Fix publishComponentTelemetry API to follow the convention, now messageId is a mandatory argument
7+
- Add E2E live and record/playback tests
8+
- Add samples of delete digitaltwins and models for convenience
9+
310
## 1.0.0 (2020-10-30)
411

512
- The is the GA release containing the following changes:

sdk/digitaltwins/digital-twins-core/karma.conf.js

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
// https://github.com/karma-runner/karma-chrome-launcher
22
process.env.CHROME_BIN = require("puppeteer").executablePath();
33
require("dotenv").config();
4+
const {
5+
jsonRecordingFilterFunction,
6+
isPlaybackMode,
7+
isSoftRecordMode,
8+
isRecordMode
9+
} = require("@azure/test-utils-recorder");
410

511
module.exports = function(config) {
612
config.set({
@@ -21,7 +27,9 @@ module.exports = function(config) {
2127
"karma-env-preprocessor",
2228
"karma-coverage",
2329
"karma-remap-istanbul",
24-
"karma-junit-reporter"
30+
"karma-junit-reporter",
31+
"karma-json-to-file-reporter",
32+
"karma-json-preprocessor"
2533
],
2634

2735
// list of files / patterns to load in the browser
@@ -31,25 +39,27 @@ module.exports = function(config) {
3139
"https://cdn.polyfill.io/v2/polyfill.js?features=Promise,String.prototype.startsWith,String.prototype.endsWith,String.prototype.repeat,String.prototype.includes,Array.prototype.includes,Object.keys|always",
3240
"test-browser/index.js",
3341
{ pattern: "test-browser/index.js.map", type: "html", included: false, served: true }
34-
],
42+
].concat(isPlaybackMode() || isSoftRecordMode() ? ["recordings/browsers/**/*.json"] : []),
3543

3644
// list of files / patterns to exclude
3745
exclude: [],
3846

3947
// preprocess matching files before serving them to the browser
4048
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
4149
preprocessors: {
42-
"**/*.js": ["env"]
50+
"**/*.js": ["env"],
4351
// IMPORTANT: COMMENT following line if you want to debug in your browsers!!
4452
// Preprocess source file to calculate code coverage, however this will make source file unreadable
4553
// "test-browser/index.js": ["coverage"]
54+
"dist-test/index.browser.js": ["coverage"],
55+
"recordings/browsers/**/*.json": ["json"]
4656
},
4757

4858
// inject following environment values into browser testing with window.__env__
4959
// environment values MUST be exported or set with same console running "karma start"
5060
// https://www.npmjs.com/package/karma-env-preprocessor
5161
envPreprocessor: [
52-
"AZ_CONFIG_CONNECTION",
62+
"AZURE_DIGITALTWINS_URL",
5363
"AZURE_CLIENT_ID",
5464
"AZURE_CLIENT_SECRET",
5565
"AZURE_TENANT_ID",
@@ -59,7 +69,7 @@ module.exports = function(config) {
5969
// test results reporter to use
6070
// possible values: 'dots', 'progress'
6171
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
62-
reporters: ["mocha", "coverage", "karma-remap-istanbul", "junit"],
72+
reporters: ["mocha", "coverage", "junit", "json-to-file", "karma-remap-istanbul"],
6373

6474
coverageReporter: {
6575
// specify a common output directory
@@ -87,6 +97,12 @@ module.exports = function(config) {
8797
properties: {} // key value pair of properties to add to the <properties> section of the report
8898
},
8999

100+
jsonToFileReporter: {
101+
// required - to save the recordings of browser tests
102+
filter: jsonRecordingFilterFunction,
103+
outputPath: "."
104+
},
105+
90106
// web server port
91107
port: 9876,
92108

@@ -108,7 +124,7 @@ module.exports = function(config) {
108124
customLaunchers: {
109125
ChromeHeadlessNoSandbox: {
110126
base: "ChromeHeadless",
111-
flags: ["--no-sandbox"]
127+
flags: ["--no-sandbox", "--disable-web-security"]
112128
}
113129
},
114130

@@ -123,6 +139,9 @@ module.exports = function(config) {
123139
browserNoActivityTimeout: 600000,
124140
browserDisconnectTimeout: 10000,
125141
browserDisconnectTolerance: 3,
142+
browserConsoleLogOptions: {
143+
terminal: !isRecordMode()
144+
},
126145

127146
client: {
128147
mocha: {

sdk/digitaltwins/digital-twins-core/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@azure/digital-twins-core",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "An isomorphic client library for Azure Digital Twins",
55
"sdk-type": "client",
66
"author": "Microsoft Corporation",
@@ -28,7 +28,7 @@
2828
"extract-api": "tsc -p . && api-extractor run --local",
2929
"format": "prettier --write --config ../../.prettierrc.json --ignore-path ../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
3030
"integration-test:browser": "npm run build:test:browser && cross-env TEST_MODE=live karma start --single-run",
31-
"integration-test:node": "npm run build:test:node && nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 180000 --full-trace dist-esm/test/*.spec.js dist-esm/test/**/*.spec.js",
31+
"integration-test:node": "npm run build:test:node && nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 180000 --full-trace dist-esm/test/*.spec.js dist-esm/test/**/*.spec.js --harmony",
3232
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
3333
"lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
3434
"lint": "eslint package.json api-extractor.json src test --ext .ts -f html -o search-lintReport.html || exit 0",
@@ -38,7 +38,7 @@
3838
"test:browser": "npm run clean && npm run build:test:browser && npm run unit-test:browser",
3939
"test": "npm run clean && npm run build:test && npm run unit-test",
4040
"unit-test:browser": "karma start --single-run",
41-
"unit-test:node": "mocha --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 180000 --full-trace dist-test/index.node.js",
41+
"unit-test:node": "mocha --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 180000 --full-trace dist-test/index.node.js --harmony",
4242
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
4343
"docs": "typedoc --excludePrivate --excludeNotExported --excludeExternals --mode file --out ./dist/docs ./src"
4444
},

sdk/digitaltwins/digital-twins-core/recordings/browsers/digitaltwins__create_read_update_delete_and_telemetry_operations/recording_create_a_simple_digital_twin.json

Lines changed: 128 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)