-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat[TE-12922] : External word document table editor
- Loading branch information
1 parent
3444a68
commit d3ab104
Showing
19 changed files
with
1,150 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project | ||
xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.testsigma.addons</groupId> | ||
<artifactId>external_word_document_table_editor</artifactId> | ||
<version>1.0.0</version> | ||
<packaging>jar</packaging> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.source>11</maven.compiler.source> | ||
<maven.compiler.target>11</maven.compiler.target> | ||
<testsigma.sdk.version>1.2.2_cloud</testsigma.sdk.version> | ||
<junit.jupiter.version>5.8.0-M1</junit.jupiter.version> | ||
<testsigma.addon.maven.plugin>1.0.0</testsigma.addon.maven.plugin> | ||
<maven.source.plugin.version>3.2.1</maven.source.plugin.version> | ||
<lombok.version>1.18.20</lombok.version> | ||
|
||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.testsigma</groupId> | ||
<artifactId>testsigma-java-sdk</artifactId> | ||
<version>${testsigma.sdk.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<version>${lombok.version}</version> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.poi</groupId> | ||
<artifactId>poi-ooxml</artifactId> | ||
<version>3.15</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
<version>${junit.jupiter.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.testng</groupId> | ||
<artifactId>testng</artifactId> | ||
<version>6.14.3</version> | ||
</dependency> | ||
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java --> | ||
<dependency> | ||
<groupId>org.seleniumhq.selenium</groupId> | ||
<artifactId>selenium-java</artifactId> | ||
<version>3.141.59</version> | ||
</dependency> | ||
<!-- https://mvnrepository.com/artifact/io.appium/java-client --> | ||
<dependency> | ||
<groupId>io.appium</groupId> | ||
<artifactId>java-client</artifactId> | ||
<version>7.0.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-annotations</artifactId> | ||
<version>2.13.0</version> | ||
</dependency> | ||
|
||
</dependencies> | ||
<build> | ||
<finalName>external_word_document_table_editor</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<version>3.2.4</version> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-source-plugin</artifactId> | ||
<version>${maven.source.plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<id>attach-sources</id> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
Binary file not shown.
60 changes: 60 additions & 0 deletions
60
...nal_word_document_table_editor/src/main/java/com/testsigma/addons/web/CellOperations.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package com.testsigma.addons.web; | ||
|
||
import com.testsigma.sdk.ApplicationType; | ||
import com.testsigma.sdk.Result; | ||
import com.testsigma.sdk.WebAction; | ||
import com.testsigma.sdk.annotation.Action; | ||
import com.testsigma.sdk.annotation.TestData; | ||
import lombok.Data; | ||
import org.openqa.selenium.NoSuchElementException; | ||
import utility.CellUtil; | ||
|
||
|
||
@Data | ||
@Action(actionText = "Select a table from word document and edit or verify a cell."+ | ||
"Document path : Path, Table heading : Heading,"+ | ||
"Perform operation : <operation> on target cell column : column-name with value : Value,"+ | ||
"where column2-name value equals column2-value.", | ||
description = "Selects a table from word document and edit or verify a cell.", | ||
applicationType = ApplicationType.WEB) | ||
public class CellOperations extends WebAction { | ||
@TestData(reference = "Path") | ||
private com.testsigma.sdk.TestData documentPath; | ||
@TestData(reference = "Heading") | ||
private com.testsigma.sdk.TestData heading; | ||
@TestData(reference = "<operation>", allowedValues = {"Modify","Append","Verify"}) | ||
private com.testsigma.sdk.TestData operation; | ||
@TestData(reference = "column-name") | ||
private com.testsigma.sdk.TestData targetColumn; | ||
@TestData(reference = "column2-name") | ||
private com.testsigma.sdk.TestData column; | ||
@TestData(reference = "column2-value") | ||
private com.testsigma.sdk.TestData value; | ||
@TestData(reference = "Value") | ||
private com.testsigma.sdk.TestData data; | ||
@Override | ||
protected Result execute() throws NoSuchElementException { | ||
CellUtil cellUtil = new CellUtil(); | ||
Result result = Result.FAILED; | ||
if(cellUtil.CellOperations( | ||
documentPath.getValue().toString().trim(), | ||
heading.getValue().toString(), | ||
"", | ||
true, | ||
1, | ||
targetColumn.getValue().toString(), | ||
column.getValue().toString(), | ||
value.getValue().toString(), | ||
operation.getValue().toString(), | ||
data.getValue().toString() | ||
)){ | ||
result = Result.SUCCESS; | ||
setSuccessMessage(cellUtil.getSuccessMessage()); | ||
logger.info(cellUtil.getSuccessMessage()); | ||
}else{ | ||
setErrorMessage(cellUtil.getErrorMessage()); | ||
logger.info(cellUtil.getErrorMessage()); | ||
} | ||
return result; | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
...l_word_document_table_editor/src/main/java/com/testsigma/addons/web/CellOperationsV2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package com.testsigma.addons.web; | ||
|
||
import com.testsigma.sdk.ApplicationType; | ||
import com.testsigma.sdk.Result; | ||
import com.testsigma.sdk.WebAction; | ||
import com.testsigma.sdk.annotation.Action; | ||
import com.testsigma.sdk.annotation.TestData; | ||
import lombok.Data; | ||
import org.openqa.selenium.NoSuchElementException; | ||
import utility.CellUtil; | ||
|
||
|
||
@Data | ||
@Action(actionText = "Select a child/sub table from word document and edit or verify a cell."+ | ||
"Document path : Path, Table main heading : main-heading, sub heading : sub-heading, table position under sub heading : Position,"+ | ||
"Perform operation : <operation> on target cell column : column-name with value : Value, where column2-name value equals column2-value.", | ||
description = "Selects a child/sub table from word document and edit or verify a cell.", | ||
applicationType = ApplicationType.WEB) | ||
public class CellOperationsV2 extends WebAction { | ||
@TestData(reference = "Path") | ||
private com.testsigma.sdk.TestData documentPath; | ||
@TestData(reference = "main-heading") | ||
private com.testsigma.sdk.TestData mainHeading; | ||
@TestData(reference = "sub-heading") | ||
private com.testsigma.sdk.TestData subHeading; | ||
@TestData(reference = "Position") | ||
private com.testsigma.sdk.TestData position; | ||
@TestData(reference = "<operation>", allowedValues = {"Modify","Append","Verify"}) | ||
private com.testsigma.sdk.TestData operation; | ||
@TestData(reference = "column-name") | ||
private com.testsigma.sdk.TestData targetColumn; | ||
@TestData(reference = "column2-name") | ||
private com.testsigma.sdk.TestData column; | ||
@TestData(reference = "column2-value") | ||
private com.testsigma.sdk.TestData value; | ||
@TestData(reference = "Value") | ||
private com.testsigma.sdk.TestData data; | ||
@Override | ||
protected Result execute() throws NoSuchElementException { | ||
CellUtil cellUtil = new CellUtil(); | ||
Result result = Result.FAILED; | ||
if(cellUtil.CellOperations( | ||
documentPath.getValue().toString(), | ||
mainHeading.getValue().toString(), | ||
subHeading.getValue().toString(), | ||
false, | ||
Integer.parseInt(position.getValue().toString()), | ||
targetColumn.getValue().toString(), | ||
column.getValue().toString(), | ||
value.getValue().toString(), | ||
operation.getValue().toString(), | ||
data.getValue().toString() | ||
)){ | ||
result = Result.SUCCESS; | ||
setSuccessMessage(cellUtil.getSuccessMessage()); | ||
logger.info(cellUtil.getSuccessMessage()); | ||
}else{ | ||
setErrorMessage(cellUtil.getErrorMessage()); | ||
logger.info(cellUtil.getErrorMessage()); | ||
} | ||
return result; | ||
} | ||
} | ||
|
54 changes: 54 additions & 0 deletions
54
...ocument_table_editor/src/main/java/com/testsigma/addons/web/CellSelectionAndDeletion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.testsigma.addons.web; | ||
|
||
import com.testsigma.sdk.ApplicationType; | ||
import com.testsigma.sdk.Result; | ||
import com.testsigma.sdk.WebAction; | ||
import com.testsigma.sdk.annotation.Action; | ||
import com.testsigma.sdk.annotation.TestData; | ||
import lombok.Data; | ||
import org.openqa.selenium.NoSuchElementException; | ||
import utility.CellUtil; | ||
|
||
@Data | ||
@Action(actionText = "Select a table from word document and select or clear a cell."+ | ||
"Document path : Path, Table heading : Heading, Perform operation : <operation> on target cell column : column-name,"+ | ||
"where column2-name value equals column2-value.", | ||
description = "Selects a table from word document and select or clear a cell.", | ||
applicationType = ApplicationType.WEB) | ||
public class CellSelectionAndDeletion extends WebAction { | ||
@TestData(reference = "Path") | ||
private com.testsigma.sdk.TestData documentPath; | ||
@TestData(reference = "Heading") | ||
private com.testsigma.sdk.TestData heading; | ||
@TestData(reference = "<operation>", allowedValues = {"Select", "Clear"}) | ||
private com.testsigma.sdk.TestData operation; | ||
@TestData(reference = "column-name") | ||
private com.testsigma.sdk.TestData targetColumn; | ||
@TestData(reference = "column2-name") | ||
private com.testsigma.sdk.TestData column; | ||
@TestData(reference = "column2-value") | ||
private com.testsigma.sdk.TestData value; | ||
|
||
@Override | ||
protected Result execute() throws NoSuchElementException { | ||
CellUtil cellUtil = new CellUtil(); | ||
Result result = Result.FAILED; | ||
if(cellUtil.CellSelectionAndDeletion( | ||
documentPath.getValue().toString(), | ||
heading.getValue().toString(), | ||
"", | ||
true, | ||
1, | ||
targetColumn.getValue().toString(), | ||
column.getValue().toString(), | ||
value.getValue().toString(), | ||
operation.getValue().toString() | ||
)){ | ||
result = Result.SUCCESS; | ||
setSuccessMessage(cellUtil.getSuccessMessage()); | ||
}else{ | ||
setErrorMessage(cellUtil.getErrorMessage()); | ||
} | ||
return result; | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
...ument_table_editor/src/main/java/com/testsigma/addons/web/CellSelectionAndDeletionV2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.testsigma.addons.web; | ||
|
||
|
||
import com.testsigma.sdk.ApplicationType; | ||
import com.testsigma.sdk.Result; | ||
import com.testsigma.sdk.WebAction; | ||
import com.testsigma.sdk.annotation.Action; | ||
import com.testsigma.sdk.annotation.TestData; | ||
import lombok.Data; | ||
import org.openqa.selenium.NoSuchElementException; | ||
import utility.CellUtil; | ||
|
||
|
||
@Data | ||
@Action(actionText = "Select a child/sub table from word document and select or clear a cell."+ | ||
"Document path : Path, Table main heading : main-heading, sub heading : sub-heading, table position under sub heading : Position,"+ | ||
"Perform operation : <operation> on target cell column name : column-name, where column2 name : column2-name value equals column2-value.", | ||
description = "Selects a child/sub table from word document and select or clear a cell.", | ||
applicationType = ApplicationType.WEB) | ||
public class CellSelectionAndDeletionV2 extends WebAction { | ||
@TestData(reference = "Path") | ||
private com.testsigma.sdk.TestData documentPath; | ||
@TestData(reference = "main-heading") | ||
private com.testsigma.sdk.TestData mainHeading; | ||
@TestData(reference = "sub-heading") | ||
private com.testsigma.sdk.TestData subHeading; | ||
@TestData(reference = "Position") | ||
private com.testsigma.sdk.TestData position; | ||
@TestData(reference = "<operation>", allowedValues = {"Select", "Clear"}) | ||
private com.testsigma.sdk.TestData operation; | ||
@TestData(reference = "column-name") | ||
private com.testsigma.sdk.TestData targetColumn; | ||
@TestData(reference = "column2-name") | ||
private com.testsigma.sdk.TestData column; | ||
@TestData(reference = "column2-value") | ||
private com.testsigma.sdk.TestData value; | ||
|
||
@Override | ||
protected Result execute() throws NoSuchElementException { | ||
CellUtil cellUtil = new CellUtil(); | ||
Result result = Result.FAILED; | ||
if(cellUtil.CellSelectionAndDeletion( | ||
documentPath.getValue().toString(), | ||
mainHeading.getValue().toString(), | ||
subHeading.getValue().toString(), | ||
false, | ||
Integer.parseInt(position.getValue().toString()), | ||
targetColumn.getValue().toString(), | ||
column.getValue().toString(), | ||
value.getValue().toString(), | ||
operation.getValue().toString() | ||
)){ | ||
result = Result.SUCCESS; | ||
setSuccessMessage(cellUtil.getSuccessMessage()); | ||
}else{ | ||
setErrorMessage(cellUtil.getErrorMessage()); | ||
} | ||
return result; | ||
} | ||
} | ||
|
50 changes: 50 additions & 0 deletions
50
external_word_document_table_editor/src/main/java/com/testsigma/addons/web/RowAddition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.testsigma.addons.web; | ||
|
||
import com.testsigma.sdk.ApplicationType; | ||
import com.testsigma.sdk.Result; | ||
import com.testsigma.sdk.WebAction; | ||
import com.testsigma.sdk.annotation.Action; | ||
import com.testsigma.sdk.annotation.TestData; | ||
import lombok.Data; | ||
import org.openqa.selenium.NoSuchElementException; | ||
import utility.RowUtil; | ||
|
||
|
||
@Data | ||
@Action(actionText = "Select a table from word document and add a row in specific position."+ | ||
"Document path : Path , Table heading : Heading,"+ | ||
"Add row with data : row-data at position row-position.", | ||
description = "Selects a table from word document and add a row in specific position.", | ||
applicationType = ApplicationType.WEB) | ||
public class RowAddition extends WebAction { | ||
@TestData(reference = "Path") | ||
private com.testsigma.sdk.TestData documentPath; | ||
@TestData(reference = "Heading") | ||
private com.testsigma.sdk.TestData heading; | ||
@TestData(reference = "row-data") | ||
private com.testsigma.sdk.TestData data; | ||
@TestData(reference = "row-position") | ||
private com.testsigma.sdk.TestData rowPosition; | ||
@Override | ||
protected Result execute() throws NoSuchElementException { | ||
RowUtil rowUtil = new RowUtil(); | ||
Result result = Result.FAILED; | ||
if(rowUtil.RowAddition( | ||
documentPath.getValue().toString(), | ||
heading.getValue().toString(), | ||
"", | ||
true, | ||
1, | ||
data.getValue().toString(), | ||
Integer.parseInt(rowPosition.getValue().toString()) | ||
)){ | ||
result = Result.SUCCESS; | ||
setSuccessMessage(rowUtil.getSuccessMessage()); | ||
logger.info(rowUtil.getSuccessMessage()); | ||
}else{ | ||
setErrorMessage(rowUtil.getErrorMessage()); | ||
logger.info(rowUtil.getErrorMessage()); | ||
} | ||
return result; | ||
} | ||
} |
Oops, something went wrong.