Skip to content

Selenium Step Extensions #409

@StefanFellinger

Description

@StefanFellinger

With my workaround in #407 i've added other functionality too. I want to share with you:

  • User clears text on -> see Selenium Input Step Extension #408
  • should display table having data (i'm using the approach that each row id is build by column property + row Index). I've added my code snippet below:
 // a list of row maps where each map entry identifies one column. The key of the map is
        // from the header column
        final List<Map<String, String>> dataMatrix = dataTable.asMaps();
        final List<TestAction> elementActions = new ArrayList<>();
        for (int i = 0; i < dataMatrix.size(); i++) {
            final Map<String, String> valueByColumnId = dataMatrix.get(i);
            for (final Map.Entry<String, String> columnEntry : valueByColumnId.entrySet()) {
                final String columnId = columnEntry.getKey() + i;
                final String expectedText = columnEntry.getValue();
                final FindElementAction.Builder elementAction = SeleniumActionBuilder.selenium().browser(
                        browser()).find().element("id", columnId).displayed(
                        StringUtils.hasText(expectedText)).text(expectedText);
                elementActions.add(EchoAction.Builder.echo(
                        String.format("should display table column with id = %s having value %s", columnId,
                                      expectedText)).build());
                elementActions.add(RepeatOnErrorUntilTrueTemplate.builder()
                                           .indexName(columnId)
                                           .maxRepeats(maxRepeatsOnError)
                                           .autoSleep(autoSleep)
                                           .action(elementAction)
                                           .build());
            }
        }
        runner.run(Sequence.Builder.sequential().actions(elementActions.toArray(new TestAction[0])));

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions