Giter VIP home page Giter VIP logo

atata's People

Contributors

alexdefine avatar goblinmaks avatar nadvolod avatar yevgeniyshunevych avatar ysamus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

atata's Issues

Update ILogManager error logging methods

Current error/exception logging methods:

void Error(string message, Exception exception);
void Fatal(string message, Exception exception);

Should be:

void Error(Exception exception);
void Error(string message, Exception exception = null);
void Fatal(Exception exception);
void Fatal(string message, Exception exception = null);

Enum randomization

Add support of enum randomization. For enums with [Flags] provide ability to generate combination of flags.

Add RandomizeIncludeAttribute, RandomizeExcludeAttribute and RandomizeCountAttribute settings attributes for flags enums and future collection randomization functionality.

Example:

[RandomizeCount(2, 4)]
public CheckBoxList<Options, _> SomeCheckBoxList1 { get; private set; }

[RandomizeCount(3)]
[RandomizeInclude(Options.OptionA, Options.OptionB, Options.OptionD, Options.OptionE, Options.OptionF)]
public CheckBoxList<Options, _> SomeCheckBoxList2 { get; private set; }

Add Frame`1 and Frame`2 controls

Frame<TOwner>

Add Frame`1 control for iframe interaction with the following methods:

TFramePageObject SwitchTo<TFramePageObject>(TFramePageObject framePageObject = null, bool? temporarily = null)

public TOwner DoWithin<TFramePageObject>(Action<TFramePageObject> action, bool? temporarily = null)

If temporarily is not set, use [GoTemporarily] attribute value, otherwise false.

Usage

public class RegularPage : Page<_>
{
    [FindById("iframe-id")]
    public Frame<_> Frame { get; private set; }
}
public class FramePage : Page<_>
{
    public TextInput<_> TextBox { get; private set; }
}
Go.To<RegularPage>().
    Frame.SwitchTo<FramePage>(temporarily: true).
        TextBox.Set("abc").
        SwitchToRoot<RegularPage>().
    // Or use DoWithin method
    Frame.DoWithin<FramePage>(
        x => x.TextBox.Set("abc")).
    DoOtherStuff();

Frame<TFramePageObject, TOwner>

Add Frame`2 control inherited from Frame`1. Support non-generic SwitchTo and DoWithin methods.

Usage

public class RegularPage : Page<_>
{
    [FindById("iframe-id")]
    public Frame<FramePage, _> Frame { get; private set; }
}
public class FramePage : Page<_>
{
    public TextInput<_> TextBox { get; private set; }

    public RegularPage SwitchBack()
    {
        return SwitchToRoot<RegularPage>();
    }
}
Go.To<RegularPage>().
    Frame.SwitchTo().
        TextBox.Set("abc").
        SwitchBack().
    // Or use DoWithin method
    Frame.DoWithin(
        x => x.TextBox.Set("abc")).
    DoOtherStuff();

Add drag and drop support

Selenium provides a mechanism for allowing actions to be performed such as drag and drop with certain key presses. This allows for the automation of actions such as shift drag and drop or ctrl drag and drop.

It would be nice to be able to drag an element to another element and drop it. Perhaps also allow for a way to say whereabouts on the second object you would like to drop the item?

I always find drag and drop a very annoying feature to implement using Selenium and having 'Atata' do it nicely would be a huge benefit!

OuterXPath functionality

Implement functionality to set extra pre-XPath for control search. By default ".//" XPath is used as OuterXPath.

Examples

To find a control as a direct child of parent:

[FindSettings(OuterXPath = "./")]

Or:

[FindFirst(OuterXPath = "./")]

To find a first following sibling element:

[FindFirst(OuterXPath = "following-sibling::")]

To find element by class that is a direct child of some container:

[FindByClass("some-class", OuterXPath = ".//div[@id='some-container']/")]

Fix UIComponent.CleanUp method execution

Fix the following case of CleanUp method:

public class SomePage : Page<_>
{
	protected override void OnInit()
	{
		base.OnInit();

		IWebElement iframe = Driver.Get(By.XPath(".//iframe[@id='some-id']"));
		Driver.SwitchTo().Frame(iframe);
	}

	protected override void CleanUp()
	{
		base.CleanUp();

		// Exception can be occurred during AtataContext clean-up.
		Driver.SwitchTo().DefaultContent();
	}
}

Add GetOneOf and GetManyOf methods to Randomizer

Provide functionality to get random values of list of options. For example:

// Gets single number value of the specified list
int value1 = Randomizer.GetOneOf(1, 2, 3, 5, 8);

// Gets 3 random characters of the specified list
char[] value2 = Randomizer.GetManyOf(3, 'a', 'x', 'z', 'w', 'n', 'm');

// Gets 1-3 random enum values
SomeEnum[] value3 = Randomizer.GetManyOf(1, 3, SomeEnum.A, SomeEnum.B, SomeEnum.C);

Clickable elements

hello! :)
I have a little problem.
I need to click on MyButton, but in html it's look like this:
<i class="SampleClass" data-content="MyButton"></i>

so result my test is:

 2017-04-24 12:50:03.4329 ERROR System.InvalidOperationException : unknown error: Element <i class="ParentSampleClass" data-content="MyButton"></i> is not clickable at point (1226, 272). Other element would receive the click: <SampleClass2">...</ul>
  (Session info: chrome=57.0.2987.133)
  (Driver info: chromedriver=2.28.455520 (cc17746adff54984afff480136733114c6b3704b),platform=Windows NT 10.0.14393 x86_64)
   w OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
   w OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   w OpenQA.Selenium.Remote.RemoteWebElement.Click()
   w Atata.Control`1.OnClick()
   w Atata.Control`1.Click()
   w Atata.INavigableExtensions.ClickAndGo[TNavigateTo,TOwner](INavigable`2 navigableControl)
   w ...

