Upload a file in the open media library dialog and save it as a media item with its alternative text (required for images): "Add file", the alternative text, "Save". The new item comes back selected in the library, ready for the core pack's "I insert the selected media". The path is relative to the project root. Works in the dialog a content form opens and in the one Canvas opens.
Examples
When I upload "tests/fixtures/sample.png" to the media library with the alternative text "A blue sample image"
And I upload "tests/fixtures/team.jpg" to the media library with the alternative text "The team in the office"
When we upload "tests/fixtures/logo.png" to the media library with the alternative text "Company logo"
And we upload "fixtures/banner.webp" to the media library with the alternative text "Spring campaign banner"
Given I upload "tests/fixtures/sample.png" to the media library with the alternative text "Sample"
Pattern
When(/^(I |we )*upload "([^"]*)" to the media library with the alternative text "([^"]*)"$/, …)
Part of @webship-js/drupal-cms-steps (github.com/webship/drupal-cms-steps), a step pack for Webship-js 2.0.x.