You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@submarine.apache.org by ka...@apache.org on 2021/06/13 08:49:34 UTC
[submarine] branch master updated: SUBMARINE-852. [E2E] Remove
redundant code in E2E framework
This is an automated email from the ASF dual-hosted git repository.
kaihsun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git
The following commit(s) were added to refs/heads/master by this push:
new 252a0e9 SUBMARINE-852. [E2E] Remove redundant code in E2E framework
252a0e9 is described below
commit 252a0e9556a78b3788437233153ac8feee636e91
Author: Kai-Hsun Chen <b0...@ntu.edu.tw>
AuthorDate: Sun Jun 13 16:15:02 2021 +0800
SUBMARINE-852. [E2E] Remove redundant code in E2E framework
### What is this PR for?
Because our frontend E2E framework is referred to Zeppelin, some functions for Zeppelin are redundant in Submarine.
### What type of PR is it?
[Refactoring]
### Todos
### What is the Jira issue?
https://issues.apache.org/jira/browse/SUBMARINE-852
### How should this be tested?
https://travis-ci.com/github/apache/submarine/builds/228807048
### Screenshots (if appropriate)
### Questions:
* Do the license files need updating? No
* Are there breaking changes for older versions? No
* Does this need new documentation? No
Author: Kai-Hsun Chen <b0...@ntu.edu.tw>
Signed-off-by: Kai-Hsun Chen <ka...@apache.org>
Closes #604 from kevin85421/SUBMARINE-852 and squashes the following commits:
739d697b [Kai-Hsun Chen] SUBMARINE-852. [E2E] Remove redundant code in E2E framework
---
.../org/apache/submarine/AbstractSubmarineIT.java | 73 ----------------------
.../org/apache/submarine/integration/loginIT.java | 2 -
2 files changed, 75 deletions(-)
diff --git a/submarine-test/test-e2e/src/test/java/org/apache/submarine/AbstractSubmarineIT.java b/submarine-test/test-e2e/src/test/java/org/apache/submarine/AbstractSubmarineIT.java
index c7ec3a7..7aaacc2 100644
--- a/submarine-test/test-e2e/src/test/java/org/apache/submarine/AbstractSubmarineIT.java
+++ b/submarine-test/test-e2e/src/test/java/org/apache/submarine/AbstractSubmarineIT.java
@@ -55,53 +55,10 @@ abstract public class AbstractSubmarineIT {
protected static final long MAX_BROWSER_TIMEOUT_SEC = 60;
protected static final long MAX_PARAGRAPH_TIMEOUT_SEC = 120;
- protected void setTextOfParagraph(int paragraphNo, String text) {
- String editorId = driver.findElement(By.xpath(getParagraphXPath(paragraphNo) + "//div[contains(@class, 'editor')]")).getAttribute("id");
- if (driver instanceof JavascriptExecutor) {
- ((JavascriptExecutor) driver).executeScript("ace.edit('" + editorId + "'). setValue('" + text + "')");
- } else {
- throw new IllegalStateException("This driver does not support JavaScript!");
- }
- }
-
- protected void runParagraph(int paragraphNo) {
- By by = By.xpath(getParagraphXPath(paragraphNo) + "//span[@class='icon-control-play']");
- pollingWait(by, 5);
- driver.findElement(by).click();
- }
-
-
protected String getParagraphXPath(int paragraphNo) {
return "(//div[@ng-controller=\"ParagraphCtrl\"])[" + paragraphNo + "]";
}
- protected String getNoteFormsXPath() {
- return "(//div[@id='noteForms'])";
- }
-
- protected boolean waitForParagraph(final int paragraphNo, final String state) {
- By locator = By.xpath(getParagraphXPath(paragraphNo)
- + "//div[contains(@class, 'control')]//span[2][contains(.,'" + state + "')]");
- WebElement element = pollingWait(locator, MAX_PARAGRAPH_TIMEOUT_SEC);
- return element.isDisplayed();
- }
-
- protected String getParagraphStatus(final int paragraphNo) {
- By locator = By.xpath(getParagraphXPath(paragraphNo)
- + "//div[contains(@class, 'control')]/span[2]");
-
- return driver.findElement(locator).getText();
- }
-
- protected boolean waitForText(final String txt, final By locator) {
- try {
- WebElement element = pollingWait(locator, MAX_BROWSER_TIMEOUT_SEC);
- return txt.equals(element.getText());
- } catch (TimeoutException e) {
- return false;
- }
- }
-
protected WebElement pollingWait(final By locator, final long timeWait) {
Wait<WebDriver> wait = new FluentWait<>(driver)
.withTimeout(timeWait, TimeUnit.SECONDS)
@@ -151,36 +108,6 @@ abstract public class AbstractSubmarineIT {
}
}
- protected void createNewNote() {
- clickAndWait(By.xpath("//div[contains(@class, \"col-md-4\")]/div/h5/a[contains(.,'Create new" +
- " note')]"));
-
- WebDriverWait block = new WebDriverWait(driver, MAX_BROWSER_TIMEOUT_SEC);
- block.until(ExpectedConditions.visibilityOfElementLocated(By.id("noteCreateModal")));
- clickAndWait(By.id("createNoteButton"));
- block.until(ExpectedConditions.invisibilityOfElementLocated(By.id("createNoteButton")));
- }
-
- protected void deleteTestNotebook(final WebDriver driver) {
- WebDriverWait block = new WebDriverWait(driver, MAX_BROWSER_TIMEOUT_SEC);
- driver.findElement(By.xpath(".//*[@id='main']//button[@ng-click='moveNoteToTrash(note.id)']"))
- .sendKeys(Keys.ENTER);
- block.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(".//*[@id='main']//button[@ng-click='moveNoteToTrash(note.id)']")));
- driver.findElement(By.xpath("//div[@class='modal-dialog'][contains(.,'This note will be moved to trash')]" +
- "//div[@class='modal-footer']//button[contains(.,'OK')]")).click();
- SubmarineITUtils.sleep(100, false);
- }
-
- protected void deleteTrashNotebook(final WebDriver driver) {
- WebDriverWait block = new WebDriverWait(driver, MAX_BROWSER_TIMEOUT_SEC);
- driver.findElement(By.xpath(".//*[@id='main']//button[@ng-click='removeNote(note.id)']"))
- .sendKeys(Keys.ENTER);
- block.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(".//*[@id='main']//button[@ng-click='removeNote(note.id)']")));
- driver.findElement(By.xpath("//div[@class='modal-dialog'][contains(.,'This cannot be undone. Are you sure?')]" +
- "//div[@class='modal-footer']//button[contains(.,'OK')]")).click();
- SubmarineITUtils.sleep(100, false);
- }
-
protected void clickAndWait(final By locator) {
pollingWait(locator, MAX_IMPLICIT_WAIT).click();
SubmarineITUtils.sleep(1000, false);
diff --git a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/loginIT.java b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/loginIT.java
index b33b659..a030529 100644
--- a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/loginIT.java
+++ b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/loginIT.java
@@ -33,13 +33,11 @@ public class loginIT extends AbstractSubmarineIT {
@BeforeClass
public static void startUp(){
LOG.info("[Testcase]: loginIT");
- printSubmarineLog();
driver = WebDriverManager.getWebDriver();
}
@AfterClass
public static void tearDown(){
- printSubmarineLog();
driver.quit();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@submarine.apache.org
For additional commands, e-mail: dev-help@submarine.apache.org