atata-framework / atata Goto Github PK
View Code? Open in Web Editor NEWC#/.NET test automation framework for web
Home Page: https://atata.io
License: Apache License 2.0
C#/.NET test automation framework for web
Home Page: https://atata.io
License: Apache License 2.0
Add attribute properties:
Target
(also add LinkTarget
static class with possible values)Pattern
Accept
Src
TextContent
InnerHtml
Checked
Required
Support the following iframe
switch functionality.
Go.To<RegularPage>().
SwitchToFrame<FramePage>(By.Id("iframe-id")).
TextBox.Set("abc").
SwitchToRoot<RegularPage>().
DoOtherStuff();
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();
SwitchToFrame(By.Id("iframe-id"), new FramePage(someArg))
SwitchToRoot(new RegularPage(someArg))
SwitchToFrame<FramePage>(By.Id("iframe-id"), temporarily: true)
SwitchToFrame(By.Id("iframe-id"), new FramePage(someArg), temporarily: true)
IWebElement frame = Driver.Get(By.Id("iframe-id"));
SwitchToFrame<FramePage>(frame)
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));
Negative verification using Should.Not.Contain
and Should.Not.ContainHavingContent
methods works incorrectly currently.
BeEquivalent
and EqualSequence
extension methods for IDataVerificationProvider<IEnumerable<IDataProvider<TData, TOwner>>, TOwner>
.Contain<TOwner>(this IDataVerificationProvider<IEnumerable<IDataProvider<string, TOwner>>, TOwner> should, TermMatch match, params string[] expected)
extension method.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);
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.
[ContentSource(ContentSource.TextContent)]
public Content<string, _> HiddenDivUsingTextContent { get; private set; }
Extract value randomization functionality to protected virtual T GenerateRandomValue()
method in EditableField`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];
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!
Should provide access to the scope element's size (Width and Height).
control.ComponentSize.Width.Should.BeGreater(100);
int height = control.ComponentSize.Height;
Support the following:
[ControlDefinition("li[parent::ul]/span[2]", ComponentTypeName = "product percent")]
[Format("p")]
public ControlList<Number<_>, _> ProductPercentNumberContolList { get; private set; }
Add support of the following:
[ControlDefinition("p[@id='some-id']", ComponentTypeName = "some text")]
public Text<_> SomeText { get; private set; }
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.
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();
Add Frame`2
control inherited from Frame`1
. Support non-generic SwitchTo
and DoWithin
methods.
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 TraceLogAttribute
to write helper sub-control's log messages with TRACE log level.
[TraceLog]
public Button<_> SomeButton { get; private set; }
Apply [FindSettings(OuterXPath = "./")]
to UnorderedList`2
and OrderedList`2
. This will force ListItem`1
controls to be found as children (not descendants) of list control. This fixes the hierarchical lists.
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);
Add IsVisible
and Triggers
properties that are present in UIComponent`1
to IUIComponent`1
.
Hello,
Does Atata support any options with taking screenshots. For example I want to take screenshots only on fails.
Thanks
If FindByLabelAttribute
's Match
property doesn't equal Equals
, do not use Values
property of FindByLabelAttribute
/TermAttribute
as a control name.
Hello,
How can i switch to the new iframe on Atata?
Ela
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();
}
}
}
There is no support for WebDriver Actions. So there is no possibility to drag-n-drop and do other complex actions.
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?
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!
Support waiting for AngularJS (v1.*) AJAX calls.
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
.
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; }
Implement the following abilities:
Add bool
randomization support for controls like CheckBox`1
.
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
The following doesn't work:
[ControlFinding(FindTermBy.Name, ControlType = typeof(SampleControl))]
public class SamplePage : Page<_>
{
public SampleControl SomeControl { get; private set; }
public class SampleControl : Control<_>
{
}
}
The same with ParentComponentType
property.
It will be very good feature: to support windows desktop (c++) application, WinAppDriver, Appium.
Implement functionality to set extra pre-XPath for control search. By default ".//" XPath is used as OuterXPath
.
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 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 support for: ol, ul and li HTML elements.
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
.FindByCssStrategy
throws NoSuchElementException
when SearchOptions
is passed to it with IsSafely == true
option. Instead of throwing, it should return new MissingComponentScopeLocateResult()
.
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);
Inherit FindSettingsAttribute
from MulticastAttribute
for targeting functionality.
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();
}
Support the following:
[RandomizeInclude("Option A", "Option B", "Option C")]
public Select<_> TextSelect { get; private set; }
[RandomizeInclude(1, 2, 3)]
public Select<int?, _> IntSelect { get; private set; }
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.Should provide access to the scope element's location (X and Y).
control.ComponentLocation.X.Should.BeGreater(100);
int y = control.ComponentLocation.Y;
ControlList`2
items should get complete metadata as other controls. FindSettingsAttribute
and other attributes should apply to each item.
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)
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)
Verification using Should.BeInRange
and Should.Not.BeInRange
methods works incorrectly currently.
Add base HierarchicalControl`2
and HierarchicalItem`2
controls for interaction with structured HTML elements, like hierarchical ul/li
trees.
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
).
For example:
[FindSettings(OuterXPath = "./")]
public class UnorderedList<TItem, TOwner> : ItemsControl<TItem, TOwner>
[FindSettings]
doesn't apply to ItemsControl`2.Items
property in this case. But should.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.