Improved automated page testing script on onprem

This commit is contained in:
lalitdeore12@gmail.com
2025-02-24 14:14:37 +05:30
parent c8d55573f3
commit fcf4450a3d
4 changed files with 13 additions and 43 deletions
+8 -40
View File
@@ -1,51 +1,21 @@
SERVER_URL="http://localhost:3000" SERVER_URL="http://localhost:3000"
declare -a Routes=() declare -a Routes=($(grep -oP '(?<=path=")[^"]*' src/App.jsx | grep -E '^[a-zA-Z0-9/_:-]+$' | grep -vE '^/$'))
# Add all cloud routes here for i in "${!Routes[@]}"; do
if [[ "$SERVER_URL" == "http://localhost:3001" || "$SERVER_URL" == "http://localhost:3002" || "$SERVER_URL" == "https://sandbox.shuffler.io" || "$SERVER_URL" == "https://shuffler.io" ]]; then Routes[$i]="${Routes[$i]#/}"
Routes+=( done
'homepage'
'home'
'contact'
'workflows/fa9314a7-bb9b-4b41-8885-1d02b199f04d'
'services'
'debug'
'creator'
'articles'
'partners'
'pricing'
'pricing2'
'training'
'professional-services'
'detections'
)
fi
# Add all common routes here # # Add all tab routes and unique routes here
Routes+=( Routes+=(
'workflows'
'workflows?tab=org_workflows' 'workflows?tab=org_workflows'
'workflows?tab=my_workflows' 'workflows?tab=my_workflows'
'workflows?tab=all_workflows' 'workflows?tab=all_workflows'
'workflows/debug'
'debug'
'usecases'
'usecases2'
'getting-started'
'welcome'
'health'
'docs'
'settings'
'apps/new'
'apps/gmail' 'apps/gmail'
'apis/gmail' 'apis/gmail'
'forms'
'apps'
'apps?tab=my_apps' 'apps?tab=my_apps'
'apps?tab=all_apps' 'apps?tab=all_apps'
'search'
'search?tab=org_apps' 'search?tab=org_apps'
'search?tab=my_apps' 'search?tab=my_apps'
'search?tab=workflows' 'search?tab=workflows'
@@ -67,13 +37,11 @@ Routes+=(
"admin?admin_tab=branding(beta)" "admin?admin_tab=branding(beta)"
) )
ALL_ROUTES=("${Routes[@]}")
# Stop frontend container so it test unpushed changes # Stop frontend container so it test unpushed changes
docker stop shuffle-frontend docker stop shuffle-frontend
# Install all frontend dependencies # # Install all frontend dependencies
yarn install yarn add selenium-webdriver --dev && yarn install
echo "Starting frontend..." echo "Starting frontend..."
BROWSER=none yarn start & BROWSER=none yarn start &
@@ -86,7 +54,7 @@ sleep 60
echo "Server is up! Starting Selenium tests..." echo "Server is up! Starting Selenium tests..."
echo "Starting frontend tests..." echo "Starting frontend tests..."
node selenium-test.js "$SERVER_URL" "${ALL_ROUTES[@]}" node selenium-test.js "$SERVER_URL" "${Routes[@]}"
TEST_EXIT_CODE=$? TEST_EXIT_CODE=$?
+1 -1
View File
@@ -88,7 +88,6 @@
"remark-rehype": "^11.0.0", "remark-rehype": "^11.0.0",
"rsuite": "^5.23.0", "rsuite": "^5.23.0",
"search-insights": "^2.2.1", "search-insights": "^2.2.1",
"selenium-webdriver": "^4.28.1",
"shellwords": "^1.0.1", "shellwords": "^1.0.1",
"simplebar": "^4.2.3", "simplebar": "^4.2.3",
"styled-components": "^4.4.1", "styled-components": "^4.4.1",
@@ -129,6 +128,7 @@
"babel-preset-es2015": "^6.24.1", "babel-preset-es2015": "^6.24.1",
"postcss": "^8.4.38", "postcss": "^8.4.38",
"promise-window": "^1.2.1", "promise-window": "^1.2.1",
"selenium-webdriver": "^4.29.0",
"webpack-cli": "^5.1.4" "webpack-cli": "^5.1.4"
} }
} }
+3 -2
View File
@@ -34,8 +34,9 @@ console.log('Starting Selenium script for testing pages...');
if (isCloud) { if (isCloud) {
// Login Credentials // Login Credentials
const LOGIN_URL = `${frontendURL}/login`; const LOGIN_URL = `${frontendURL}/login`;
const USERNAME = 'shuffle-testing@gmail.com'; // put your login credentials here
const PASSWORD = 'testing@123'; const USERNAME = '';
const PASSWORD = '';
console.log('Logging in...'); console.log('Logging in...');
await driver.get(LOGIN_URL); await driver.get(LOGIN_URL);
+1
View File
@@ -297,6 +297,7 @@ const App = (message, props) => {
element={ element={
<Admin <Admin
isLoggedIn={isLoggedIn} isLoggedIn={isLoggedIn}
userdata={userdata}
setIsLoggedIn={setIsLoggedIn} setIsLoggedIn={setIsLoggedIn}
register={true} register={true}
isLoaded={isLoaded} isLoaded={isLoaded}