Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#2394] feat(IT): Add metalake page to web e2e test #2395

Merged
merged 28 commits into from
Mar 13, 2024

Conversation

ch3yne
Copy link
Contributor

@ch3yne ch3yne commented Feb 28, 2024

What changes were proposed in this pull request?

Add web e2e test to homepage.

Why are the changes needed?

Fix: #2394

Does this PR introduce any user-facing change?

N/A

How was this patch tested?

N/A

@ch3yne ch3yne requested a review from xunliu February 28, 2024 13:33
@ch3yne ch3yne self-assigned this Feb 28, 2024
@xunliu xunliu changed the title [#2394] feat(web): add web e2e test to homepage [#2394] feat(IT): Add metalake page to web e2e test Feb 29, 2024
@xunliu
Copy link
Member

xunliu commented Feb 29, 2024

@ch3yne Please fix Github Action failed.
You can execute ./gradew build in gravitino root directory.

Copy link
Member

@xunliu xunliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LauraXia123 Please help review this PR, Thanks!

@xunliu xunliu requested a review from LauraXia123 February 29, 2024 08:28
@ch3yne ch3yne force-pushed the add-e2e-homepage branch 3 times, most recently from 8aef514 to 72e1f14 Compare March 5, 2024 10:04
@ch3yne ch3yne marked this pull request as ready for review March 5, 2024 10:18
@ch3yne ch3yne force-pushed the add-e2e-homepage branch from 13b0a17 to 0cf2377 Compare March 6, 2024 10:00
boolean status = metalakePage.verifyIsCreatedMetalake();

if (status) {
LOG.info("create metalake successful");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have to do the log in java test. Just check the return value is expected or not is enough. @xunliu please help @ch3yne to make this test more java-ish.

Comment on lines 44 to 50
boolean status = metalakePage.verifyQueryMetalake();

if (status) {
LOG.info("query metalake successful");
} else {
Assertions.fail("query metalake failed");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change these code to

Assertions.assertTrue(metalakePage.verifyQueryMetalake());

and other place codes.


public void queryMetalakeAction() {
LOG.info("test query metalake action started");
enterQueryInput("tes");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what mean is tes?

}

public void createManyMetalakesAction() {
LOG.info("test create many metalakes action started");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove all LOG.info() and other place codes.

Comment on lines 128 to 126
public void clickAddPropertyBtn() {
LOG.info("click add metalake property button");
this.addMetalakePropertyBtn.click();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function only have one line code, call clickAddPropertyBtn() or this.addMetalakePropertyBtn.click() is same.

and clickNextPageBtn(), clickPrevPageBtn()

try {
List<WebElement> dataList = dataViewer.findElements(By.xpath(".//div[@data-field='name']"));

if (dataList.size() == 9) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is 9?

@ch3yne ch3yne force-pushed the add-e2e-homepage branch from 805c43e to 428d7ae Compare March 11, 2024 03:38
Comment on lines 140 to 147
String rowPath = "//div[@data-id='" + name + "']";
WebElement createdMetalakeRow = driver.findElement(By.xpath(rowPath));
boolean isRow = createdMetalakeRow.isDisplayed();

String linkPath = "//div[@data-field='name']//a[@href='/ui/metalakes?metalake=" + name + "']";
WebElement createdMetalakeLink = driver.findElement(By.xpath(linkPath));
boolean isLink = createdMetalakeLink.isDisplayed();
boolean isText = Objects.equals(createdMetalakeLink.getText(), name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add some comments to describe these codes.

int retry = 0;
int sleepTimeMillis = 1_000;

while (retry++ < 3) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 3 second too short, Please change to 5.

Comment on lines 179 to 180
metalakeDetailsDrawer.isDisplayed();
String drawerVisible = metalakeDetailsDrawer.getCssValue("visibility");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's too sketchy to just check if it's visible or not.
Don't we need check value on each element?

@LauraXia123
Copy link
Collaborator

no comments for me

@@ -74,7 +84,7 @@ public void testCreateMultipleMetalakes() {

for (int i = 0; i < towPagesCount; i++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What mean is towPagesCount?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default counts of one page is 10, I need create over 11 counts of metalakes to make the Go to next page available.

} finally {
// Back to homepage
String xpath = "//button[@data-refer='back-home-btn']";
WebElement backHomeBtn = driver.findElement(By.xpath(xpath));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whether need define backHomeBtn to be a MetalakePage Class vaiable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the backHomeBtn Class in CatalogsPage.java, I will modify when the PR is submited.

@@ -15,7 +15,7 @@
public class AbstractWebIT extends AbstractIT {
protected static final Logger LOG = LoggerFactory.getLogger(AbstractWebIT.class);
protected static WebDriver driver;
protected static final long MAX_IMPLICIT_WAIT = 60;
protected static final long MAX_IMPLICIT_WAIT = 10;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why need reduce wait time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When searching for elements, this implicit wait time is too long, which will increase the time it takes for testing.

List<WebElement> errorText =
nameField.findElements(By.xpath("//div[contains(@class, 'Mui-error')]"));

return !errorText.isEmpty();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use Strings.isEmpty() function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the element function.

Copy link
Member

@xunliu xunliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xunliu
Copy link
Member

xunliu commented Mar 13, 2024

@ch3yne Please remember fix #2512 when you have time.

@xunliu xunliu merged commit ddfc4cf into apache:main Mar 13, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Subtask] Add web e2e test to homepage
4 participants