Skip to content

Changes/playwirght - #172

Merged
vinaghost merged 108 commits into
mainfrom
changes/playwirght
Oct 13, 2026
Merged

vinaghost merged 108 commits into
mainfrom
changes/playwirght

Conversation

@vinaghost

@vinaghost vinaghost commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Major update to TBS
You may want to start on new account instead of replace old file

  • Change automation framework from Selenium to Playwright. (still requires Chrome)
  • Update all libraries in the project
  • Add auto-read tribe (no need to input tribe before login)
  • Add default settings for new account & new village
  • Add FAQs folder to support user
  • Fix various bugs that were reported this year and last year

If you don't need above changes, no need to update to this version but before report any bug, please try newest version first.

If you like my work and want to say thanks, or encourage me, you can buy me a coffee!

Thank you!

Update NuGet dependencies across all projects

Upgraded major and minor NuGet packages in MainCore, MainCore.Test, and WPFUI projects, including ReactiveUI, Splat, Serilog, FluentValidation, HtmlAgilityPack, Humanizer.Core, Polly, Selenium, and related dependencies. Updated packages.lock.json to reflect new and removed dependencies. No code logic changes; only package version updates for improved compatibility and maintenance.
Refactored codebase to use ReactiveUI.Primitives and related packages, replacing System.Reactive dependencies. Updated all usages of Unit to RxVoid, Observable to Signal, and refactored Interaction/ReactiveCommand signatures for RxVoid and RxSchedulers. Replaced RxApp schedulers with RxSchedulers, and updated dialog/file dialog interactions to new async methods in IDialogService/DialogService. Improved null safety in parsers, replaced ObservableExceptionHandler with LoggingExceptionObserver, and updated DI setup to use ConfigureSplatForMicrosoftDependencyResolver. Updated usages of InvokeCommand, Subscribe, Execute, and dialog handlers to new async patterns. Added/updated dependencies in packages.lock.json and MainCore.csproj. Improved null checks, error handling, logging, and UI thread safety.
Replaced all usages of DynamicData (e.g., AddRange) with manual foreach loops for ObservableCollection updates. Removed System.Reactive.Disposables.Fluent using directives where no longer needed. Explicitly imported ReactiveUI.Primitives in several files for compatibility. Updated .csproj and packages.lock.json to remove unused dependencies. Minor refactoring in view models to support these changes.
Replaced all Selenium dependencies and code with Microsoft.Playwright for browser automation. Updated ChromeBrowser.cs to use Playwright APIs for browser, page, and element management. Simplified IChromeBrowser interface to use Playwright types and removed Selenium-specific signatures. Removed ChromeDriverInstaller logic and all Selenium-related package references.
Replaced all HTML parsing logic in Parsers to use Microsoft.Playwright (`IPage`, `ILocator`) instead of HtmlAgilityPack. Refactored methods for async Playwright operations, updated signatures to return Playwright locators or async results, and removed all HtmlAgilityPack dependencies. Introduced regular expressions for class extraction where needed and ensured compatibility with Playwright's locator-based querying and asynchronous model. Updated project references and using statements accordingly. This modernizes the codebase for robust browser automation and dynamic web scraping.
…ing to Playwright page and locator APIs across commands, parsers, and tests. Updated browser helpers, refactored parsers and handlers to be async/page-based, switched logout and sleep flows to Shutdown(), modernized tests to xUnit v3 with shared Playwright fixtures, and removed obsolete dependencies and browser extension startup logic.
Updated `ChromeBrowser.WaitForURLAsync` to use a case-insensitive regex for URL matching reducing exact-match navigation failures.
Added a check in `LoginTask.cs` to detect the CMP consent wrapper on the current page and click the accept button when present before continuing with contextual help and options page navigation.
Added pooled DbContext factory support so the command can create fresh AppDbContext instances on demand. Converted OpenBrowserCommand to an instance handler with injected IChromeBrowser and IDbContextFactory<AppDbContext>. Split account loading and profile path creation into dedicated helpers, and moved last-used timestamp updates to a separate context after navigation completes.
Adapt parsing to the new React DOM structure and simplify CanStartAdventure visibility checks by using element counts instead of IsVisibleAsync().
Consolidate contextual-help handling into `LoginTask`, add cookie-consent detection, and split login into clearer steps with constructor-injected dependencies.
…oving separate command handlers, adding constructor injection, and moving navigation/selection logic into private helpers. Preserve behavior while scheduling the next execution directly via `task.ExecuteAt`.
Consolidate sleep-related handlers into SleepTask, convert it to a sealed class with injected dependencies, move duration lookup into local DbContext helpers, and update the flow to shut down the browser, sleep, reacquire access, and schedule the next run with improved cancellation handling.
Move login workflow into LoginTask, use a short-lived AppDbContext via IDbContextFactory in GetLoginInfo, change DisableContextualHelp to ValueTask<Result>, and accept cookie consent before login.
Consolidate quest navigation and claiming into `ClaimQuestTask` with private helper methods, preserving the existing claim loop and task sequencing.
Move the complete-immediately logic into CompleteImmediatelyTask, inject dependencies, and replace the command call with a shared InstantUpgrade helper while preserving queue handling.
…file to format correctly.Refactor NPC task handling and chaining

