Spaces:
Sleeping
Sleeping
T1ckbase
commited on
Commit
·
cf88d39
0
Parent(s):
first commit
Browse files- .gitignore +136 -0
- .prettierrc +9 -0
- .vscode/settings.json +4 -0
- Dockerfile +23 -0
- README.md +13 -0
- main.ts +24 -0
- package.json +14 -0
- pnpm-lock.yaml +68 -0
- pnpm-workspace.yaml +2 -0
.gitignore
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Logs
|
| 2 |
+
logs
|
| 3 |
+
*.log
|
| 4 |
+
npm-debug.log*
|
| 5 |
+
yarn-debug.log*
|
| 6 |
+
yarn-error.log*
|
| 7 |
+
lerna-debug.log*
|
| 8 |
+
.pnpm-debug.log*
|
| 9 |
+
|
| 10 |
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
| 11 |
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
| 12 |
+
|
| 13 |
+
# Runtime data
|
| 14 |
+
pids
|
| 15 |
+
*.pid
|
| 16 |
+
*.seed
|
| 17 |
+
*.pid.lock
|
| 18 |
+
|
| 19 |
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
| 20 |
+
lib-cov
|
| 21 |
+
|
| 22 |
+
# Coverage directory used by tools like istanbul
|
| 23 |
+
coverage
|
| 24 |
+
*.lcov
|
| 25 |
+
|
| 26 |
+
# nyc test coverage
|
| 27 |
+
.nyc_output
|
| 28 |
+
|
| 29 |
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
| 30 |
+
.grunt
|
| 31 |
+
|
| 32 |
+
# Bower dependency directory (https://bower.io/)
|
| 33 |
+
bower_components
|
| 34 |
+
|
| 35 |
+
# node-waf configuration
|
| 36 |
+
.lock-wscript
|
| 37 |
+
|
| 38 |
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
| 39 |
+
build/Release
|
| 40 |
+
|
| 41 |
+
# Dependency directories
|
| 42 |
+
node_modules/
|
| 43 |
+
jspm_packages/
|
| 44 |
+
|
| 45 |
+
# Snowpack dependency directory (https://snowpack.dev/)
|
| 46 |
+
web_modules/
|
| 47 |
+
|
| 48 |
+
# TypeScript cache
|
| 49 |
+
*.tsbuildinfo
|
| 50 |
+
|
| 51 |
+
# Optional npm cache directory
|
| 52 |
+
.npm
|
| 53 |
+
|
| 54 |
+
# Optional eslint cache
|
| 55 |
+
.eslintcache
|
| 56 |
+
|
| 57 |
+
# Optional stylelint cache
|
| 58 |
+
.stylelintcache
|
| 59 |
+
|
| 60 |
+
# Microbundle cache
|
| 61 |
+
.rpt2_cache/
|
| 62 |
+
.rts2_cache_cjs/
|
| 63 |
+
.rts2_cache_es/
|
| 64 |
+
.rts2_cache_umd/
|
| 65 |
+
|
| 66 |
+
# Optional REPL history
|
| 67 |
+
.node_repl_history
|
| 68 |
+
|
| 69 |
+
# Output of 'npm pack'
|
| 70 |
+
*.tgz
|
| 71 |
+
|
| 72 |
+
# Yarn Integrity file
|
| 73 |
+
.yarn-integrity
|
| 74 |
+
|
| 75 |
+
# dotenv environment variable files
|
| 76 |
+
.env
|
| 77 |
+
.env.development.local
|
| 78 |
+
.env.test.local
|
| 79 |
+
.env.production.local
|
| 80 |
+
.env.local
|
| 81 |
+
|
| 82 |
+
# parcel-bundler cache (https://parceljs.org/)
|
| 83 |
+
.cache
|
| 84 |
+
.parcel-cache
|
| 85 |
+
|
| 86 |
+
# Next.js build output
|
| 87 |
+
.next
|
| 88 |
+
out
|
| 89 |
+
|
| 90 |
+
# Nuxt.js build / generate output
|
| 91 |
+
.nuxt
|
| 92 |
+
dist
|
| 93 |
+
|
| 94 |
+
# Gatsby files
|
| 95 |
+
.cache/
|
| 96 |
+
# Comment in the public line in if your project uses Gatsby and not Next.js
|
| 97 |
+
# https://nextjs.org/blog/next-9-1#public-directory-support
|
| 98 |
+
# public
|
| 99 |
+
|
| 100 |
+
# vuepress build output
|
| 101 |
+
.vuepress/dist
|
| 102 |
+
|
| 103 |
+
# vuepress v2.x temp and cache directory
|
| 104 |
+
.temp
|
| 105 |
+
.cache
|
| 106 |
+
|
| 107 |
+
# vitepress build output
|
| 108 |
+
**/.vitepress/dist
|
| 109 |
+
|
| 110 |
+
# vitepress cache directory
|
| 111 |
+
**/.vitepress/cache
|
| 112 |
+
|
| 113 |
+
# Docusaurus cache and generated files
|
| 114 |
+
.docusaurus
|
| 115 |
+
|
| 116 |
+
# Serverless directories
|
| 117 |
+
.serverless/
|
| 118 |
+
|
| 119 |
+
# FuseBox cache
|
| 120 |
+
.fusebox/
|
| 121 |
+
|
| 122 |
+
# DynamoDB Local files
|
| 123 |
+
.dynamodb/
|
| 124 |
+
|
| 125 |
+
# TernJS port file
|
| 126 |
+
.tern-port
|
| 127 |
+
|
| 128 |
+
# Stores VSCode versions used for testing VSCode extensions
|
| 129 |
+
.vscode-test
|
| 130 |
+
|
| 131 |
+
# yarn v2
|
| 132 |
+
.yarn/cache
|
| 133 |
+
.yarn/unplugged
|
| 134 |
+
.yarn/build-state.yml
|
| 135 |
+
.yarn/install-state.gz
|
| 136 |
+
.pnp.*
|
.prettierrc
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"printWidth": 69420,
|
| 3 |
+
"tabWidth": 2,
|
| 4 |
+
"semi": true,
|
| 5 |
+
"singleQuote": true,
|
| 6 |
+
"jsxSingleQuote": true,
|
| 7 |
+
"singleAttributePerLine": false,
|
| 8 |
+
"arrowParens": "always"
|
| 9 |
+
}
|
.vscode/settings.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
| 3 |
+
"editor.formatOnSave": true
|
| 4 |
+
}
|
Dockerfile
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM node:latest
|
| 2 |
+
|
| 3 |
+
ENV PNPM_HOME="/pnpm"
|
| 4 |
+
|
| 5 |
+
ENV PATH="$PNPM_HOME:$PATH"
|
| 6 |
+
|
| 7 |
+
RUN corepack enable
|
| 8 |
+
|
| 9 |
+
WORKDIR /app
|
| 10 |
+
|
| 11 |
+
COPY package.json pnpm-lock.yaml ./
|
| 12 |
+
|
| 13 |
+
ENV PLAYWRIGHT_BROWSERS_PATH=/app/node_modules/playwright/.local-browsers
|
| 14 |
+
|
| 15 |
+
RUN pnpm install --frozen-lockfile
|
| 16 |
+
|
| 17 |
+
COPY . .
|
| 18 |
+
|
| 19 |
+
# RUN pnpm exec playwright install --with-deps chromium
|
| 20 |
+
|
| 21 |
+
EXPOSE 9222
|
| 22 |
+
|
| 23 |
+
CMD ["pnpm", "run", "start"]
|
README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Remote Playwright Test
|
| 3 |
+
emoji: 📈
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
| 8 |
+
license: mit
|
| 9 |
+
short_description: remote playwright test
|
| 10 |
+
app_port: 9222
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
main.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { chromium, devices } from 'playwright';
|
| 2 |
+
|
| 3 |
+
const browser = await chromium.launch({ headless: true, args: ['--disable-blink-features=AutomationControlled', '--remote-debugging-port=9222'] });
|
| 4 |
+
const context = await browser.newContext({
|
| 5 |
+
...devices['Desktop Chrome'],
|
| 6 |
+
colorScheme: 'dark',
|
| 7 |
+
// viewport: null,
|
| 8 |
+
viewport: { width: 1920, height: 1080 },
|
| 9 |
+
// deviceScaleFactor: undefined,
|
| 10 |
+
});
|
| 11 |
+
|
| 12 |
+
const page = await context.newPage();
|
| 13 |
+
|
| 14 |
+
// await page.goto('https://bot.sannysoft.com', { waitUntil: 'load' });
|
| 15 |
+
// await page.goto('https://www.browserscan.net/bot-detection');
|
| 16 |
+
// await page.goto('https://fingerprintjs.github.io/BotD/main/');
|
| 17 |
+
await page.goto('https://google.com');
|
| 18 |
+
|
| 19 |
+
// await page.screenshot({ path: 'screenshot.png', fullPage: true });
|
| 20 |
+
|
| 21 |
+
await page.waitForEvent('close', { timeout: 0 });
|
| 22 |
+
|
| 23 |
+
await context.close();
|
| 24 |
+
await browser.close();
|
package.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"scripts": {
|
| 3 |
+
"start": "node --disable-warning=ExperimentalWarning main.ts"
|
| 4 |
+
},
|
| 5 |
+
"dependencies": {
|
| 6 |
+
"@playwright/browser-chromium": "^1.52.0",
|
| 7 |
+
"browser-chromium": "link:@playwright\\browser-chromium",
|
| 8 |
+
"playwright": "^1.52.0"
|
| 9 |
+
},
|
| 10 |
+
"devDependencies": {
|
| 11 |
+
"prettier": "^3.5.3"
|
| 12 |
+
},
|
| 13 |
+
"type": "module"
|
| 14 |
+
}
|
pnpm-lock.yaml
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
lockfileVersion: '9.0'
|
| 2 |
+
|
| 3 |
+
settings:
|
| 4 |
+
autoInstallPeers: true
|
| 5 |
+
excludeLinksFromLockfile: false
|
| 6 |
+
|
| 7 |
+
importers:
|
| 8 |
+
|
| 9 |
+
.:
|
| 10 |
+
dependencies:
|
| 11 |
+
'@playwright/browser-chromium':
|
| 12 |
+
specifier: ^1.52.0
|
| 13 |
+
version: 1.52.0
|
| 14 |
+
browser-chromium:
|
| 15 |
+
specifier: link:@playwright\browser-chromium
|
| 16 |
+
version: link:@playwright/browser-chromium
|
| 17 |
+
playwright:
|
| 18 |
+
specifier: ^1.52.0
|
| 19 |
+
version: 1.52.0
|
| 20 |
+
devDependencies:
|
| 21 |
+
prettier:
|
| 22 |
+
specifier: ^3.5.3
|
| 23 |
+
version: 3.5.3
|
| 24 |
+
|
| 25 |
+
packages:
|
| 26 |
+
|
| 27 |
+
'@playwright/browser-chromium@1.52.0':
|
| 28 |
+
resolution: {integrity: sha512-n2/e2Q0dFACFg/1JZ0t2IYLorDdno6q1QwKnNbPICHwCkAtW7+fSMqCvJ9FSMWSyPugxZqIFhownSpyATxtiTw==}
|
| 29 |
+
engines: {node: '>=18'}
|
| 30 |
+
|
| 31 |
+
fsevents@2.3.2:
|
| 32 |
+
resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==}
|
| 33 |
+
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
|
| 34 |
+
os: [darwin]
|
| 35 |
+
|
| 36 |
+
playwright-core@1.52.0:
|
| 37 |
+
resolution: {integrity: sha512-l2osTgLXSMeuLZOML9qYODUQoPPnUsKsb5/P6LJ2e6uPKXUdPK5WYhN4z03G+YNbWmGDY4YENauNu4ZKczreHg==}
|
| 38 |
+
engines: {node: '>=18'}
|
| 39 |
+
hasBin: true
|
| 40 |
+
|
| 41 |
+
playwright@1.52.0:
|
| 42 |
+
resolution: {integrity: sha512-JAwMNMBlxJ2oD1kce4KPtMkDeKGHQstdpFPcPH3maElAXon/QZeTvtsfXmTMRyO9TslfoYOXkSsvao2nE1ilTw==}
|
| 43 |
+
engines: {node: '>=18'}
|
| 44 |
+
hasBin: true
|
| 45 |
+
|
| 46 |
+
prettier@3.5.3:
|
| 47 |
+
resolution: {integrity: sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==}
|
| 48 |
+
engines: {node: '>=14'}
|
| 49 |
+
hasBin: true
|
| 50 |
+
|
| 51 |
+
snapshots:
|
| 52 |
+
|
| 53 |
+
'@playwright/browser-chromium@1.52.0':
|
| 54 |
+
dependencies:
|
| 55 |
+
playwright-core: 1.52.0
|
| 56 |
+
|
| 57 |
+
fsevents@2.3.2:
|
| 58 |
+
optional: true
|
| 59 |
+
|
| 60 |
+
playwright-core@1.52.0: {}
|
| 61 |
+
|
| 62 |
+
playwright@1.52.0:
|
| 63 |
+
dependencies:
|
| 64 |
+
playwright-core: 1.52.0
|
| 65 |
+
optionalDependencies:
|
| 66 |
+
fsevents: 2.3.2
|
| 67 |
+
|
| 68 |
+
prettier@3.5.3: {}
|
pnpm-workspace.yaml
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
onlyBuiltDependencies:
|
| 2 |
+
- '@playwright/browser-chromium'
|