Skip to content

Commit

Permalink
Ad FormField to README
Browse files Browse the repository at this point in the history
  • Loading branch information
guncha25 committed Sep 25, 2018
1 parent b6a7c15 commit ec6eb4c
Showing 1 changed file with 56 additions and 2 deletions.
58 changes: 56 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ modules:
```

### Usage

Run drush config import and store output.

`$output = $i->runDrush('cim -y');`

Get one-time login url.
`$uri = $i->getLoginUri('userName');`

`$uri = $i->getLoginUri('userName');`

## Drupal Entity

Expand All @@ -69,16 +72,27 @@ modules:
```

### Usage

Create entities.

`$node = $i->createEntity('title => 'My node');`

`$term = $i->createEntity('name => 'My term', 'taxonomy_term');`

Delete all stored test entities.

`$i->doEntityCleanup();`

Register test entity.

`$i->registerTestEntity('node', '99');`

Register test entity by url.

`$i->registerTestEntityByUrl($i->grabFromCurrentUrl());`

Get entity by url.

`$entity = $i->getEntityFromUrl($i->grabFromCurrentUrl());`

## Drupal User
Expand Down Expand Up @@ -108,11 +122,17 @@ modules:
```

### Usage

Create test user with specified roles.

`$user = $i->createUserWithRoles(['editor', 'authenticated'], 'password');`

Log in user by username.

`$i->loginAs('userName');`

Create new user with certain role and login.

`$i->logInWithRole('administrator');`


Expand All @@ -135,7 +155,41 @@ modules:
```

### Usage

Clean logs.

`$i->prepareLogWatch();`

Check logs.
`$i->checkLogs();`

`$i->checkLogs();`

## Drupal Fields Utility

Provides xpath builder object for drupal specific form field xpath retrieval.

Includes:
- FormField: Fields that can be set to cardinality unlimited
- MTOFormField: Single value fields.
- ParagraphFormField: Paragraph form fields.

### Usage

Create paragraph field with machine name field_page_elements.

`$page_elements = ParagraphFormField:field_page_elements();`

Get nex paragraph.

`$page_elements->next();`

Fill title field value from field page elements.

`$i->fillField(FormField::title($page_elements)->value);`

Add new paragraph of type liftup_element.

```
$i->click($page_elements->addMore('liftup_element'));
$i->waitForElementVisible($page_elements->getCurrent('Subform'));
```

0 comments on commit ec6eb4c

Please sign in to comment.