Refactored NPC handling into instance-based task logic, moved page navigation into `NpcTask` helpers, preserved exchange behavior and overflow checks, and enqueue `UpgradeBuildingTask` after successful runs.
Narrow AdventureParser to the adventure duration section and update StartAdventureTask to wait for the new locator after navigation.
Move farm-list features to constructor-injected partial classes, consolidate start/update task execution and scheduling, and resolve rallypoint navigation internally.
Consolidate troop-training logic into an injected TrainTroopTask, replacing separate command handlers with internal helpers, using DbContextFactory scopes for building lookup and repeat-time calculation, and preserving troop selection, error handling, settings saves, and next-run scheduling.
Move next-execution calculation into UpdateVillageTask, convert village/building tasks to instance-based sealed partial classes with injected dependencies and primary-constructor task records, and clean up SleepTask imports.
Use a primary constructor for `UpgradeBuildingTask.Task`, passing `accountId` and `villageId` directly to `VillageTask` while preserving the `TaskName` override.
Added Chrome launch flags to disable non-proxied UDP WebRTC traffic and force the IP-handling policy, while preserving the existing `--disable-search-engine-choice-screen` argument formatting.
Inject handlers, use per-call DbContexts, serialize job DTOs directly, simplify navigation/build-page logic, fold build-plan validation into GetBuildPlanCommand, and update parsers, quest handling, and task timing.
Async Playwright locator handling now validates the expected 5 resources, splits normal and special building upgrades in `HandleUpgradeCommand` with injected dependencies and helper methods, improves parser selectors and async locator helpers, simplifies location navigation, and removes `GetBuildingSpec` filtering logic from the command.
Refactor the building upgrade flow to use the hero resource transfer UI from the upgrade panel, validate available inventory on the current page, confirm the transfer, and wait for the success toast. Also pass the building type through the command chain, remove the old availability command, normalize building names, and add parser helpers for the fill-up and confirm buttons.
Moved cropland expansion and resource validation into `HandleResourceCommand`, added automatic cropland queuing on `LackOfFreeCrop`, improved the hero-resource click/reload flow, and removed cropland handling from `UpgradeBuildingTask`.
Added end-to-end daily quest automation: introduced the EnableAutoClaimDailyQuest setting, wired UI and persistence defaults, added daily quest navigation and claim parser helpers, extended task dispatching, and implemented the browser task to claim rewards and refresh the page.
Add ModernDependencyResolver and ReactiveUIBuilder
to App.xaml.cs, register exception handling and core
services before host build, update usings for
Immediate.Handlers.Shared/ReactiveUI/Splat, and fix
MessageBox.Show argument order so error text and
title are displayed correctly.
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown

Version of this build is 2.12.117
Check download link here

Remove Tribe from imported settings before saving in AccountSettingViewModel and VillageSettingViewModel so it is not persisted or used when triggering follow-up tasks.
Added browser initialization and headless state tracking to `ChromeBrowser`/`IChromeBrowser`, updated `DebugViewModel` command execution and dependencies, and replaced the devtools endpoint UI with a new “Bring browser to front” action wired to `BringToFrontAsync()`.
Support persisted default template paths for new account and village setup, including account settings, village settings, and village building lists; wire the new defaults into creation/import flows and clean up related layout and import noise
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown

Version of this build is 2.12.118
Check download link here

Replace interface-based service injection and DI registrations with concrete types across commands, behaviors, schedulers, browsers, and view models. Update App startup, ChromeBrowser, ChromeManager, and related consumers to use direct service classes. Add DefaultTemplatePaths record and rename update quest command handlers for consistency.
Add auto hero point allocation settings and task handling, and wire the new command flow through persistence, UI, and dispatcher.
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown

Version of this build is 2.12.119
Check download link here

Refactor AppDbContext helper methods to the new extension(...) syntax while preserving job management, settings updates, layout calculation, and task-trigger behavior.
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown

Version of this build is 2.12.120
Check download link here

Remove automatic EditAccountCommand chaining in EditAccountViewModel and explicitly reload the current account after updates so the view shows the latest data.
Refactor global usings,
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

Version of this build is 2.12.121
Check download link here

@github-actions

Copy link
Copy Markdown

Version of this build is 2.12.122
Check download link here

Removed the default building list template flow for new villages, including the related setting, command, UI button, and binding. New villages now only apply village settings templates, and `EnableAutoSetHeroPoint` is now editable in the account settings view.
Reorganized using directives across commands, DTOs, services, view models, and WPF code-behind;
Remove duplicate failure logging from the timer flow and limit task name logging to `Result` responses, keeping success info logs and adding warnings on failed tasks.
Removed BuildingList template path support from DefaultTemplatePathStore, limited DefaultTemplatePaths to AccountSettingsPath and VillageSettingsPath, and changed the synchronization field type to Lock.
Add UpdateHeroLevelUpCommand to the account task flow, log task failure reasons, improve CompleteImmediatelyTask waiting, and fix SetHeroPointTask selector/load handling.
@github-actions

Copy link
Copy Markdown

Version of this build is 2.12.124
Check download link here

@github-actions

Copy link
Copy Markdown

Version of this build is 2.12.125
Check download link here

@vinaghost
vinaghost merged commit d1211c1 into main Oct 13, 2026
4 checks passed
@vinaghost
vinaghost deleted the changes/playwirght branch October 13, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant