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

[#1503] feat(IT): Gravitino web e2e test framework #1689

Merged
merged 3 commits into from
Jan 25, 2024

Conversation

xunliu
Copy link
Member

@xunliu xunliu commented Jan 24, 2024

What changes were proposed in this pull request?

  1. Automatic download Chrome & Chrome Driver into ./intergration-test/build/chrome directory. need to download about 150 MB zip file for the first time.
  2. Support embedded and deploy test mode.
  3. Support Linux and macOS operation systems
  4. Successed load metalake webpage and check the browser title.
  5. [Subtask] Check web e2e test in the Windows OS #1687

Why are the changes needed?

Gravitino Web UI needs an E2E test to ensure Web UI usability.

Fix: #1503

Does this PR introduce any user-facing change?

N/A

How was this patch tested?

CI Passed

@xunliu xunliu added this to the Gravitino 0.4.0 milestone Jan 24, 2024
@xunliu xunliu requested review from jerryshao and yuqi1129 January 24, 2024 10:08
@xunliu xunliu self-assigned this Jan 24, 2024
Copy link
Contributor

@diqiu50 diqiu50 left a comment

Choose a reason for hiding this comment

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

I suggest running web integration tests through special command arguments.

}

@Override
public void downloadWebDriver() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why aren't these downloads implemented with a separate script?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think better use JAVA method to download web browser driver.

if (!loaded) {
fail();
}
Dimension d = new Dimension(1920, 1080);
Copy link
Contributor

Choose a reason for hiding this comment

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

The resolution here should not be hardcoded, and 1920*1080 is too large; many monitors are not that big. Let's ask @ch3yne to determine an appropriate size.

Copy link
Contributor

Choose a reason for hiding this comment

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

1440*1080 or 1440*900 is usually enough.

Copy link
Member Author

Choose a reason for hiding this comment

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

@ch3yne Thank you.

}

if (!loaded) {
fail();
Copy link
Contributor

Choose a reason for hiding this comment

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

Please give a clear error message.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1, Please do not use Junit 4 API

Copy link
Member Author

Choose a reason for hiding this comment

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

I accepted.

@Override
public Boolean apply(WebDriver d) {
String gravitinoVersion = d.findElement(By.id("gravitino_version")).getText();
String projectVersion = System.getenv("PROJECT_VERSION");
Copy link
Contributor

@diqiu50 diqiu50 Jan 24, 2024

Choose a reason for hiding this comment

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

PROJECT_VERSION should retrieved by gravitino server api

Copy link
Member Author

Choose a reason for hiding this comment

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

But I worry Gravitino server failed to start.

Copy link
Contributor

Choose a reason for hiding this comment

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

If the Gravitino server failed to start. The tester also failed. So it does't matter

@@ -269,6 +271,7 @@ tasks.test {

// Default use MiniGravitino to run integration tests
environment("GRAVITINO_ROOT_DIR", rootDir.path)
environment("IT_PROJECT_DIR", buildDir.path)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this environment? can we refer it from GRAVITINO_ROOT_DIR?

Copy link
Member Author

Choose a reason for hiding this comment

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

Avoid splice integration-test module path, and hard code System.getenv("GRAVITINO_ROOT_DIR") + '\' + 'integration-test'

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class AbstractWebIT extends AbstractIT {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please add some information about it and how we can use it.

Furthermore, add a description of the content subclass that extends it needs to add.

Copy link
Member Author

Choose a reason for hiding this comment

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

DONE

this.chromeDriverBinName = ITUtils.joinPath("chromedriver_win32", "chromedriver.exe");
this.chromeBinName = ITUtils.joinPath("chrome-win", "chrome.exe");
} else {
throw new RuntimeException("Unsupported OS");
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add more information about the error message. like SystemUtils.OS_NAME

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea.

String chromeZipFile = "", chromeDriverZipFile = "";
if (SystemUtils.IS_OS_LINUX) {
// https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F1000022%2Fchrome-linux.zip?generation=1651778257041732&alt=media
chromeZipFile = "chrome-linux.zip";
Copy link
Contributor

Choose a reason for hiding this comment

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

I think making chromeDownloadURL and chromeDriverDownloadURL a constant value can be better.

Copy link
Member Author

Choose a reason for hiding this comment

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

I accepted your suggestion.

}

if (!loaded) {
fail();
Copy link
Contributor

Choose a reason for hiding this comment

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

+1, Please do not use Junit 4 API

@xunliu
Copy link
Member Author

xunliu commented Jan 25, 2024

@yuqi1129 Please help me review this PR again, Thanks.

Copy link
Contributor

@yuqi1129 yuqi1129 left a comment

Choose a reason for hiding this comment

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

LGTM

yuqi1129

This comment was marked as duplicate.

@xunliu xunliu merged commit 7befe58 into apache:main Jan 25, 2024
12 checks passed
@jerryshao jerryshao removed this from the Gravitino 0.4.0 milestone Feb 1, 2024
@xunliu xunliu deleted the issue-1503 branch August 30, 2024 04:04
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.

[FEATURE] Gravitino web E2E test framework
5 participants