How can I click on MyButton in Atata? Is it possible?

Add TraceLogAttribute

Add TraceLogAttribute to write helper sub-control's log messages with TRACE log level.

Usage

[TraceLog]
public Button<_> SomeButton { get; private set; }

Screenshot on Failure

Hello,

Does Atata support any options with taking screenshots. For example I want to take screenshots only on fails.

Thanks

Add SetRandom extension method for EditableField`2 with nullable data type

Currently for EditableField`2 of nullable data type (int?, decimal?, Enum?, etc.) it is possible to set random value in such way:

int? value;
Go.To<SomePage>()
    SomeNumberInput.SetRandom(out value); // SomeNumberInput is of type Input<int?, TOwner>.

Need to support:

int value;
Go.To<SomePage>()
    SomeNumberInput.SetRandom(out value);

Make UIComponent.Scope property public

It should be publicly available to get component's scope of type IWebElement. Change access modifier of UIComponent.Scope property from protected internal to public.

Back to the previous iframe

Hi!
I have a little problem. How can I switch to the previous i frame?
to Switch to other iframe i used your examle (it's below).
When I finsh working on New iframe i click Link and automatically my New iFrame is closed.
To switch on New iframe i used SomeButton.ClickAndGo(), but now i Clicked Link and I can't use ClickAndGo().

Ela! :)

Page object as iframe

An example of page object for page that is located inside the other one as iframe:
using Atata;
using OpenQA.Selenium;
using _ = SampleApp.SomePage;

namespace SampleApp
{
public class SomePage : Page<_>
{
protected override void OnInit()
{
base.OnInit();

        IWebElement iframe = Driver.Get(By.XPath(".//iframe[@id='some-id']"));
        Driver.SwitchTo().Frame(iframe);
    }

    protected override void CleanUp()
    {
        base.CleanUp();

        Driver.SwitchTo().DefaultContent();
    }
}

}

.NET Core Support

Hi everybody,

