Slide 53
Slide 53 text
import {
BrowseTheWebWithWebdriverIO
} from '@serenity-sj/webdriverio'
actorCalled('Shopkeeper')
.whoCan(
CallAnApi.using(axios),
BrowseTheWebWithWebdriverIO
.using(browser)
)
.attemptsTo(
setProductPrice('apples','$2.50'),
enableDeal('3-for-2', 'apples'),
)
Jan Molak | serenity-js.org
Alternative implementations
import {Task} from '@serenity-js/core'
import {Send, LastResponse, PostRequest} from '@serenity-js/rest'
import {Ensure, equals} from '@serenity-js/assertions'
const setProductPrice = (name, price)
=>
setProductPriceViaAdminUI(name, price)
const setProductPriceViaAdminApi = (name, price)
=>
//
…
const setProductPriceViaAdminUI = (name, price)
=>
Task.where(`#actor sets price of ${ name } at ${ price }`,
authenticateWithStoreAdminPanel(adminCredentials()),
openProductCatalog(),
findProductByName(name),
changeProductPrice(price),
)
The same test scenario,
interacting through
the web UI