59 lines
2.7 KiB
C#
59 lines
2.7 KiB
C#
using ESuite.UI.E2E.Helpers;
|
|
using OpenQA.Selenium;
|
|
|
|
namespace ESuite.UI.E2E.Pages
|
|
{
|
|
public class AuditPage
|
|
{
|
|
private readonly IWebDriver driver;
|
|
public AuditPage(IWebDriver driver)
|
|
{
|
|
this.driver = driver;
|
|
}
|
|
|
|
// Page elements
|
|
public static By ParentLogButton => By.CssSelector("button .fa-book");
|
|
public static By AllRelatedLogsButton => By.CssSelector("button .fa-book-journal-whills");
|
|
public static By DisplayNameSearchInputField => By.CssSelector("input#displayName");
|
|
public static By LogLines => By.XPath("//div[@class='frame-workArea']/div/table/tbody/tr");
|
|
public static By TypeSearchInputField => By.CssSelector("input#type");
|
|
public static By AuditLogUpdatedValueOfEntity => By.XPath("//table/tbody/tr[1]/td[7]/table/tbody/tr/td[3]");
|
|
public static By AuditLogUpdatedValueOfCustomFieldsEntity => By.XPath("//table/tbody/tr/td[7]/table/tbody/tr/td[3]");
|
|
public static By AuditLogCreatedValueOfEntity => By.XPath("//table/tbody/tr[1]/td[7]/table/tbody/tr/td[2]");
|
|
public static By AuditLogCreatedValueOfCustomFieldsEntity => By.XPath("//table/tbody/tr/td[7]/table/tbody/tr/td[2]");
|
|
public static By AuditLogTypeOfEntity => By.XPath("//table/tbody/tr[1]/td[5]");
|
|
public static By EntityDisplayName => By.XPath("//table/tbody/tr[1]/td[4]");
|
|
public static By CustomFieldsEntityDisplayName => By.XPath("//table/tbody/tr/td[4]");
|
|
public static By TimingDisplay => By.XPath("//table/tbody/tr/td[1]");
|
|
// Page actions
|
|
|
|
public static List<string> GetTextFromAuditLog(string logType)
|
|
{
|
|
IList<string> auditLogValues;
|
|
if (logType is "Create" or "Purge")
|
|
{
|
|
auditLogValues = I.GetTextsFromElements(AuditLogCreatedValueOfEntity, 5);
|
|
}
|
|
else
|
|
{
|
|
auditLogValues = I.GetTextsFromElements(AuditLogUpdatedValueOfEntity, 5);
|
|
}
|
|
return (List<string>)auditLogValues;
|
|
}
|
|
|
|
public static List<string> GetTextFromAuditLogOnCustomFields(string logType)
|
|
{
|
|
IList<string> auditLogValues;
|
|
if (logType is "Create")
|
|
{
|
|
auditLogValues = I.GetTextsFromElements(AuditLogCreatedValueOfCustomFieldsEntity, 5);
|
|
}
|
|
else
|
|
{
|
|
I.WaitForElementVisibleAndClickable(AuditPage.AllRelatedLogsButton, 5);
|
|
auditLogValues = I.GetTextsFromElements(AuditLogUpdatedValueOfCustomFieldsEntity, 5);
|
|
}
|
|
return [.. auditLogValues];
|
|
}
|
|
}
|
|
} |