コード例 #1
0
        public async Task OnGetElement_ItRetrieveElementFromAdornerLayer()
        {
            IWindow window = await App.CreateWindowWithUserControl <TextBox_ValidationError>();

            IVisualElement textBox = await window.GetElement("/TextBox");

            IVisualElement validationMessage = await textBox.GetElement("ErrorMessageText");

            Assert.IsTrue(await validationMessage.GetIsVisible());
        }
コード例 #2
0
        public async Task CharacterCount_WithoutMaxLengthSet_IsCollapsed()
        {
            await using var recorder = new TestRecorder(App);

            IVisualElement grid = await LoadXaml(@"
<Grid Margin=""30"">
    <TextBox />
</Grid>");

            IVisualElement textBox = await grid.GetElement("/TextBox");

            IVisualElement characterCounter = await textBox.GetElement("CharacterCounterTextBlock");

            Assert.False(await characterCounter.GetIsVisible());

            recorder.Success();
        }
コード例 #3
0
        public async Task CharacterCount_WithMaxLengthSetAndCharacterCounterVisibilityCollapsed_IsNotDisplayed()
        {
            await using var recorder = new TestRecorder(App);

            IVisualElement grid = await LoadXaml(@"
<Grid Margin=""30"">
    <TextBox
        MaxLength=""10""
        materialDesign:TextFieldAssist.CharacterCounterVisibility=""Collapsed""
    />
</Grid>");

            IVisualElement textBox = await grid.GetElement("/TextBox");

            IVisualElement characterCounter = await textBox.GetElement("CharacterCounterTextBlock");

            Assert.False(await characterCounter.GetIsVisible());

            recorder.Success();
        }
コード例 #4
0
        public async Task ClosingDialogWithIsOpenProperty_ShouldRaiseDialogClosingEvent()
        {
            await using var recorder = new TestRecorder(App);

            IVisualElement dialogHost = await LoadUserControl <ClosingEventCounter>();

            IVisualElement showButton = await dialogHost.GetElement("ShowDialogButton");

            IVisualElement closeButton = await dialogHost.GetElement("CloseButton");

            IVisualElement resultTextBlock = await dialogHost.GetElement("ResultTextBlock");


            await showButton.Click();

            await Wait.For(async() => await closeButton.GetIsVisible());

            await closeButton.Click();

            await Wait.For(async() => Assert.Equal("1", await resultTextBlock.GetText()));
        }
コード例 #5
0
        public async Task OnOpenDialog_OverlayCoversContent()
        {
            await using var recorder = new TestRecorder(App);

            IVisualElement dialogHost = await LoadUserControl <WithCounter>();

            IVisualElement overlay = await dialogHost.GetElement("PART_ContentCoverGrid");

            IVisualElement resultTextBlock = await dialogHost.GetElement("ResultTextBlock");

            await Wait.For(async() => await resultTextBlock.GetText() == "Clicks: 0");

            IVisualElement testOverlayButton = await dialogHost.GetElement("TestOverlayButton");

            await testOverlayButton.Click();

            await Wait.For(async() => await resultTextBlock.GetText() == "Clicks: 1");

            IVisualElement showDialogButton = await dialogHost.GetElement("ShowDialogButton");

            await showDialogButton.Click();

            IVisualElement closeDialogButton = await dialogHost.GetElement("CloseDialogButton");

            await Wait.For(async() => await closeDialogButton.GetIsVisible() == true);

            await testOverlayButton.Click();

            await Wait.For(async() => await resultTextBlock.GetText() == "Clicks: 1");

            await closeDialogButton.Click();

            var retry = new Retry(5, TimeSpan.FromSeconds(5));
            await Wait.For(async() => await overlay.GetVisibility() != Visibility.Visible, retry);

            await testOverlayButton.Click();

            await Wait.For(async() => Assert.Equal("Clicks: 2", await resultTextBlock.GetText()), retry);
        }
コード例 #6
0
ファイル: DialogHostTests.cs プロジェクト: am1752/StudyOmok
        public async Task OnOpenDialog_OverlayCoversContent()
        {
            await using var recorder = new TestRecorder(App);

            IVisualElement dialogHost = await LoadUserControl <WithCounter>();

            IVisualElement resultTextBlock = await dialogHost.GetElement("ResultTextBlock");

            await Wait.For(async() => await resultTextBlock.GetText() == "Clicks: 0");

            IVisualElement testOverlayButton = await dialogHost.GetElement("TestOverlayButton");

            await testOverlayButton.Click();

            await Wait.For(async() => await resultTextBlock.GetText() == "Clicks: 1");

            IVisualElement showDialogButton = await dialogHost.GetElement("ShowDialogButton");

            await showDialogButton.Click();

            IVisualElement closeDialogButton = await dialogHost.GetElement("CloseDialogButton");

            await Wait.For(async() => await closeDialogButton.GetIsVisible() == true);

            await testOverlayButton.Click();

            await Wait.For(async() => await resultTextBlock.GetText() == "Clicks: 1");

            await closeDialogButton.Click();


            await Wait.For(async() =>
            {
                Output.WriteLine("Input");
                await testOverlayButton.Click();
                Assert.Equal("Clicks: 2", await resultTextBlock.GetText());
                Output.WriteLine("Output");
            });
        }