Add fix tests (#1572)

* added tests for filters and minor fixes due to change in ui

* adding option for webdriver

* addressing reviewdog findings

* addressing comments

* addressing comments

* changing driver
This commit is contained in:
parthp2107 2021-12-06 19:55:42 +05:30 committed by GitHub
parent 23bac071da
commit db3d10ac64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 45 additions and 5 deletions

View File

@ -287,7 +287,8 @@ const Appbar: React.FC = (): JSX.Element => {
/>
}
isDropDownIconVisible={false}
// label="Need Help"
isLableVisible={false}
label="Need Help"
type="link"
/>
</div>

View File

@ -27,6 +27,7 @@ const DropDown: React.FC<DropDownProp> = ({
onSelect,
selectedItems,
isDropDownIconVisible = true,
isLableVisible = true,
}: DropDownProp) => {
const [isOpen, setIsOpen] = useState<boolean>(false);
@ -100,7 +101,7 @@ const DropDown: React.FC<DropDownProp> = ({
) : (
<>
{Icon && Icon}
{label && (
{label && isLableVisible && (
<p
className="hover:tw-underline"
style={{ color: `${isOpen ? activeLink : normalLink}` }}>

View File

@ -58,5 +58,6 @@ export type DropDownProp = {
label?: string | React.ReactElement;
type: string;
icon?: React.ReactElement | string;
isLableVisible?: boolean;
isDropDownIconVisible?: boolean;
} & DropDownListProp;

View File

@ -53,7 +53,7 @@ public class PaginationAndFilterTest {
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless");
options.addArguments("--window-size=1280,800");
webDriver = new ChromeDriver();
webDriver = new ChromeDriver(options);
actions = new Actions(webDriver);
wait = new WebDriverWait(webDriver, Duration.ofSeconds(30));
webDriver.manage().window().maximize();
@ -63,7 +63,6 @@ public class PaginationAndFilterTest {
@RepeatedIfExceptionsTest(repeats = 2)
@Order(1)
public void checkFlikerInFilter() throws Exception {
Thread.sleep(waitTime);
Events.click(webDriver, By.cssSelector("[data-testid='closeWhatsNew']")); // Close What's new
Thread.sleep(waitTime);
Events.click(webDriver, By.cssSelector("[data-testid='tables']")); // Tables
@ -82,6 +81,43 @@ public class PaginationAndFilterTest {
}
}
@RepeatedIfExceptionsTest(repeats = 2)
@Order(2)
public void noDataPresentWithFilter() throws Exception {
Events.click(webDriver, By.cssSelector("[data-testid='closeWhatsNew']")); // Close What's new
Thread.sleep(waitTime);
Events.click(webDriver, By.cssSelector("[data-testid='tables']")); // Tables
Events.click(webDriver, By.cssSelector("[data-testid='checkbox'][id='BigQuery']")); // Select Filter
try {
WebElement noDataFound = wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(
"//*[contains(text(), 'No matching data assets found')]")));
if (noDataFound.isDisplayed()) {
throw new Exception("Data not found with filter count more than 0");
}
} catch (TimeoutException exception) {
LOG.info("Success");
}
}
@RepeatedIfExceptionsTest(repeats = 2)
@Order(3)
public void dataPresentWithFilter() throws Exception {
Events.click(webDriver, By.cssSelector("[data-testid='closeWhatsNew']")); // Close What's new
Thread.sleep(waitTime);
Events.click(webDriver, By.cssSelector("[data-testid='tables']")); // Tables
Events.click(webDriver, By.cssSelector("[data-testid='checkbox'][id='Tier.Tier3']")); // Select Filter
try {
WebElement dataFound = wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector(
"[data-testid='search-results']")));
if (dataFound.isDisplayed()) {
throw new Exception("Data found with filter count 0");
}
} catch(TimeoutException exception) {
LOG.info("Success");
}
}
@AfterEach
public void closeTabs() {
ArrayList<String> tabs = new ArrayList<>(webDriver.getWindowHandles());

View File

@ -130,7 +130,7 @@ public class DashboardServiceTestPage {
public void searchDashboardService() throws InterruptedException {
openDashboardServicePage();
Thread.sleep(2000);
Events.click(webDriver, By.cssSelector("[data-testid='service-name-'"+ serviceName + "]"));
Events.click(webDriver, By.cssSelector("[data-testid='service-name-"+ serviceName + "']"));
}
@RepeatedIfExceptionsTest(repeats = 2)

View File

@ -168,6 +168,7 @@ public class MyDataPageTest {
@Order(8)
public void checkLogout() {
checkWhatsNew();
Events.click(webDriver, By.cssSelector("[data-testid='dropdown-profile']"));
Events.click(webDriver, By.cssSelector("[data-testid='greeting-text']"));
Events.click(webDriver, By.cssSelector("[data-testid='menu-item-Logout']"));
}