public async Task GoToParentDirectoryTest()
    {
        var window = AvaloniaApp.GetMainWindow();
        await FocusFilePanelStep.FocusFilePanelAsync(window);

        CreateNewTabStep.CreateNewTab(window);
        var filesPanelViewModel = ActiveFilePanelProvider.GetActiveFilePanelViewModel(window);
        var currentDirectory    = filesPanelViewModel.CurrentDirectory;

        GoToParentDirectoryStep.GoToParentDirectoryViaFilePanel(window);

        var isParentDirectoryOpened = await DirectoryOpenedCondition.CheckIfParentDirectoryIsOpenedAsync(window, currentDirectory);

        Assert.True(isParentDirectoryOpened);
    }
Exemple #2
0
    public async Task GoToParentDirectoryAndBackTest()
    {
        var window = AvaloniaApp.GetMainWindow();

        await FocusFilePanelStep.FocusFilePanelAsync(window);

        CreateNewTabStep.CreateNewTab(window);
        var viewModel = ActiveFilePanelProvider.GetActiveFilePanelViewModel(window);

        _directoryFullPath = viewModel.CurrentDirectory;

        for (var i = 0; i < 10; i++)
        {
            GoToPreviousDirectoryStep.GoToPreviousDirectory(window);
            var isCurrentDirectoryStillOpened = await DirectoryOpenedCondition.CheckIfDirectoryIsOpenedAsync(window, _directoryFullPath);

            Assert.True(isCurrentDirectoryStillOpened);
        }

        GoToParentDirectoryStep.GoToParentDirectoryViaFilePanel(window);
        var isParentDirectoryOpened = await DirectoryOpenedCondition.CheckIfParentDirectoryIsOpenedAsync(window, _directoryFullPath);

        Assert.True(isParentDirectoryOpened);

        GoToPreviousDirectoryStep.GoToPreviousDirectory(window);
        var isChildDirectoryOpened = await DirectoryOpenedCondition.CheckIfDirectoryIsOpenedAsync(window, _directoryFullPath);

        Assert.True(isChildDirectoryOpened);

        for (var i = 0; i < 10; i++)
        {
            GoToNextDirectoryStep.GoToNextDirectory(window);
            var parentDirectoryWasReopened = await DirectoryOpenedCondition.CheckIfParentDirectoryIsOpenedAsync(window,
                                                                                                                _directoryFullPath);

            Assert.True(parentDirectoryWasReopened);
        }

        for (var i = 0; i < 10; i++)
        {
            GoToPreviousDirectoryStep.GoToPreviousDirectory(window);
            var isCurrentDirectoryStillOpened = await DirectoryOpenedCondition.CheckIfDirectoryIsOpenedAsync(window, _directoryFullPath);

            Assert.True(isCurrentDirectoryStillOpened);
        }
    }
Exemple #3
0
        public async Task GoToParentDirectoryAndBackTest()
        {
            var window = AvaloniaApp.GetMainWindow();
            await FocusFilePanelStep.FocusFilePanelAsync(window);

            CreateNewTabStep.CreateNewTab(window);
            FocusDirectorySelectorStep.FocusDirectorySelector(window);

            var filesPanelViewModel = ActiveFilePanelProvider.GetActiveFilePanelViewModel(window);
            var currentDirectory    = filesPanelViewModel.CurrentDirectory;
            var filesPanelView      = ActiveFilePanelProvider.GetActiveFilePanelView(window);
            var directoryTextBox    = filesPanelView
                                      .GetVisualDescendants()
                                      .OfType <TextBox>()
                                      .SingleOrDefault(t => t.Name == "DirectoryTextBox");

            Assert.NotNull(directoryTextBox);

            var separatorPosition = directoryTextBox.Text.LastIndexOf(Path.DirectorySeparatorChar);

            Assert.True(separatorPosition >= 0);

            directoryTextBox.CaretIndex = directoryTextBox.Text.Length;
            var symbolsToRemoveCount = directoryTextBox.Text.Length - separatorPosition;

            for (var i = 0; i < symbolsToRemoveCount; i++)
            {
                Keyboard.PressKey(window, Key.Back);
            }

            await Task.Delay(5000);

            var isParentDirectoryOpened = await DirectoryOpenedCondition.CheckIfParentDirectoryIsOpenedAsync(window, currentDirectory);

            Assert.True(isParentDirectoryOpened);

            var directoryName = Path.GetFileNameWithoutExtension(currentDirectory);

            directoryTextBox.SendText(Path.DirectorySeparatorChar + directoryName);

            var childDirectoryWasOpened =
                await DirectoryOpenedCondition.CheckIfDirectoryIsOpenedAsync(window, currentDirectory);

            Assert.True(childDirectoryWasOpened);
        }