jhedstrom / drupalextension

An integration layer between Behat, Mink Extension, and Drupal.
GNU General Public License v2.0
209 stars 192 forks source link

Creating a node with a certain URL alias #645

Open brockfanning opened 1 year ago

brockfanning commented 1 year ago

Hi all, does anyone know if any of the available step definitions allow for creating a node with a particular URL alias?

My goal is to create a node a certain field value and a certain URL alias, so that in the next step I can visit it. For example, something like:

Given page content:
  | title       | field_my_field | url_alias |
  | My title    | My field value | /my-alias |
And I am on "/my-alias"
...

But the above doesn't work for me (/my-alias appears to be a page-not-found).

Thank you for any tips!

kdahbi commented 1 year ago

Try to use field called "path":

And "test" content:
      | title           | field_valor   | body          | status | path |
      | Test title      | 10            | <p>Text</p>   | 1 | /path1 |
      | Test title 2    | 5             | <p>Text</p>   | 0 | /path2 |
    When I visit "/path1"
    Then response status code should be 200
    When I send a GET request to "/path1"    
    Then response status code should be 200