Skip to content

Commit

Permalink
Merge pull request #3885 from Ginger-Automation/BugFix/41115,41116-Bu…
Browse files Browse the repository at this point in the history
…gFix

BugFix - 41115 & 41116 - Playwright Accessibility And VRT Bug Fixes
  • Loading branch information
IamRanjeetSingh committed Aug 29, 2024
2 parents ce7da21 + a69040f commit 45f941d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ limitations under the License.
using GingerCore.Actions.VisualTesting;
using GingerCore.Drivers;
using GingerCoreNET.SolutionRepositoryLib.RepositoryObjectsLib.PlatformsLib;
using OpenQA.Selenium;
using System;
using System.Collections.Generic;
using System.Drawing;
Expand Down Expand Up @@ -395,7 +396,12 @@ public bool CheckSetAppWindowSize()
break;
case eChangeAppWindowSize.Custom:
mDriver.ChangeAppWindowSize(Convert.ToInt32(GetInputParamCalculatedValue(nameof(SetAppWindowWidth))), Convert.ToInt32(GetInputParamCalculatedValue(nameof(SetAppWindowHeight))));
Size size = mDriver.GetWebDriver().Manage().Window.Size;
IWebDriver webDriver = mDriver.GetWebDriver();
if (webDriver == null)
{
return true;
}
Size size = webDriver.Manage().Window.Size;
if (Convert.ToInt32(GetInputParamCalculatedValue(nameof(SetAppWindowWidth))) + 5 < size.Width)//+5 added to check with actual viewport/size of the browser which can be different by 2 0r 3 points
{
this.Error = string.Format("Unable to set custom width of web page to {0}, min supported width is {1}.", GetInputParamCalculatedValue(nameof(SetAppWindowWidth)), size.Width.ToString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,18 @@ private AxeRunOptions CreateAxeRunOptions()
List<string> sevritylist = _act.SeverityList.Select(x => x.Value.ToLower()).ToList();
string[] SeverityExcludeRules = RuleData.Where(x => !ExcludeRules.Contains(x.RuleID) && sevritylist.Contains(x.Impact.ToLower())).Select(i => i.RuleID.ToString()).ToArray();
ExcludeRules = ExcludeRules.Concat(SeverityExcludeRules).ToArray();
if (ExcludeRules != null && ExcludeRules.Any())
}
if (ExcludeRules != null && ExcludeRules.Any())
{
var rulesMap = new Dictionary<string, RuleOptions>();
foreach (var rule in ExcludeRules)
{
var rulesMap = new Dictionary<string, RuleOptions>();
foreach (var rule in ExcludeRules)
rulesMap[rule] = new RuleOptions
{
rulesMap[rule] = new RuleOptions
{
Enabled = false
};
}
axeRunOptions.Rules = rulesMap;
Enabled = false
};
}
axeRunOptions.Rules = rulesMap;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ public override void RunAction(Act act)
}
break;
case ActAccessibilityTesting actAccessibilityTesting:
if (!BrowserPrivateMode)
{
act.Error = $"Playwright Driver must be in Private mode for using Accessibility actions";
break;
}
ActAccessibilityTestingHandler actAccessibilityTestingHandler;
if (actAccessibilityTesting.GetAccessibilityTarget() == ActAccessibilityTesting.eTarget.Element)
{
Expand Down Expand Up @@ -257,7 +262,7 @@ public bool IsActionSupported(Act act, out string message)
{
message = string.Empty;

if (act is ActWithoutDriver or ActScreenShot)
if (act is ActWithoutDriver or ActScreenShot or ActGotoURL or ActAccessibilityTesting)
{
return true;
}
Expand Down Expand Up @@ -306,8 +311,12 @@ public bool IsActionSupported(Act act, out string message)
}
else if (act is ActVisualTesting actVisualTesting)
{
message = $"{actVisualTesting.VisualTestingAnalyzer} is not supported by Playwright driver, use Selenium driver instead.";
return actVisualTesting.VisualTestingAnalyzer != ActVisualTesting.eVisualTestingAnalyzer.Applitools;
if (actVisualTesting.VisualTestingAnalyzer == ActVisualTesting.eVisualTestingAnalyzer.Applitools)
{
message = $"{actVisualTesting.VisualTestingAnalyzer} is not supported by Playwright driver, use Selenium driver instead.";
return false;
}
return true;
}
else
{
Expand Down

0 comments on commit 45f941d

Please sign in to comment.