gherkin.formatter.model.DataTableRow Java Examples

The following examples show how to use gherkin.formatter.model.DataTableRow. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebHome.java    From xframium-java with GNU General Public License v3.0 6 votes vote down vote up
@Then( "^I call method one$")
public void cucumberMethodOne( WebDriver webDriver, DataTable dT )
{
	try
    {
		System.out.println( "DT: " + dT );
		
		
		WebHomePage wPage = (WebHomePage) createPage( WebHomePage.class, (DeviceWebDriver) webDriver );
        String beforeClick = wPage.getElement( WebHomePage.TOGGLE_VALUE ).getValue();
        wPage.getElement( WebHomePage.TOGGLE_BUTTON ).click();
        String afterClick = wPage.getElement( WebHomePage.TOGGLE_VALUE ).getValue();
        
        Assert.assertNotEquals( afterClick,  beforeClick, "Expected counter to not be equal after click" );
        
        String typeAttribute = wPage.getElement( WebHomePage.TOGGLE_BUTTON ).getAttribute( "type" );
        
        Assert.assertFalse( wPage.getElement( WebHomePage.DELETE_BUTTON ).isVisible(), "Expected DELETE to be invisible");
        wPage.getElement( WebHomePage.ACCORDIAN_OPEN ).click();
        Assert.assertTrue( wPage.getElement( WebHomePage.DELETE_BUTTON ).waitForVisible( 12, TimeUnit.SECONDS ), "Expected DELETE to be visible" );
        
        
        if ( dT != null )
        {
        	for ( DataTableRow r : dT.getGherkinRows() )
        		executeStep( "REPORT", WebHomePage.class.getName(), "", new String[] { r.getCells().get( 0 ),r.getCells().get( 1 ) }, (DeviceWebDriver) webDriver, r.getCells().get( 0 ) + " set to " + r.getCells().get( 1 ), null );
        }
        
        
    }
    catch( Exception e )
    {
        e.printStackTrace();
    }
}
 
Example #2
Source File: AllureCucumberJvm.java    From allure-java with Apache License 2.0 5 votes vote down vote up
private void createDataTableAttachment(final List<DataTableRow> dataTableRows) {
    final StringBuilder dataTableCsv = new StringBuilder();

    if (dataTableRows != null && !dataTableRows.isEmpty()) {
        dataTableRows.forEach(dataTableRow -> {
            dataTableCsv.append(String.join("\t", dataTableRow.getCells()));
            dataTableCsv.append('\n');
        });

        final String attachmentSource = lifecycle
                .prepareAttachment("Data table", "text/tab-separated-values", "csv");
        lifecycle.writeAttachment(attachmentSource,
                new ByteArrayInputStream(dataTableCsv.toString().getBytes(StandardCharsets.UTF_8)));
    }
}
 
Example #3
Source File: AllureReporter.java    From allure-cucumberjvm with Apache License 2.0 5 votes vote down vote up
private void createDataTableAttachment(final List<DataTableRow> dataTableRows) {
    if (dataTableRows != null && !dataTableRows.isEmpty()) {
        final StringBuilder dataTableCsv = new StringBuilder();
        for (DataTableRow row : dataTableRows) {
            dataTableCsv.append(StringUtils.join(row.getCells().toArray(), "\t"));
            dataTableCsv.append('\n');
        }
        ALLURE_LIFECYCLE.fire(new MakeAttachmentEvent(dataTableCsv.toString().getBytes(),
                "Data table", "text/tab-separated-values"));
    }
}