Skip to content

Commit

Permalink
add a test case for a cut overflow text in right alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkchen committed Nov 13, 2019
1 parent 795e0b0 commit 724e8cb
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 724e8cb

Please sign in to comment.