Upload a test file through the API, whatever the wiki warns (a duplicate, a name in use): the file is deleted after the scenario. The local file is a path from the project, or from this pack (tests/fixtures/ ships with it).
Examples
Given the file "Test square.png" is uploaded from "tests/fixtures/blue-square.png"
Given the file "Second square.png" is uploaded from "tests/fixtures/blue-square.png"
And the file "Test square.png" is uploaded from "tests/fixtures/blue-square.png"
Given the file "Duplicate source.png" is uploaded from "tests/fixtures/blue-square.png"
Given the file "Reading test image.png" is uploaded from "tests/fixtures/blue-square.png"
Pattern
Given(/^the file "([^"]*)" is uploaded from "([^"]*)"$/, …)
Part of @webship-js/mediawiki-steps (github.com/webship/mediawiki-steps), a step pack for Webship-js 2.0.x.