mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53:44 +00:00
Nav.refresh() fetches the current page and compares the server's HTML now with the HTML the page started from; only what differs is patched into the live page (text, attributes, class changes, rows added or taken away). Typed input stays (the browser keeps what the user changed while the default value follows the server), and parts built by the page's scripts are left alone. Where a patch would lose script-built or script-bound parts, or the page's layout changed, the page is swapped in again with its scripts, keeping the scroll position, open tabs, open folding parts and typed input; while the user is typing it offers a refresh instead. Live.refreshPage (account, character, bug report and play key pages) uses it instead of reloading the page, and the "This changed while you were editing" banner's Refresh does too. Check: open a play key; in another tab change its uses or active switch: the first tab's values and badge change without a reload, and notes typed there stay. Same on a bug report page with a half typed resolution when it's resolved elsewhere. On a character page, an in-game save updates it without losing the open tab or scroll. Test: NavRulesJs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
101 lines
3.8 KiB
CMake
101 lines
3.8 KiB
CMake
set(DWEBTESTS_SOURCES
|
|
"MiddlewareTests.cpp"
|
|
"RouteIntegrationTests.cpp"
|
|
"ServerStateTests.cpp"
|
|
"AccountActionTests.cpp"
|
|
"RouteUtilsTests.cpp"
|
|
"JWTTests.cpp"
|
|
"RequireAuthMiddlewareTests.cpp"
|
|
"WebTestDependencies.cpp"
|
|
"PlayerActionTests.cpp"
|
|
"SmtpTests.cpp"
|
|
"OAuth2Tests.cpp"
|
|
"EconomyReportTests.cpp"
|
|
"ItemTraceTests.cpp"
|
|
"CronTests.cpp"
|
|
"PermissionsTests.cpp"
|
|
"PermissionGrantsTests.cpp"
|
|
"ApiKeyTests.cpp"
|
|
"SettingsCatalogTests.cpp"
|
|
"BehaviorXmlTests.cpp"
|
|
"CharacterXmlTests.cpp"
|
|
"CharacterXmlCheckTests.cpp"
|
|
"CharacterRestoreTests.cpp"
|
|
"ZonePathsTests.cpp"
|
|
"RawTerrainTests.cpp"
|
|
"LevelObjectsTests.cpp"
|
|
"GameLabelsTests.cpp"
|
|
"VanityJsonTests.cpp"
|
|
"OpenApiTests.cpp"
|
|
"MessageInspectorTests.cpp"
|
|
"CDClientSchemaTests.cpp"
|
|
"ServerOperationsTests.cpp"
|
|
"PublicPagesTests.cpp"
|
|
"ModerationToolsTests.cpp"
|
|
"LocaleTextTests.cpp"
|
|
"ModeratorHelperTests.cpp"
|
|
"${PROJECT_SOURCE_DIR}/dDashboardServer/ai/ClaudeClient.cpp"
|
|
"${PROJECT_SOURCE_DIR}/dDashboardServer/ai/ModeratorPrompt.cpp"
|
|
"WorldViewTests.cpp"
|
|
"NifFileTests.cpp"
|
|
"DeferredReplyTests.cpp"
|
|
"WorkerPoolTests.cpp"
|
|
"OnceCacheTests.cpp"
|
|
"UgcLookupTests.cpp"
|
|
"${PROJECT_SOURCE_DIR}/dDashboardServer/routes/WorkerPool.cpp"
|
|
"BackupFilesTests.cpp"
|
|
"LogBundleTests.cpp"
|
|
"${PROJECT_SOURCE_DIR}/dDashboardServer/routes/LogBundle.cpp"
|
|
"SecurityFixesTests.cpp"
|
|
"${PROJECT_SOURCE_DIR}/dDashboardServer/routes/BackupFiles.cpp"
|
|
"MetricsFormatTests.cpp"
|
|
"TrafficHistoryTests.cpp"
|
|
"${PROJECT_SOURCE_DIR}/dDashboardServer/routes/TrafficHistory.cpp"
|
|
"${PROJECT_SOURCE_DIR}/dDashboardServer/routes/SettingsCatalog.cpp"
|
|
"AlertsAndTwoFactorTests.cpp"
|
|
"${PROJECT_SOURCE_DIR}/dDashboardServer/auth/Totp.cpp"
|
|
"${PROJECT_SOURCE_DIR}/dDashboardServer/notify/WebhookFormat.cpp"
|
|
"${PROJECT_SOURCE_DIR}/dDashboardServer/email/OAuth2.cpp"
|
|
"${PROJECT_SOURCE_DIR}/dDashboardServer/email/SmtpClient.cpp"
|
|
"${PROJECT_SOURCE_DIR}/dDashboardServer/auth/JWTUtils.cpp"
|
|
"${PROJECT_SOURCE_DIR}/dDashboardServer/auth/RequireAuthMiddleware.cpp"
|
|
)
|
|
|
|
add_executable(dWebTests ${DWEBTESTS_SOURCES})
|
|
|
|
target_include_directories(dWebTests PRIVATE
|
|
"${PROJECT_SOURCE_DIR}/dCommon"
|
|
"${PROJECT_SOURCE_DIR}/dCommon/dClient"
|
|
"${PROJECT_SOURCE_DIR}/dWeb"
|
|
"${PROJECT_SOURCE_DIR}/dDashboardServer"
|
|
"${PROJECT_SOURCE_DIR}/dDashboardServer/auth"
|
|
"${PROJECT_SOURCE_DIR}/dDashboardServer/routes"
|
|
"${PROJECT_SOURCE_DIR}/dChatFilter"
|
|
"${PROJECT_SOURCE_DIR}/dDashboardServer/email"
|
|
"${PROJECT_SOURCE_DIR}/dDashboardServer/notify"
|
|
"${PROJECT_SOURCE_DIR}/dDashboardServer/ai"
|
|
"${PROJECT_SOURCE_DIR}/dDatabase/GameDatabase/ITables"
|
|
"${PROJECT_SOURCE_DIR}/dNet"
|
|
"${PROJECT_SOURCE_DIR}/thirdparty/nlohmann"
|
|
)
|
|
|
|
target_link_libraries(dWebTests ${COMMON_LIBRARIES} dWeb dUgc sqlite3 OpenSSL::Crypto CURL::libcurl GTest::gtest_main)
|
|
|
|
gtest_discover_tests(dWebTests)
|
|
|
|
target_compile_definitions(dWebTests PRIVATE DLU_SOURCE_DIR="${PROJECT_SOURCE_DIR}")
|
|
|
|
# The 3D views' shader lookups (static/js/scenery-core.js) against the server's bits (NifFile.h), when node is there
|
|
find_program(NODE_EXECUTABLE node)
|
|
if(NODE_EXECUTABLE)
|
|
add_test(NAME SceneryCoreJs COMMAND ${NODE_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scenery-core.test.mjs"
|
|
"${PROJECT_SOURCE_DIR}/dDashboardServer/static/js/scenery-core.js" "${PROJECT_SOURCE_DIR}/dCommon/NifFile.h"
|
|
"${PROJECT_SOURCE_DIR}/dDashboardServer/routes/Scenery.cpp")
|
|
# The sidebar's saved group state (the script at the end of templates/header.jinja2)
|
|
add_test(NAME SidebarStateJs COMMAND ${NODE_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/sidebar-state.test.mjs"
|
|
"${PROJECT_SOURCE_DIR}/dDashboardServer/templates/header.jinja2")
|
|
# Which links the dashboard follows without a reload, and its in-place update rules (static/js/nav.js)
|
|
add_test(NAME NavRulesJs COMMAND ${NODE_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/nav.test.mjs"
|
|
"${PROJECT_SOURCE_DIR}/dDashboardServer/static/js/nav.js")
|
|
endif()
|