kezhenxu94 commented on a change in pull request #8160:
URL: https://github.com/apache/dolphinscheduler/pull/8160#discussion_r790377922
##########
File path:
dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/FileManageE2ETest.java
##########
@@ -116,4 +178,112 @@ void testDeleteDirectory() {
);
});
}
+
+ @Test
+ @Order(40)
+ void testCreateFile() {
+ final FileManagePage page = new FileManagePage(browser);
+ String scripts = "echo 123";
+
+ page.createFile(testFileName, scripts);
+
+ await().untilAsserted(() -> assertThat(page.fileList())
+ .as("File list should contain newly-created file")
+ .extracting(WebElement::getText)
+ .anyMatch(it -> it.contains(testFileName)));
+ }
+
+ @Test
+ @Order(41)
+ void testRenameFile() {
+ final FileManagePage page = new FileManagePage(browser);
+
+ page.rename(testFileName, testRenameFileName);
+
+ await().untilAsserted(() -> {
+ browser.navigate().refresh();
+
+ assertThat(page.fileList())
+ .as("File list should contain newly-created file")
+ .extracting(WebElement::getText)
+ .anyMatch(it -> it.contains(testRenameFileName));
+ });
+ }
+
+ @Test
+ @Order(42)
+ void testEditFile() {
+ final FileManagePage page = new FileManagePage(browser);
+ String scripts = "echo 456";
+
+ page.editFile(testRenameFileName, scripts);
+
+ await().untilAsserted(() -> assertThat(page.fileList())
+ .as("File list should contain newly-created file")
+ .extracting(WebElement::getText)
+ .anyMatch(it -> it.contains(testRenameFileName)));
+ }
+
+ @Test
+ @Order(45)
+ void testDeleteFile() {
+ final FileManagePage page = new FileManagePage(browser);
+
+ page.delete(testRenameFileName);
+
+ await().untilAsserted(() -> {
+ browser.navigate().refresh();
+
+ assertThat(
+ page.fileList()
+ ).noneMatch(
+ it -> it.getText().contains(testRenameFileName)
+ );
+ });
+ }
+
+ @Test
+ @Order(60)
+ void testUploadOver1GBFile() throws IOException {
+ final FileManagePage page = new FileManagePage(browser);
+
+ RandomAccessFile file = new RandomAccessFile(testOver1GBFilePath,
"rw");
+ file.setLength((long) (1.5 * 1024 * 1024 * 1024));
+
+ page.uploadFile(testOver1GBFilePath);
+
+ await().untilAsserted(() ->
+ assertThat(browser.findElement(By.tagName("body")).getText())
+ .contains("Upload File size cannot exceed 1g")
+ );
+ }
+
+ @Test
+ @Order(65)
+ void testUploadUnder1GBFile() throws IOException {
+ final FileManagePage page = new FileManagePage(browser);
+
+ browser.navigate().refresh();
+
+ RandomAccessFile file = new RandomAccessFile(testUnder1GBFilePath,
"rw");
+ file.setLength((long) (0.01 * 1024 * 1024 * 1024));
+
+ page.uploadFile(testUnder1GBFilePath);
+
+ await().untilAsserted(() -> {
+ assertThat(page.fileList())
+ .as("File list should contain newly-created file")
+ .extracting(WebElement::getText)
+ .anyMatch(it -> it.contains(testUnder1GBFileName));
+ });
+ }
+
+ @Test
+ @Order(70)
+ void testDownloadFile() {
+ final FileManagePage page = new FileManagePage(browser);
+
+ page.downloadFile(testUnder1GBFileName);
+
Review comment:
Can you add an assertion to assert that the file exists locally after
the download operation?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]