feat(e2e): #146 MTProto Telegram user client runner
- Add standalone C# console runner tests/e2e/runner/ using WTelegramClient - Provide TelegramUserClient wrapper: login, create supergroup, invite bot, send messages/commands, read recent messages, wait for bot reply - Add .env.example and runner .gitignore to keep secrets/session files out of git - Update E2E README with runner instructions and status table - Runner project intentionally excluded from GM-Relay.slnx to avoid CI/AOT impact Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using dotenv.net;
|
||||
using GmRelay.E2E.Runner;
|
||||
|
||||
DotEnv.Load(new DotEnvOptions(envFilePaths: [".env"], ignoreExceptions: false));
|
||||
|
||||
var config = new RunnerConfig
|
||||
{
|
||||
ApiId = int.Parse(Environment.GetEnvironmentVariable("api_id")!),
|
||||
ApiHash = Environment.GetEnvironmentVariable("api_hash")!,
|
||||
PhoneNumber = Environment.GetEnvironmentVariable("phone_number")!,
|
||||
BotUsername = Environment.GetEnvironmentVariable("TELEGRAM_BOT_USERNAME")!,
|
||||
BotToken = Environment.GetEnvironmentVariable("TELEGRAM_BOT_TOKEN")!,
|
||||
};
|
||||
|
||||
using var runner = new TelegramUserClient(config);
|
||||
await runner.ConnectAsync();
|
||||
|
||||
Console.WriteLine("Connected as Telegram user. Creating test group...");
|
||||
var group = await runner.CreateGroupAsync("GmRelay E2E Test Group");
|
||||
Console.WriteLine($"Created group id={group.Id} title='{group.Title}'");
|
||||
|
||||
await runner.InviteBotToGroupAsync(group, config.BotUsername);
|
||||
Console.WriteLine($"Invited @{config.BotUsername} to the group");
|
||||
|
||||
// Keep the process alive briefly so the session is persisted.
|
||||
await Task.Delay(TimeSpan.FromSeconds(2));
|
||||
Console.WriteLine("Done.");
|
||||
Reference in New Issue
Block a user