mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-12 11:07:20 +00:00
adding selenium tests for ingestion page (#1333)
* adding selenium tests for ingestion page * adding few tests changes and addressing reviewdog findings * testing selenium workflow
This commit is contained in:
parent
03057b8bc6
commit
72f5320914
3
.github/workflows/selenium-tests.yml
vendored
3
.github/workflows/selenium-tests.yml
vendored
@ -22,6 +22,9 @@ jobs:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
|
||||
- name: Generating Data Models
|
||||
run: make install_dev generate
|
||||
|
||||
- name: Start Server and Ingest Sample Data
|
||||
run: ./docker/run_local_docker.sh
|
||||
|
||||
|
@ -327,6 +327,7 @@ const Ingestion: React.FC<Props> = ({
|
||||
<div className="tw-flex">
|
||||
<div
|
||||
className="link-text tw-mr-2"
|
||||
data-testid="run"
|
||||
onClick={() =>
|
||||
handleTriggerIngestion(
|
||||
ingestion.id as string,
|
||||
@ -345,6 +346,7 @@ const Ingestion: React.FC<Props> = ({
|
||||
</div>
|
||||
<div
|
||||
className="link-text tw-mr-2"
|
||||
data-testid="edit"
|
||||
onClick={() => handleUpdate(ingestion)}>
|
||||
{updateSelection.id === ingestion.id ? (
|
||||
updateSelection.state === 'success' ? (
|
||||
@ -358,6 +360,7 @@ const Ingestion: React.FC<Props> = ({
|
||||
</div>
|
||||
<div
|
||||
className="link-text tw-mr-2"
|
||||
data-testid="delete"
|
||||
onClick={() =>
|
||||
ConfirmDelete(
|
||||
ingestion.id as string,
|
||||
|
@ -446,6 +446,7 @@ const IngestionModal: React.FC<IngestionModalProps> = ({
|
||||
</label>
|
||||
<input
|
||||
className="tw-form-inputs tw-px-3 tw-py-1"
|
||||
data-testid="includeFilterPattern"
|
||||
id="includeFilterPattern"
|
||||
name="includeFilterPattern"
|
||||
placeholder="Include filter patterns comma seperated"
|
||||
@ -460,6 +461,7 @@ const IngestionModal: React.FC<IngestionModalProps> = ({
|
||||
</label>
|
||||
<input
|
||||
className="tw-form-inputs tw-px-3 tw-py-1"
|
||||
data-testid="excludeFilterPattern"
|
||||
id="excludeFilterPattern"
|
||||
name="excludeFilterPattern"
|
||||
placeholder="Exclude filter patterns comma seperated"
|
||||
@ -526,6 +528,7 @@ const IngestionModal: React.FC<IngestionModalProps> = ({
|
||||
<label htmlFor="endDate">End date (UTC):</label>
|
||||
<input
|
||||
className="tw-form-inputs tw-px-3 tw-py-1"
|
||||
data-testid="endDate"
|
||||
min={startDate}
|
||||
type="date"
|
||||
value={endDate}
|
||||
|
@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openmetadata.catalog.selenium.pages.ingestion;
|
||||
|
||||
import com.github.javafaker.Faker;
|
||||
import org.openmetadata.catalog.selenium.events.Events;
|
||||
import org.openmetadata.catalog.selenium.properties.Property;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.chrome.ChromeDriver;
|
||||
import org.openqa.selenium.chrome.ChromeOptions;
|
||||
import org.openqa.selenium.interactions.Actions;
|
||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.TestMethodOrder;
|
||||
import org.junit.jupiter.api.MethodOrderer;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
public class IngestionPageTest {
|
||||
|
||||
static WebDriver webDriver;
|
||||
static String url = Property.getInstance().getURL();
|
||||
static Faker faker = new Faker();
|
||||
static Actions actions;
|
||||
static WebDriverWait wait;
|
||||
Integer waitTime = Property.getInstance().getSleepTime();
|
||||
|
||||
@BeforeEach
|
||||
public void openMetadataWindow() {
|
||||
System.setProperty("webdriver.chrome.driver", "src/test/resources/drivers/linux/chromedriver");
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.addArguments("--headless");
|
||||
options.addArguments("--window-size=1280,800");
|
||||
webDriver = new ChromeDriver(options);
|
||||
actions = new Actions(webDriver);
|
||||
wait = new WebDriverWait(webDriver, Duration.ofSeconds(30));
|
||||
webDriver.manage().window().maximize();
|
||||
webDriver.get(url);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
public void openIngestionPage() throws InterruptedException {
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='closeWhatsNew']")); // Close What's new
|
||||
Thread.sleep(waitTime);
|
||||
Events.click(webDriver, By.cssSelector(
|
||||
"[data-testid='menu-button'][id='menu-button-Settings']")); // Setting
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='menu-item-Ingestions']")); // Setting/Services
|
||||
Thread.sleep(waitTime);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
public void addIngestionService() throws InterruptedException {
|
||||
openIngestionPage();
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='add-new-user-button']"));
|
||||
Events.sendKeys(webDriver, By.cssSelector("[id='name'][name='name']"), faker.name().firstName());
|
||||
Events.click(webDriver, By.cssSelector("[value='BigQuery$$bigquery']"));
|
||||
Events.click(webDriver, By.cssSelector("[value='bigquery']"));
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='next-button']"));
|
||||
Events.sendKeys(webDriver, By.cssSelector("[name='username']"), "openmetadata_user");
|
||||
Events.sendKeys(webDriver, By.cssSelector("[name='password']"), "openmetadata_password");
|
||||
Events.sendKeys(webDriver, By.cssSelector("[name='host']"), "localhost:3306");
|
||||
Events.sendKeys(webDriver, By.cssSelector("[name='database']"), "openmetadata_db");
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='next-button']"));
|
||||
Events.click(webDriver, By.cssSelector("[value='week']"));
|
||||
Events.click(webDriver, By.cssSelector("[value='4']"));
|
||||
Events.click(webDriver, By.cssSelector("[value='21']"));
|
||||
Events.sendKeys(webDriver, By.cssSelector("[data-testid='endDate']"), "21072022");
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='next-button']"));
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='save-button']"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
public void runIngestionService() throws InterruptedException{
|
||||
openIngestionPage();
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='run']"));
|
||||
webDriver.navigate().refresh();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(4)
|
||||
public void editIngestionService() throws InterruptedException{
|
||||
openIngestionPage();
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='edit']"));
|
||||
Events.sendKeys(webDriver, By.cssSelector("[data-testid='includeFilterPattern']"), ",");
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='next-button']"));
|
||||
Events.click(webDriver, By.cssSelector("[value='hour']"));
|
||||
Events.click(webDriver, By.cssSelector("[value='20']"));
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='next-button']"));
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='save-button']"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(5)
|
||||
public void deleteIngestionService() throws InterruptedException {
|
||||
openIngestionPage();
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='delete']"));
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='save-button']"));
|
||||
webDriver.navigate().refresh();
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void closeTabs() {
|
||||
ArrayList<String> tabs = new ArrayList<>(webDriver.getWindowHandles());
|
||||
String originalHandle = webDriver.getWindowHandle();
|
||||
for (String handle : webDriver.getWindowHandles()) {
|
||||
if (!handle.equals(originalHandle)) {
|
||||
webDriver.switchTo().window(handle);
|
||||
webDriver.close();
|
||||
}
|
||||
}
|
||||
webDriver.switchTo().window(tabs.get(0)).close();
|
||||
}
|
||||
}
|
@ -16,6 +16,10 @@
|
||||
|
||||
package org.openmetadata.catalog.selenium.pages.myData;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.openmetadata.catalog.selenium.events.Events;
|
||||
import org.openmetadata.catalog.selenium.properties.Property;
|
||||
import org.openqa.selenium.By;
|
||||
@ -25,10 +29,6 @@ import org.openqa.selenium.chrome.ChromeOptions;
|
||||
import org.openqa.selenium.interactions.Actions;
|
||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Order;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
@ -37,10 +37,9 @@ public class MyDataPageTest {
|
||||
|
||||
static WebDriver webDriver;
|
||||
static String url = Property.getInstance().getURL();
|
||||
Integer waitTime = Property.getInstance().getSleepTime();
|
||||
static Actions actions;
|
||||
static WebDriverWait wait;
|
||||
|
||||
Integer waitTime = Property.getInstance().getSleepTime();
|
||||
|
||||
@BeforeEach
|
||||
public void openMetadataWindow() {
|
||||
@ -84,6 +83,8 @@ public class MyDataPageTest {
|
||||
webDriver.navigate().back();
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='service']")); // Services
|
||||
webDriver.navigate().back();
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='ingestion']")); // Services
|
||||
webDriver.navigate().back();
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='user']")); // Users
|
||||
webDriver.navigate().back();
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='terms']")); // Teams
|
||||
|
@ -111,6 +111,7 @@ public class TopicDetailsPageTest {
|
||||
}
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='saveAssociatedTag']"));
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='appbar-item'][id='explore']")); // Explore
|
||||
Events.click(webDriver, By.xpath("(//button[@data-testid='tab'])[2]")); // Topics
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='checkbox'][id='PersonalData.Personal']"));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user