could you please support .NET Core and provide ability to run on Linux and Mac OS X?

It might be challenge to connect WebDriver on Linux/OS X, however, it will hugely promote the framework ahead.

Thanks!

Add MulticastAttribute

MulticastAttribute

MulticastAttribute - represents the base class for attributes that can be applied to component at any level (declared, parent component, assembly, global and component). It should provide the following members:

  • string[] TargetNames
  • string TargetName
  • Type[] TargetTypes
  • Type TargetType
  • Type[] TargetParentTypes
  • Type TargetParentType
  • int? CalculateTargetRank(UIComponentMetadata metadata)

UIComponentMetadata

Add option (enable it by default) to UIComponentMetadata class to filter attributes by MulticastAttribute's criteria. Update UIComponentMetadata methods:

public TAttribute Get<TAttribute>(AttributeLevels levels, Func<TAttribute, bool> predicate = null, bool filterByTarget = true)

public IEnumerable<TAttribute> GetAll<TAttribute>(AttributeLevels levels, Func<TAttribute, bool> predicate = null, bool filterByTarget = true)

Add ContentSourceAttribute

ContentSourceAttribute - specifies the content source of a component. Use it in UIComponent`1 for Content property and in Content`2 control for value. Inherit it from MulticastAttribute.

Can use one of the following ContentSource enum values:

  • Text - uses Text property of component scope IWebElement element.
  • TextContent - uses 'textContent' attribute of component scope IWebElement element.
  • InnerHtml - uses 'innerHTML' attribute of component scope IWebElement element.
  • Value - uses 'value' attribute of component scope IWebElement element.

Also can accept a name of attribute from which the value should be taken.

Usage

[ContentSource(ContentSource.TextContent)]
public Content<string, _> HiddenDivUsingTextContent { get; private set; }

Add controls for hierarchical lists

Add the following controls:

  • HierarchicalUnorderedList`2 - inherits from HierarchicalControl`2.
  • HierarchicalOrderedList`2 - inherits from HierarchicalControl`2.
  • HierarchicalListItem`2 - inherits from HierarchicalItem`2.
  • HierarchicalListItem`1 - inherits from HierarchicalListItem`2.

Add Resolve method to UIComponentChildrenList`1

Add method to UIComponentChildrenList`1 :

public TControl Resolve<TControl>(string propertyName, Func<IEnumerable<Attribute>> additionalAttributesFactory = null)

It can be used for lazy initialization of controls:

public Control<_> SomeControl => Controls.Resolve<Control<_>>(nameof(SomeControl));

Assertion exception type configuration

Add a possibility to configure type of assertion exception.

Add a couple of methods to AtataContextBuilder:

AtataContext.Build().
    UseAssertionExceptionType(typeof(NUnit.Framework.AssertionException)).
    // Or
    UseAssertionExceptionType<NUnit.Framework.AssertionException>().

It can be helpful, for example, to override the exception type to NUnit.Framework.AssertionException to get working NUnit's test retry functionality (see NUnit.Framework.RetryAttribute).

Add Metadata to ControlList`2

ControlList`2 items should get complete metadata as other controls. FindSettingsAttribute and other attributes should apply to each item.

Alerts and alert.SetAuthenticationCredentials

Hello, I had a problem. I must log in to application by Windows authebtication. Typical browser alert, and I don't find solution for that in Atata.

In selenium, in that case I use:

WebDriverWait wait = new WebDriverWait(_webdriver, new TimeSpan(0, 0, 10));
            IAlert alert = wait.Until(ExpectedConditions.AlertIsPresent());
            alert.SetAuthenticationCredentials("login", "somePAss");
            alert.Accept();

So I try use driver used in ATATA in that style

 WebDriverWait wait = new WebDriverWait(AtataContext.Current.Driver, new TimeSpan(0, 0, 10));
            IAlert alert = wait.Until(ExpectedConditions.AlertIsPresent());
            alert.SetAuthenticationCredentials("login", "somePAss");
            alert.Accept();

