2023-03-14 13:18:55 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2022-09-15 08:43:17 +00:00
|
|
|
export default function (scenario, find, click) {
|
2019-02-21 13:05:05 +00:00
|
|
|
scenario
|
2022-09-15 08:43:17 +00:00
|
|
|
.when('I click "$selector"', function (selector) {
|
2019-02-21 13:05:05 +00:00
|
|
|
return click(selector);
|
|
|
|
})
|
|
|
|
// TODO: Probably nicer to think of better vocab than having the 'without " rule'
|
2020-11-11 16:59:15 +00:00
|
|
|
.when(
|
|
|
|
[
|
|
|
|
'I click (?!")$property(?!")',
|
|
|
|
'I click $property on the $component',
|
|
|
|
'I click $property on the $component component',
|
|
|
|
],
|
2022-09-15 08:43:17 +00:00
|
|
|
async function (property, component, next) {
|
2020-12-14 15:28:35 +00:00
|
|
|
if (typeof component === 'string') {
|
|
|
|
property = `${component}.${property}`;
|
2019-05-01 18:09:29 +00:00
|
|
|
}
|
2022-09-15 08:43:17 +00:00
|
|
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
2020-12-14 15:28:35 +00:00
|
|
|
return find(property)();
|
2019-02-21 13:05:05 +00:00
|
|
|
}
|
2020-11-11 16:59:15 +00:00
|
|
|
);
|
2019-02-21 13:05:05 +00:00
|
|
|
}
|