node ready for autonomu with dependencies

This commit is contained in:
Muhammad Sameer Khan 2023-12-19 17:52:45 +05:00
parent 0e8d312794
commit 2e275389ab
7 changed files with 429 additions and 6 deletions

View File

@ -73,6 +73,7 @@
"passport-http-bearer": "1.0.1",
"passport-oauth2-client-password": "0.1.2",
"raw-body": "2.5.2",
"request-promise": "^4.2.6",
"semver": "7.5.4",
"tar": "6.1.13",
"tough-cookie": "4.1.3",
@ -85,6 +86,7 @@
"bcrypt": "5.1.1"
},
"devDependencies": {
"@playwright/test": "^1.40.1",
"dompurify": "2.4.1",
"grunt": "1.6.1",
"grunt-chmod": "~1.1.1",
@ -114,6 +116,7 @@
"mocha": "9.2.2",
"node-red-node-test-helper": "^0.3.2",
"nodemon": "2.0.20",
"playwright": "^1.40.1",
"proxy": "^1.0.2",
"sass": "1.62.1",
"should": "13.2.3",

View File

@ -73,14 +73,14 @@ module.exports = {
/** To password protect the Node-RED editor and admin API, the following
* property can be used. See https://nodered.org/docs/security.html for details.
*/
//adminAuth: {
// adminAuth: {
// type: "credentials",
// users: [{
// username: "admin",
// password: "$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN.",
// permissions: "*"
// }]
//},
// },
/** The following property can be used to enable HTTPS
* This property can be either an object, containing both a (private) key
@ -90,10 +90,10 @@ module.exports = {
*/
/** Option 1: static object */
//https: {
// https: {
// key: require("fs").readFileSync('privkey.pem'),
// cert: require("fs").readFileSync('cert.pem')
//},
// },
/** Option 2: function that returns the HTTP configuration object */
// https: function() {
@ -122,8 +122,8 @@ module.exports = {
* The `pass` field is a bcrypt hash of the password.
* See https://nodered.org/docs/security.html#generating-the-password-hash
*/
//httpNodeAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},
//httpStaticAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},
// httpNodeAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},
// httpStaticAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},
/*******************************************************************************
* Server Settings
@ -481,6 +481,8 @@ module.exports = {
*/
functionGlobalContext: {
// os:require('os'),
// env:process.env,
// playwright: require("playwright")
},
/** The maximum number of messages nodes will buffer internally as part of their

File diff suppressed because one or more lines are too long

97
playwright.config.js Normal file
View File

@ -0,0 +1,97 @@
import { defineConfig, devices } from '@playwright/test';
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './tests',
/* 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: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
// reporter: 'html',
// reporter: [['json', { outputFile: 'report.json' }]],
// reporter: [
// // ['@skilbourn/playwright-report-summary', { outputFile: 'custom-summary.txt' }],
// ['html', { outputFile: 'playwright-report/index.html' }], // other reporters
// ['json', { outputFile: 'test-results/report.json' }],
// // ['dot']
// ],
reporter: [
// ['@skilbourn/playwright-report-summary', { outputFile: 'custom-summary.txt' }],
['html', { outputFile: 'index.html', outputFolder: 'playwright-report' }], // other reporters
['json', { outputFile: 'test-results/report.json' }],
// ['dot']
],
// reporter:[
// ['html'],
// ['./reporter.ts']
// ],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* 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: 'on-first-retry',
},
/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },
/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
// {
// 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://127.0.0.1:3000',
// reuseExistingServer: !process.env.CI,
// },
});

214
test-results/report.json Normal file

File diff suppressed because one or more lines are too long

34
tests/bw.spec.ts Normal file
View File

@ -0,0 +1,34 @@
import { test, expect } from '@playwright/test';
test.setTimeout(120000);
// test.use({storageState: {"cookies":[{"domain":".gurug.com","expires":1737041480.12831,"httpOnly":false,"name":"_ga_BQX88M1CPB","path":"/","secure":false,"value":"GS1.1.1702481480.8.0.1702481480.60.0.0"},{"domain":".gurug.com","expires":1737041480.722214,"httpOnly":false,"name":"_ga","path":"/","secure":false,"value":"GA1.2.832435228.1696946692"},{"domain":".gurug.com","expires":1702567880,"httpOnly":false,"name":"_gid","path":"/","secure":false,"value":"GA1.2.2102815360.1702481481"}],"origins":[{"localStorage":[],"origin":"https://gurug.com/"}]}});
test('Written with Testmation Recorder', async ({ browser }) => {
// Load and set cookies for"https://gurug.com/"
const browserContext = await browser.newContext();
const page = await browserContext.newPage();
await page.goto('https://gurug.com/');
// Resize window to 1477 x 934
await page.setViewportSize({ width: 1477, height: 934 });
// Click on <nav> "Expertise Microsoft Dynam..."
await page.click('.navbar');
// Click on <nav> "Expertise Microsoft Dynam..."
await page.click('.navbar');
// Click on <nav> "Expertise Microsoft Dynam..."
await page.click('.navbar');
// Click on <nav> "Expertise Microsoft Dynam..."
await page.click('.navbar');
// Click on <div> "Innovation Right Here Gu..."
await page.click('.banner_top');
// Click on <div> "Innovation Right Here Gu..."
await page.click('.banner_top');
});

11
tsconfig.json Normal file
View File

@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"strict": true,
"esModuleInterop": true
},
"include": [
"tests/bw.spec.ts"
]
}