diff --git a/.gitattributes b/.gitattributes index c7cdf5a36..53839e8dd 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,4 @@ * text=auto docs/* linguist-documentation release/* linguist-vendored +playwright/snapshots/e2e/**/*.png filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore index a67b0e6dc..c8bcbc9ac 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ yarn.lock /blob-report/ /playwright/.cache/ /playwright/results/ +.env diff --git a/e2e-local.sh b/e2e-local.sh index bc1efd49e..3b57bc4d7 100644 --- a/e2e-local.sh +++ b/e2e-local.sh @@ -48,6 +48,10 @@ fi echo "Using '$DOCKER' in '$NETWORK_MODE' mode, connecting to '$LOCAL_ADDRESS:$PORT'" +# Fetch snapshots using the npm script +echo "Fetching snapshots..." +npm run fetch-snapshots + if [ x$1 = "xshell" ]; then shift $DOCKER run -it --rm \ diff --git a/package-lock.json b/package-lock.json index eb368cd06..2b79a277c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,6 +39,7 @@ "angular-cli-ghpages": "^0.6.0", "cpx": "^1.5.0", "cross-env": "^7.0.2", + "dotenv-cli": "^7.4.4", "eslint": "^9.8.0", "eslint-plugin-jsdoc": "48.0.2", "eslint-plugin-prefer-arrow": "^1.2.3", @@ -8641,10 +8642,11 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -9145,6 +9147,45 @@ "url": "https://github.com/fb55/domutils?sponsor=1" } }, + "node_modules/dotenv": { + "version": "16.4.5", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", + "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/dotenv-cli": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/dotenv-cli/-/dotenv-cli-7.4.4.tgz", + "integrity": "sha512-XkBYCG0tPIes+YZr4SpfFv76SQrV/LeCE8CI7JSEMi3VR9MvTihCGTOtbIexD6i2mXF+6px7trb1imVCXSNMDw==", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.6", + "dotenv": "^16.3.0", + "dotenv-expand": "^10.0.0", + "minimist": "^1.2.6" + }, + "bin": { + "dotenv": "cli.js" + } + }, + "node_modules/dotenv-expand": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-10.0.0.tgz", + "integrity": "sha512-GopVGCpVS1UKH75VKHGuQFqS1Gusej0z4FyQkPdwjil2gNIv+LNsqBlboOzpJFZKVT95GkCyWJbBSdFEFUWI2A==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + } + }, "node_modules/duplexer": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", @@ -27427,9 +27468,9 @@ } }, "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, "requires": { "path-key": "^3.1.0", @@ -27764,6 +27805,30 @@ "domhandler": "^5.0.3" } }, + "dotenv": { + "version": "16.4.5", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", + "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", + "dev": true + }, + "dotenv-cli": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/dotenv-cli/-/dotenv-cli-7.4.4.tgz", + "integrity": "sha512-XkBYCG0tPIes+YZr4SpfFv76SQrV/LeCE8CI7JSEMi3VR9MvTihCGTOtbIexD6i2mXF+6px7trb1imVCXSNMDw==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.6", + "dotenv": "^16.3.0", + "dotenv-expand": "^10.0.0", + "minimist": "^1.2.6" + } + }, + "dotenv-expand": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-10.0.0.tgz", + "integrity": "sha512-GopVGCpVS1UKH75VKHGuQFqS1Gusej0z4FyQkPdwjil2gNIv+LNsqBlboOzpJFZKVT95GkCyWJbBSdFEFUWI2A==", + "dev": true + }, "duplexer": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", diff --git a/package.json b/package.json index 91826744b..0a2a33941 100644 --- a/package.json +++ b/package.json @@ -15,10 +15,12 @@ "test:unit": "ng test ngx-datatable-lib --watch=false", "test:watch": "ng test ngx-datatable-lib", "test:ci": "ng test ngx-datatable-lib --watch=false --progress=false --browsers=ChromeHeadlessCI", + "fetch-snapshots": "dotenv -e .env -- git clone https://$SNAPSHOT_REPO_TOKEN@github.com/chintankavathia/ngx-datatable-snapshots.git temp_snapshots && mkdir -p playwright/snapshots && cp -r temp_snapshots/snapshots/* playwright/snapshots/ && rm -rf temp_snapshots", "ci": "run-s lint test:ci", "lint": "ng lint", "e2e:prepare": "playwright install", "vrt": "cross-env playwright test", + "vrt:local": "yarn fetch-snapshots && yarn vrt", "vrt:update": "yarn vrt --update-snapshots", "build-docs": "cross-env NODE_ENV=production ng build --configuration production --base-href=\"/ngx-datatable/\"", "predeploy-docs": "npm run build-docs", @@ -64,9 +66,11 @@ "angular-cli-ghpages": "^0.6.0", "cpx": "^1.5.0", "cross-env": "^7.0.2", + "dotenv-cli": "^7.4.4", "eslint": "^9.8.0", "eslint-plugin-jsdoc": "48.0.2", "eslint-plugin-prefer-arrow": "^1.2.3", + "http-server": "^13.0.0", "jasmine": "^3.5.0", "jasmine-core": "~3.10.1", "jasmine-spec-reporter": "~7.0.0", @@ -82,8 +86,7 @@ "sass": "^1.77.6", "scss-bundle": "^3.1.1", "ts-node": "^10.9.2", - "typescript": "~5.5.4", - "http-server": "^13.0.0" + "typescript": "~5.5.4" }, "optionalDependencies": { "@axe-core/playwright": "4.8.2",