But this don't work. The page for myUlr is not open.

The full set up for solution:

        public void Initialize()
        {
            AtataContext.Build().
            UseChrome().
                UseBaseUrl("myUlr ").
                UseNUnitTestName().
                LogNUnitError().
                SetUp();
            WebDriverWait wait = new WebDriverWait(AtataContext.Current.Driver, new TimeSpan(0, 0, 10));
            IAlert alert = wait.Until(ExpectedConditions.AlertIsPresent());
            alert.SetAuthenticationCredentials("login", "somePAss");
            alert.Accept();
        }

Add indexers to ItemsControl`2

Add the following indexers to ItemsControl`2:

public TItem this[int index] => Items[index];

public TItem this[Expression<Func<TItem, bool>> predicateExpression] => Items[predicateExpression];

Resolve an element without attribute

Given a table with three columns (Time, Id, Message) I have created a Table inside my page object model which contains the TableHeaders and the TableRows to locate these static columns in my table.

I then had an issue where if the columns were to appear in a different order than I would use the FindByXPath attribute on the TableRow to look at the index of the column that ID occurs in use that index whilst locating the cell for ID in the table row.

However my table has the option to add extra columns based on user data in the system. There is not a way to know what the user data is and therefore I was planning to add a function onto the TableRow for retrieving the custom property by name. Then the function can use the same XPath as above to take the string property name and look for a header matching that property name, and then use the index of the header to find which cell in the row contains the value for that data.

Is there a way to resolve elements not using attributes?

I have tried using AtataContext.Current.Driver.FindElementByXPath however this returns an IWebElement instead of a the desired Text<_> object and I cannot seem to cast or create one,

Thanks

Change default search of controls

Do the following changes:

  • Field`2 should not use [ControlFinding(FindTermBy.Label)].
  • Content`2 and inherited controls instead of "label" search should find the first occurring element.
  • HiddenInput`2 instead of "id" search should find the first occurring element.
  • Clickable`1 and Clickable`2 instead of "id" search should find the first occurring element.
  • TableRow`1 instead of "content" search should find the first occurring element.

WebDriver Actions support

There is no support for WebDriver Actions. So there is no possibility to drag-n-drop and do other complex actions.

Add support for declared properties to ControlList`2

Support the following:

[ControlDefinition("li[parent::ul]/span[2]", ComponentTypeName = "product percent")]
[Format("p")]
public ControlList<Number<_>, _> ProductPercentNumberContolList { get; private set; }

Add SwitchToFrame and SwitchToRoot methods to PageObject`1

Support the following iframe switch functionality.

Direct/In-test

Go.To<RegularPage>().
    SwitchToFrame<FramePage>(By.Id("iframe-id")).
        TextBox.Set("abc").
        SwitchToRoot<RegularPage>().
    DoOtherStuff();

Within page objects

public class RegularPage : Page<_>
{
    // Some regular page properties.

    public FramePage SwitchToFrame()
    {
        return SwitchToFrame<FramePage>(By.Id("iframe-id"));
    }
}
public class FramePage : Page<_>
{
    // Some frame page properties.

    public RegularPage SwitchBack()
    {
        return SwitchToRoot<RegularPage>();
    }
}
Go.To<RegularPage>().
    SwitchToFrame().
        TextBox.Set("abc").
        SwitchBack().
    DoOtherStuff();    

Other

Pass an instance of the page object

SwitchToFrame(By.Id("iframe-id"), new FramePage(someArg))
SwitchToRoot(new RegularPage(someArg))

Temporarily navigation

SwitchToFrame<FramePage>(By.Id("iframe-id"), temporarily: true)
SwitchToFrame(By.Id("iframe-id"), new FramePage(someArg), temporarily: true)

Pass an instance of IWebElement:

IWebElement frame = Driver.Get(By.Id("iframe-id"));
SwitchToFrame<FramePage>(frame)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.