diff --git a/zss.test.selenium/src/main/java/org/zkoss/zss/test/selenium/ZSSTestCase.java b/zss.test.selenium/src/main/java/org/zkoss/zss/test/selenium/ZSSTestCase.java index cf2bb0a46..ff34a64fa 100644 --- a/zss.test.selenium/src/main/java/org/zkoss/zss/test/selenium/ZSSTestCase.java +++ b/zss.test.selenium/src/main/java/org/zkoss/zss/test/selenium/ZSSTestCase.java @@ -2,7 +2,7 @@ import static org.junit.Assert.assertTrue; -import org.openqa.selenium.WebElement; +import org.openqa.selenium.*; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.remote.RemoteWebDriver; import org.zkoss.zss.test.selenium.entity.ClientWidget; @@ -41,7 +41,17 @@ public void sendKeys(ClientWidget widget, String keyCode) { element.sendKeys(keyCode); waitForTrip(lt, 1, Setup.getAuDelay()); } - + + public void type(ClientWidget editor, String keyCode) { + WebElement element = editor.toWebElement(); + sendKeys(editor, keyCode); + element.sendKeys(Keys.ENTER); + } + + public void delete(ClientWidget editor){ + editor.toWebElement().sendKeys(Keys.DELETE); + } + public void rightClick(WebElement element) { Actions action= new Actions(driver()); action.contextClick(element).perform(); diff --git a/zss.test.selenium/src/test/java/org/zkoss/zss/test/selenium/testcases/function/AlignmentOverflowTest.java b/zss.test.selenium/src/test/java/org/zkoss/zss/test/selenium/testcases/function/AlignmentOverflowTest.java index c9b33eb55..e91b8466e 100644 --- a/zss.test.selenium/src/test/java/org/zkoss/zss/test/selenium/testcases/function/AlignmentOverflowTest.java +++ b/zss.test.selenium/src/test/java/org/zkoss/zss/test/selenium/testcases/function/AlignmentOverflowTest.java @@ -70,21 +70,35 @@ public void testZSS1338PartialOverflow() throws Exception { basename(); SpreadsheetWidget ss = focusSheet(); SheetCtrlWidget sheetCtrl = ss.getSheetCtrl(); - click(sheetCtrl.getCell("D9")); doubleClick(sheetCtrl.getCell("D9")); waitForTime(Setup.getTimeoutL0()); EditorWidget editor = sheetCtrl.getInlineEditor(); - sendKeys(editor, "cut"); - click(sheetCtrl.getCell("A1")); + type(editor, "cut"); captureOrAssert("partial1"); - click(sheetCtrl.getCell("E9")); doubleClick(sheetCtrl.getCell("E9")); - sendKeys(editor, "cut"); - click(sheetCtrl.getCell("A1")); + type(editor, "cut"); waitForTime(Setup.getTimeoutL0()); captureOrAssert("partial2"); } + + @Test + public void testCutOverflowLeftAlignment() throws Exception { + getTo(OVERFLOW_RIGHT_ALIGN_ZUL); + basename(); + SpreadsheetWidget ss = focusSheet(); + SheetCtrlWidget sheetCtrl = ss.getSheetCtrl(); + CellWidget e1 = sheetCtrl.getCell("E1"); + doubleClick(e1); + waitForTime(Setup.getTimeoutL0()); + EditorWidget editor = sheetCtrl.getInlineEditor(); + type(editor, "cut"); + captureOrAssert("cutLeft1"); + click(e1); + delete(editor); + captureOrAssert("cutLeft2"); + } + @Test public void testZSS1364SheetSwitching(){ getTo(OVERFLOW_RIGHT_ALIGN_ZUL);