From 637ed0d20c2f8cfcf3a36710d5523a440b746eb3 Mon Sep 17 00:00:00 2001 From: ShayLevi <61374483+ShayLevi@users.noreply.github.com> Date: Mon, 1 Jul 2024 09:46:43 +0300 Subject: [PATCH 1/3] ME-16623 - creating first VP automation test (#664) * vp test: initial first test * vp test: initial first test * update e2e tests * update e2e * update e2e * update e2e * added eslint to e2e * vp test: initial first test * vp test: initial first test * update validatePageErrors function * update workers number * vp test: initial first test * vp test: initial first test * vp test: change for to for each * vp test: change back to for and update number of workers * vp test: refactor based on review comments * vp test: change timout * vp test: change timout and add logs * vp test: comment out flaky test on CI * vp test: comment out flaky test on CI --------- Co-authored-by: refael-m --- .github/workflows/validate.yml | 4 +- .gitignore | 7 + package-lock.json | 676 +++++++++++++++++++++++- package.json | 7 + test/e2e/.eslintrc.js | 13 + test/e2e/.gitignore | 5 + test/e2e/.prettierrc | 9 + test/e2e/fixtures/vpTest.ts | 41 ++ test/e2e/playwright.config.ts | 48 ++ test/e2e/specs/linksConsolErros.spec.ts | 79 +++ test/e2e/src/pom/mainPage.ts | 27 + test/e2e/testData/pageLinksData.ts | 43 ++ 12 files changed, 954 insertions(+), 5 deletions(-) create mode 100644 test/e2e/.eslintrc.js create mode 100644 test/e2e/.gitignore create mode 100644 test/e2e/.prettierrc create mode 100644 test/e2e/fixtures/vpTest.ts create mode 100644 test/e2e/playwright.config.ts create mode 100644 test/e2e/specs/linksConsolErros.spec.ts create mode 100644 test/e2e/src/pom/mainPage.ts create mode 100644 test/e2e/testData/pageLinksData.ts diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 39f9aa25..0528e825 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -26,5 +26,5 @@ jobs: - name: Unit tests run: npm run test:unit - # - name: E2E tests - # run: npm run test + - name: E2E tests + run: npm run test:e2e diff --git a/.gitignore b/.gitignore index 3f6f8f59..1a49a0c7 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,10 @@ lib/ .DS_Store \.history/ + +# playwright e2e tests + +/test-results/ +/playwright-report/ +/blob-report/ +/playwright/.cache/ \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index e467ec8f..cdb20261 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,6 +29,10 @@ "@babel/preset-env": "^7.24.4", "@commitlint/cli": "^19.2.1", "@commitlint/config-conventional": "^19.1.0", + "@playwright/test": "1.41.2", + "@types/node": "20.12.10", + "@typescript-eslint/eslint-plugin": "^7.10.0", + "@typescript-eslint/parser": "^7.10.0", "babel-jest": "^29.7.0", "babel-loader": "^9.1.3", "bundlewatch": "^0.3.3", @@ -37,7 +41,9 @@ "css-minimizer-webpack-plugin": "^6.0.0", "css.escape": "^1.5.1", "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", "eslint-plugin-jest": "^27.9.0", + "eslint-plugin-prettier": "^5.1.3", "eslint-webpack-plugin": "^4.1.0", "expose-loader": "^5.0.0", "html-webpack-plugin": "^5.6.0", @@ -4046,6 +4052,33 @@ "node": ">=14" } }, + "node_modules/@pkgr/core": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.1.tgz", + "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/@playwright/test": { + "version": "1.41.2", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.41.2.tgz", + "integrity": "sha512-qQB9h7KbibJzrDpkXkYvsmiDJK14FULCCZgEcoe2AvFAS64oCirWTwzTlAYEbKaRxWs5TFesE1Na6izMv3HfGg==", + "dev": true, + "dependencies": { + "playwright": "1.41.2" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=16" + } + }, "node_modules/@polka/url": { "version": "1.0.0-next.23", "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.23.tgz", @@ -4390,9 +4423,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.8.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.10.tgz", - "integrity": "sha512-TlgT8JntpcbmKUFzjhsyhGfP2fsiz1Mv56im6enJ905xG1DAYesxJaeSbGqQmAw8OWPdhyJGhGSQGKRNJ45u9w==", + "version": "20.12.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.10.tgz", + "integrity": "sha512-Eem5pH9pmWBHoGAT8Dr5fdc5rYA+4NAovdM4EktRPVAAiJhmWWfQrA0cFhAbOsQdSfIHjAud6YdkbL69+zSKjw==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -4522,6 +4555,327 @@ "@types/node": "*" } }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.10.0.tgz", + "integrity": "sha512-PzCr+a/KAef5ZawX7nbyNwBDtM1HdLIT53aSA2DDlxmxMngZ43O8SIePOeX8H5S+FHXeI6t97mTt/dDdzY4Fyw==", + "dev": true, + "dependencies": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "7.10.0", + "@typescript-eslint/type-utils": "7.10.0", + "@typescript-eslint/utils": "7.10.0", + "@typescript-eslint/visitor-keys": "7.10.0", + "graphemer": "^1.4.0", + "ignore": "^5.3.1", + "natural-compare": "^1.4.0", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^7.0.0", + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.10.0.tgz", + "integrity": "sha512-7L01/K8W/VGl7noe2mgH0K7BE29Sq6KAbVmxurj8GGaPDZXPr8EEQ2seOeAS+mEV9DnzxBQB6ax6qQQ5C6P4xg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.10.0", + "@typescript-eslint/visitor-keys": "7.10.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.10.0.tgz", + "integrity": "sha512-7fNj+Ya35aNyhuqrA1E/VayQX9Elwr8NKZ4WueClR3KwJ7Xx9jcCdOrLW04h51de/+gNbyFMs+IDxh5xIwfbNg==", + "dev": true, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/typescript-estree": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.10.0.tgz", + "integrity": "sha512-LXFnQJjL9XIcxeVfqmNj60YhatpRLt6UhdlFwAkjNc6jSUlK8zQOl1oktAP8PlWFzPQC1jny/8Bai3/HPuvN5g==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.10.0", + "@typescript-eslint/visitor-keys": "7.10.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/utils": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.10.0.tgz", + "integrity": "sha512-olzif1Fuo8R8m/qKkzJqT7qwy16CzPRWBvERS0uvyc+DHd8AKbO4Jb7kpAvVzMmZm8TrHnI7hvjN4I05zow+tg==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@typescript-eslint/scope-manager": "7.10.0", + "@typescript-eslint/types": "7.10.0", + "@typescript-eslint/typescript-estree": "7.10.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.10.0.tgz", + "integrity": "sha512-9ntIVgsi6gg6FIq9xjEO4VQJvwOqA3jaBFQJ/6TK5AvEup2+cECI6Fh7QiBxmfMHXU0V0J4RyPeOU1VDNzl9cg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.10.0", + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/minimatch": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", + "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.10.0.tgz", + "integrity": "sha512-2EjZMA0LUW5V5tGQiaa2Gys+nKdfrn2xiTIBLR4fxmPmVSvgPcKNW+AE/ln9k0A4zDUti0J/GZXMDupQoI+e1w==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "7.10.0", + "@typescript-eslint/types": "7.10.0", + "@typescript-eslint/typescript-estree": "7.10.0", + "@typescript-eslint/visitor-keys": "7.10.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.10.0.tgz", + "integrity": "sha512-7L01/K8W/VGl7noe2mgH0K7BE29Sq6KAbVmxurj8GGaPDZXPr8EEQ2seOeAS+mEV9DnzxBQB6ax6qQQ5C6P4xg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.10.0", + "@typescript-eslint/visitor-keys": "7.10.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.10.0.tgz", + "integrity": "sha512-7fNj+Ya35aNyhuqrA1E/VayQX9Elwr8NKZ4WueClR3KwJ7Xx9jcCdOrLW04h51de/+gNbyFMs+IDxh5xIwfbNg==", + "dev": true, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.10.0.tgz", + "integrity": "sha512-LXFnQJjL9XIcxeVfqmNj60YhatpRLt6UhdlFwAkjNc6jSUlK8zQOl1oktAP8PlWFzPQC1jny/8Bai3/HPuvN5g==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.10.0", + "@typescript-eslint/visitor-keys": "7.10.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.10.0.tgz", + "integrity": "sha512-9ntIVgsi6gg6FIq9xjEO4VQJvwOqA3jaBFQJ/6TK5AvEup2+cECI6Fh7QiBxmfMHXU0V0J4RyPeOU1VDNzl9cg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.10.0", + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/minimatch": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", + "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@typescript-eslint/scope-manager": { "version": "5.62.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz", @@ -4539,6 +4893,174 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@typescript-eslint/type-utils": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.10.0.tgz", + "integrity": "sha512-D7tS4WDkJWrVkuzgm90qYw9RdgBcrWmbbRkrLA4d7Pg3w0ttVGDsvYGV19SH8gPR5L7OtcN5J1hTtyenO9xE9g==", + "dev": true, + "dependencies": { + "@typescript-eslint/typescript-estree": "7.10.0", + "@typescript-eslint/utils": "7.10.0", + "debug": "^4.3.4", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/scope-manager": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.10.0.tgz", + "integrity": "sha512-7L01/K8W/VGl7noe2mgH0K7BE29Sq6KAbVmxurj8GGaPDZXPr8EEQ2seOeAS+mEV9DnzxBQB6ax6qQQ5C6P4xg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.10.0", + "@typescript-eslint/visitor-keys": "7.10.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.10.0.tgz", + "integrity": "sha512-7fNj+Ya35aNyhuqrA1E/VayQX9Elwr8NKZ4WueClR3KwJ7Xx9jcCdOrLW04h51de/+gNbyFMs+IDxh5xIwfbNg==", + "dev": true, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.10.0.tgz", + "integrity": "sha512-LXFnQJjL9XIcxeVfqmNj60YhatpRLt6UhdlFwAkjNc6jSUlK8zQOl1oktAP8PlWFzPQC1jny/8Bai3/HPuvN5g==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.10.0", + "@typescript-eslint/visitor-keys": "7.10.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/utils": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.10.0.tgz", + "integrity": "sha512-olzif1Fuo8R8m/qKkzJqT7qwy16CzPRWBvERS0uvyc+DHd8AKbO4Jb7kpAvVzMmZm8TrHnI7hvjN4I05zow+tg==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@typescript-eslint/scope-manager": "7.10.0", + "@typescript-eslint/types": "7.10.0", + "@typescript-eslint/typescript-estree": "7.10.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.10.0.tgz", + "integrity": "sha512-9ntIVgsi6gg6FIq9xjEO4VQJvwOqA3jaBFQJ/6TK5AvEup2+cECI6Fh7QiBxmfMHXU0V0J4RyPeOU1VDNzl9cg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.10.0", + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/minimatch": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", + "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@typescript-eslint/types": { "version": "5.62.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.62.0.tgz", @@ -7752,6 +8274,18 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint-config-prettier": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, "node_modules/eslint-plugin-jest": { "version": "27.9.0", "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.9.0.tgz", @@ -7777,6 +8311,36 @@ } } }, + "node_modules/eslint-plugin-prettier": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.1.3.tgz", + "integrity": "sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw==", + "dev": true, + "dependencies": { + "prettier-linter-helpers": "^1.0.0", + "synckit": "^0.8.6" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-plugin-prettier" + }, + "peerDependencies": { + "@types/eslint": ">=8.0.0", + "eslint": ">=8.0.0", + "eslint-config-prettier": "*", + "prettier": ">=3.0.0" + }, + "peerDependenciesMeta": { + "@types/eslint": { + "optional": true + }, + "eslint-config-prettier": { + "optional": true + } + } + }, "node_modules/eslint-scope": { "version": "7.2.2", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", @@ -8360,6 +8924,12 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", "integrity": "sha512-bCK/2Z4zLidyB4ReuIsvALH6w31YfAQDmXMqMx6FyfHqvBxtjC0eRumeSu4Bs3XtXwpyIywtSTrVT99BxY1f9w==" }, + "node_modules/fast-diff": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", + "dev": true + }, "node_modules/fast-fifo": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", @@ -14619,6 +15189,50 @@ "node": ">=8" } }, + "node_modules/playwright": { + "version": "1.41.2", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.41.2.tgz", + "integrity": "sha512-v0bOa6H2GJChDL8pAeLa/LZC4feoAMbSQm1/jF/ySsWWoaNItvrMP7GEkvEEFyCTUYKMxjQKaTSg5up7nR6/8A==", + "dev": true, + "dependencies": { + "playwright-core": "1.41.2" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=16" + }, + "optionalDependencies": { + "fsevents": "2.3.2" + } + }, + "node_modules/playwright-core": { + "version": "1.41.2", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.41.2.tgz", + "integrity": "sha512-VaTvwCA4Y8kxEe+kfm2+uUUw5Lubf38RxF7FpBxLPmGe5sdNkSg5e3ChEigaGrX7qdqT3pt2m/98LiyvU2x6CA==", + "dev": true, + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/playwright/node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/postcss": { "version": "8.4.38", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz", @@ -15141,6 +15755,34 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", + "dev": true, + "peer": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "dependencies": { + "fast-diff": "^1.1.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/pretty-bytes": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-3.0.1.tgz", @@ -16903,6 +17545,22 @@ "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", "dev": true }, + "node_modules/synckit": { + "version": "0.8.8", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.8.tgz", + "integrity": "sha512-HwOKAP7Wc5aRGYdKH+dw0PRRpbO841v2DENBtjnR5HFWoiNByAl7vrx3p0G/rCyYXQsrxqtX48TImFtPcIHSpQ==", + "dev": true, + "dependencies": { + "@pkgr/core": "^0.1.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, "node_modules/taffydb": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.6.2.tgz", @@ -17187,6 +17845,18 @@ "tree-kill": "cli.js" } }, + "node_modules/ts-api-utils": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", + "integrity": "sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==", + "dev": true, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "typescript": ">=4.2.0" + } + }, "node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", diff --git a/package.json b/package.json index 8214195c..529a3ca7 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "precommit": "eslint src", "test": "jest --no-cache --detectOpenHandles", "test:unit": "UNIT=TRUE jest --no-cache --env jsdom --testMatch='/test/unit/*.test.js'", + "test:e2e": "npx playwright test --config=test/e2e/playwright.config.ts", "commitlint": "commitlint --edit" }, "keywords": [ @@ -97,6 +98,10 @@ "@babel/preset-env": "^7.24.4", "@commitlint/cli": "^19.2.1", "@commitlint/config-conventional": "^19.1.0", + "@playwright/test": "1.41.2", + "@types/node": "20.12.10", + "@typescript-eslint/eslint-plugin": "^7.10.0", + "@typescript-eslint/parser": "^7.10.0", "babel-jest": "^29.7.0", "babel-loader": "^9.1.3", "bundlewatch": "^0.3.3", @@ -105,7 +110,9 @@ "css-minimizer-webpack-plugin": "^6.0.0", "css.escape": "^1.5.1", "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", "eslint-plugin-jest": "^27.9.0", + "eslint-plugin-prettier": "^5.1.3", "eslint-webpack-plugin": "^4.1.0", "expose-loader": "^5.0.0", "html-webpack-plugin": "^5.6.0", diff --git a/test/e2e/.eslintrc.js b/test/e2e/.eslintrc.js new file mode 100644 index 00000000..6e5ff435 --- /dev/null +++ b/test/e2e/.eslintrc.js @@ -0,0 +1,13 @@ +module.exports = { + extends: ['../../.eslintrc.js', 'plugin:@typescript-eslint/recommended', 'prettier'], + parser: '@typescript-eslint/parser', + plugins: ['@typescript-eslint', 'prettier'], + rules: { + 'prettier/prettier': [ + 'error', + { + endOfLine: 'auto', + }, + ], + }, +}; diff --git a/test/e2e/.gitignore b/test/e2e/.gitignore new file mode 100644 index 00000000..68c5d18f --- /dev/null +++ b/test/e2e/.gitignore @@ -0,0 +1,5 @@ +node_modules/ +/test-results/ +/playwright-report/ +/blob-report/ +/playwright/.cache/ diff --git a/test/e2e/.prettierrc b/test/e2e/.prettierrc new file mode 100644 index 00000000..c9014d78 --- /dev/null +++ b/test/e2e/.prettierrc @@ -0,0 +1,9 @@ +{ + "printWidth": 256, + "semi": true, + "singleQuote": true, + "trailingComma": "es5", + "bracketSpacing": true, + "tabWidth": 4, + "arrowParens": "always" +} diff --git a/test/e2e/fixtures/vpTest.ts b/test/e2e/fixtures/vpTest.ts new file mode 100644 index 00000000..7eb5c2d4 --- /dev/null +++ b/test/e2e/fixtures/vpTest.ts @@ -0,0 +1,41 @@ +import { ConsoleMessage, test } from '@playwright/test'; +import { MainPage } from '../src/pom/mainPage'; + +/** + * Fixture parameters. + */ +type FixtureParams = { + consoleErrors: ConsoleMessage[]; + vpExamples: MainPage; +}; + +/** + * Extend Playwright test with custom fixtures. + */ +export const vpTest = test.extend({ + /** + * Fixture for the video player examples page object. + */ + vpExamples: [ + async ({ page }, use) => { + const vpExamplePage = new MainPage(page); + await vpExamplePage.goto(); + await use(vpExamplePage); + }, + { auto: true }, + ], + + /** + * Fixture for capturing console errors. + */ + consoleErrors: [ + async ({ page }, use) => { + const consoleLogs = new Array(); + page.on('console', (msg) => { + if (msg.type() === 'error') consoleLogs.push(msg); + }); + await use(consoleLogs); + }, + { scope: 'test' }, + ], +}); diff --git a/test/e2e/playwright.config.ts b/test/e2e/playwright.config.ts new file mode 100644 index 00000000..8099572d --- /dev/null +++ b/test/e2e/playwright.config.ts @@ -0,0 +1,48 @@ +import { defineConfig, devices } from '@playwright/test'; + +/** + * See https://playwright.dev/docs/test-configuration. + */ +export default defineConfig({ + testMatch: /test\/e2e\/specs\/.*(\.spec.ts)/, + + timeout: 45000, + /* Run tests in files in parallel */ + fullyParallel: true, + /* Fail the build on CI if you accidentally left test.only in the source code. */ + forbidOnly: !!process.env.CI, + /* Retry on CI only */ + retries: process.env.CI ? 2 : 0, + /* Opt out of parallel tests on CI. */ + workers: 6, + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ + reporter: [['list'], ['html', { open: 'never' }]], + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ + use: { + headless: true, + /* Base URL to use in actions like `await page.goto('/')`. */ + // baseURL: 'http://127.0.0.1:3000', + + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ + trace: 'retain-on-failure', + screenshot: 'only-on-failure', + }, + + /* Configure projects for major browsers */ + projects: [ + { + name: 'Google Chrome', + use: { + ...devices['Desktop Chrome'], + channel: 'chrome', + }, + }, + ], + + //!* Run your local dev server before starting the tests *! + webServer: { + command: 'npm run start', + url: 'http://localhost:3000', + reuseExistingServer: !process.env.CI, + }, +}); diff --git a/test/e2e/specs/linksConsolErros.spec.ts b/test/e2e/specs/linksConsolErros.spec.ts new file mode 100644 index 00000000..2af0ac83 --- /dev/null +++ b/test/e2e/specs/linksConsolErros.spec.ts @@ -0,0 +1,79 @@ +import { ConsoleMessage, Page, expect } from '@playwright/test'; +import { vpTest } from '../fixtures/vpTest'; +import { LINKS } from '../testData/pageLinksData'; + +/** + * Console error test generated by LINKS object array data. + */ +for (const link of LINKS) { + vpTest(`Test console errors on link ${link.name}`, async ({ page, consoleErrors, vpExamples }) => { + await vpExamples.clickLinkByName(link.name); + await waitForPageToLoadWithTimeout(page, 5000); + expect(page.url()).toContain(link.endpoint); + handleCommonBrowsersErrors(link.name, consoleErrors); + }); +} + +/** + * Testing number of links in page. + */ +vpTest('Link count test', async ({ page }) => { + const expectedNumberOfLinks = 37; + const numberOfLinks = await page.getByRole('link').count(); + expect(numberOfLinks).toBe(expectedNumberOfLinks); +}); + +/** + * Helper function to handle common browser errors. + */ +function handleCommonBrowsersErrors(linkName: string, consoleErrors: ConsoleMessage[]) { + switch (linkName) { + case 'Custom Errors': + validatePageErrors( + consoleErrors, + ['(CODE:999 undefined) My custom error message'], + ['No compatible source was found for this media', 'Video cannot be played Public ID snow_horses not found', 'the server responded with a status of 404', 'Cannot read properties of undefined'] + ); + break; + case 'Debug mode': + validatePageErrors(consoleErrors, ['invalid player configuration', `cloudinary video player: \'fluid\' should be a boolean`], []); + break; + case 'VAST & VPAID Support': + validatePageErrors(consoleErrors, ['The Cross-Origin-Opener-Policy header'], ["Blocked script execution in 'about:blank' because the document's frame is sandboxed and the 'allow-scripts' permission is not set"]); + break; + default: + expect(consoleErrors, `The following unexpected console errors were found: ${JSON.stringify(consoleErrors)}`).toHaveLength(0); + } +} + +/** + * Wait until there are no network connections for at least 5000 ms or for given timeout to pass. + * Needed for console logs to appear. and in pages that loading video 'waitForLoadState('networkidle')' entering a long loop. + */ +async function waitForPageToLoadWithTimeout(page: Page, timeout: number): Promise { + return Promise.race([page.waitForLoadState('networkidle'), new Promise((r) => setTimeout(r, timeout))]); +} + +/** + * Validating that the expected error is part of the console errors + */ +function validatePageErrors(consoleErrors: ConsoleMessage[], expectedErrorMessages: string[], ignoreErrorMessages: string[]): void { + /** + * Filters console messages to exclude ignored messages + */ + const relevantMessages = consoleErrors.filter((consoleError) => !ignoreErrorMessages.some((ignoreError) => consoleError.text().includes(ignoreError))); + + /** + * Filters expected error messages that are not found in relevant console messages + */ + const missingExpectedErrors = expectedErrorMessages.filter((expectedErrorMessage) => !relevantMessages.some((relevantError) => relevantError.text().includes(expectedErrorMessage))); + + expect(missingExpectedErrors.length, `The following expected console errors were not found: ${JSON.stringify(missingExpectedErrors)}`).toBe(0); + + /** + * Filters relevant console messages that are not part of the expected error messages + */ + const unexpectedErrors = relevantMessages.filter((relevantError) => !expectedErrorMessages.some((expectedErrorMessage) => relevantError.text().includes(expectedErrorMessage))); + + expect(unexpectedErrors.length, `The following unexpected console errors were found: ${JSON.stringify(unexpectedErrors)}`).toBe(0); +} diff --git a/test/e2e/src/pom/mainPage.ts b/test/e2e/src/pom/mainPage.ts new file mode 100644 index 00000000..a540ebac --- /dev/null +++ b/test/e2e/src/pom/mainPage.ts @@ -0,0 +1,27 @@ +import { Page } from '@playwright/test'; + +/** + * Video player examples main page object + */ +export class MainPage { + private page: Page; + + constructor(page: Page) { + this.page = page; + } + + /** + * Click links by given name. + */ + public async clickLinkByName(name: string): Promise { + await this.page.getByRole('link', { name, exact: true }).click(); + await this.page.waitForLoadState('load'); + } + + /** + * Navigate to local examples page. + */ + public async goto(): Promise { + await this.page.goto('http://localhost:3000/index.html'); + } +} diff --git a/test/e2e/testData/pageLinksData.ts b/test/e2e/testData/pageLinksData.ts new file mode 100644 index 00000000..c6ceee8d --- /dev/null +++ b/test/e2e/testData/pageLinksData.ts @@ -0,0 +1,43 @@ +type Link = { name: string; endpoint: string }; + +/** + * Array of all the examples pages names and links. + */ +export const LINKS: Link[] = [ + //{ name: 'Adaptive Streaming', endpoint: 'adaptive-streaming.html' }, + { name: 'AI Highlights Graph', endpoint: 'highlights-graph.html' }, + { name: 'Analytics', endpoint: 'analytics.html' }, + { name: 'API and Events', endpoint: 'api.html' }, + { name: 'Audio Player', endpoint: 'audio.html' }, + { name: 'Autoplay on Scroll', endpoint: 'autoplay-on-scroll.html' }, + { name: 'Chapters', endpoint: 'chapters.html' }, + { name: 'Cloudinary Analytics', endpoint: 'cloudinary-analytics.html' }, + { name: 'Codecs and formats', endpoint: 'codec-formats.html' }, + { name: 'Colors API', endpoint: 'colors.html' }, + { name: 'Components', endpoint: 'components.html' }, + //{ name: 'Custom Errors', endpoint: 'custom-cld-errors.html' }, + { name: 'Display Configurations', endpoint: 'ui-config.html' }, + //{ name: 'Debug mode', endpoint: 'debug.html' }, + { name: 'ES Module Imports', endpoint: 'es-imports.html' }, + { name: 'Floating Player', endpoint: 'floating-player.html' }, + { name: 'Fluid Layouts', endpoint: 'fluid.html' }, + { name: 'Force HLS Subtitles', endpoint: 'force-hls-subtitles-ios.html' }, + { name: 'Highlights Graph', endpoint: 'highlights-graph.html' }, + { name: 'Interaction Area', endpoint: 'interaction-area.html' }, + { name: 'Multiple Players', endpoint: 'multiple-players.html' }, + { name: 'Playlist', endpoint: 'playlist.html' }, + { name: 'Playlist by Tag', endpoint: 'playlist-by-tag-captions.html' }, + { name: 'Poster Options', endpoint: 'poster.html' }, + { name: 'Profiles', endpoint: 'profiles.html' }, + { name: 'Raw URL', endpoint: 'raw-url.html' }, + { name: 'Recommendations', endpoint: 'recommendations.html' }, + { name: 'Seek Thumbnails', endpoint: 'seek-thumbs.html' }, + { name: 'Shoppable Videos', endpoint: 'shoppable.html' }, + { name: 'Subtitles & Captions', endpoint: 'subtitles-and-captions.html' }, + { name: 'Video Transformations', endpoint: 'transformations.html' }, + { name: 'UI Config', endpoint: 'ui-config.html' }, + //{ name: 'VAST & VPAID Support', endpoint: 'vast-vpaid.html' }, + { name: 'VR/360 Videos', endpoint: '360.html' }, + { name: 'Embedded (iframe) player', endpoint: 'embedded-iframe.html' }, + { name: 'ESM Imports', endpoint: 'cld-vp-esm-pages.netlify.app' }, +]; From 3c728c17711541d04b83e427b4bc6b01f80d6823 Mon Sep 17 00:00:00 2001 From: jakub-roch <70572646+jakub-roch@users.noreply.github.com> Date: Mon, 8 Jul 2024 12:39:15 +0200 Subject: [PATCH 2/3] fix: custom profile docs example (#673) --- docs/profiles.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/profiles.html b/docs/profiles.html index 22cc5d2c..e4e3a2b9 100644 --- a/docs/profiles.html +++ b/docs/profiles.html @@ -32,8 +32,8 @@ playerWithDefaultProfile.source('sea_turtle'); const playerWithCustomProfile = await cloudinary.videoPlayerWithProfile('player-custom-profile', { - cloud_name: 'dwaq5xqm4', - profile: 'https://res.cloudinary.com/dwaq5xqm4/raw/upload/v1/profiles/default_profile.json', + cloud_name: 'prod', + profile: 'https://res.cloudinary.com/prod/raw/upload/v1/video-player/example-profiles/example-profile.json', }); playerWithCustomProfile.source('samples/cld-sample-video'); From 124663f943f5e1060819ca1658032da2aebd4afe Mon Sep 17 00:00:00 2001 From: Tsachi Shlidor Date: Tue, 9 Jul 2024 11:07:04 +0300 Subject: [PATCH 3/3] fix: chapters innerHTML to innerText (#671) --- src/plugins/chapters/chapters.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/chapters/chapters.js b/src/plugins/chapters/chapters.js index ed07a034..46bd04d9 100644 --- a/src/plugins/chapters/chapters.js +++ b/src/plugins/chapters/chapters.js @@ -146,7 +146,7 @@ const ChaptersPlugin = (function () { this.chaptersTrack.addEventListener('cuechange', () => { const activeCues = Array.from(this.chaptersTrack.activeCues); // Safari needs Array.from() - controlBarChapterHolder.innerHTML = + controlBarChapterHolder.innerText = activeCues.length > 0 ? activeCues[0].text : ''; }); }; @@ -206,7 +206,7 @@ const ChaptersPlugin = (function () { timeTooltip.update = function (seekBarRect, seekBarPoint, content) { const originalUpdateFn = Object.getPrototypeOf(this).update; originalUpdateFn.call(this, seekBarRect, seekBarPoint, content); - chapterEl.innerHTML = getChapterFromPoint(seekBarPoint); + chapterEl.innerText = getChapterFromPoint(seekBarPoint); }; // Handle case of no seek-thumbnails