mardi 6 août 2019

Refresh information in tab WPF

Im begginning autotester. Im testing WPF application with CodedUiTest.

I have big problem. I need refresh information in tab. Not in control, but in tab.

For example: I have popup and button. I choose value in popup, and after try click button, but test failed with ElementNotAvailableException. If i click button before choose in popup - all right. Sometimes tests failed with this exception, but sometimes success.

This problem start, after developers make replacing templates in grid, and they say, that its not problem WPF(Xaml), but i need refresh tab in my tests.

I dont know, how do that.

We use search elements with AutomationElement. Choose element and click button code:

    internal void Choose(AutomationElement element, string value)
    {
        if (NameProperty(element) != value)
        {
            Open(element);

            AutomationElement valueInPopup = FindByName(PART_ListBox(), value);

            ChooseValueInPopup(valueInPopup, value);
        }
    }

    private void ChooseValueInPopup(AutomationElement element, string value)
    {
        AutomationElement valueInPopup = FindByName(element, value);
        LeftClickElement(valueInPopup);
        Thread.Sleep(1000);
    }

    private void ClickSaveEventButton()
    {
        AutomationElement saveButton = FooterSaveButton();
        LeftClickElement(saveButton);
        WaitBusyElementWithoutParameter(saveButton, BusyIndicator);
    }

Aucun commentaire:

Enregistrer un commentaire