Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using NUnit.Framework;
- using TestStack.White;
- using TestStack.White.UIItems;
- using System.Threading;
- using TestStack.White.UIItems.WindowItems;
- using TestStack.White.UIItems.Finders;
- namespace indicorecorder_tests_whitefromzero
- {
- public class ApplicationManager
- {
- protected LoginHelper loginHelper;
- protected BriefReportHelper briefreportHelper;
- protected RecordingHelper recodingHelper;
- protected PreferencesHelper preferencesHelper;
- protected Application IndicoRecorderApplication = null;
- protected Application IndicoLauncherApplication = null;
- public static string IndicoLauncherTitle = "Indico Launcher";
- public static string IndicoRecorderTitle = "Indico Recorder";
- public ApplicationManager()
- {
- Application app = Application.Launch(@"C:\Program Files (x86)\Indico Systems\Indico Recorder\Indico Launcher.exe");
- LauncherWindow = app.GetWindow(IndicoLauncherTitle);
- loginHelper = new LoginHelper(this);
- briefreportHelper = new BriefReportHelper(this);
- recodingHelper = new RecordingHelper(this);
- // RecorderWindow = IndicoRecorderWindow();
- }
- public void Stop()
- {
- if (IsLoggingIn())
- {
- RecorderWindow.Get<Button>("btnCancel").Click();
- RecorderWindow.Get<Button>("Close").Click();
- RecorderWindow.Get<Button>("btnOK").Click();
- }
- if (LauncherWindow.IsCurrentlyActive)
- {
- LauncherWindow.Get<Button>("Close").Click();
- }
- }
- // Запускаю Launcher и открываю через него Indico Recorder
- public Application OpenIndicoRecorder()
- {
- if (IndicoRecorderApplication == null)
- {
- LauncherWindow.Get<Image>(SearchCriteria.ByAutomationId("img").AndIndex(0)).Click();
- Application Recorder = Application.Attach("Indico Recorder");
- return Recorder;
- }
- return IndicoRecorderApplication;
- }
- public Window IndicoRecorderWindow()
- {
- if (IndicoRecorderApplication == null)
- {
- IndicoRecorderApplication = OpenIndicoRecorder();
- }
- IndicoRecorderApplication = OpenIndicoRecorder();
- Window IndicoRecorder = IndicoRecorderApplication.GetWindow(IndicoRecorderTitle);
- return IndicoRecorder;
- }
- public bool IsLoggingIn()
- {
- return RecorderWindow.Exists<Button>("btnCancel");
- }
- public Window LauncherWindow { get; set; }
- public Window RecorderWindow { get; set; }
- public Window PreferencesWindow { get; set; }
- public LoginHelper Auth
- {
- get
- {
- return loginHelper;
- }
- }
- public BriefReportHelper BriefReport
- {
- get
- {
- return briefreportHelper;
- }
- }
- public RecordingHelper Recording
- {
- get
- {
- return recodingHelper;
- }
- }
- public PreferencesHelper Preferences
- {
- get
- {
- return preferencesHelper;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement