2023-03-15 16:00:52 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2019-05-03 22:20:14 +00:00
|
|
|
import { clickable, collection, fillable, text, value, attribute } from 'ember-cli-page-object';
|
2018-04-03 14:16:57 +00:00
|
|
|
import fields from './form-field';
|
2018-11-02 16:02:45 +00:00
|
|
|
import errorText from './alert-banner';
|
2018-04-03 14:16:57 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
...fields,
|
|
|
|
...errorText,
|
|
|
|
header: text('[data-test-mount-form-header]'),
|
|
|
|
submit: clickable('[data-test-mount-submit]'),
|
2018-08-28 05:03:55 +00:00
|
|
|
next: clickable('[data-test-mount-next]'),
|
|
|
|
back: clickable('[data-test-mount-back]'),
|
2018-04-03 14:16:57 +00:00
|
|
|
path: fillable('[data-test-input="path"]'),
|
2018-08-28 05:03:55 +00:00
|
|
|
toggleOptions: clickable('[data-test-toggle-group="Method Options"]'),
|
2018-04-03 14:16:57 +00:00
|
|
|
pathValue: value('[data-test-input="path"]'),
|
2018-08-28 05:03:55 +00:00
|
|
|
types: collection('[data-test-mount-type-radio] input', {
|
|
|
|
select: clickable(),
|
2019-05-03 22:20:14 +00:00
|
|
|
id: attribute('id'),
|
2018-08-28 05:03:55 +00:00
|
|
|
}),
|
|
|
|
type: fillable('[name="mount-type"]'),
|
2018-09-25 16:28:26 +00:00
|
|
|
async selectType(type) {
|
2019-05-03 22:20:14 +00:00
|
|
|
return this.types.filterBy('id', type)[0].select();
|
2018-08-28 05:03:55 +00:00
|
|
|
},
|
2018-09-25 16:28:26 +00:00
|
|
|
async mount(type, path) {
|
|
|
|
await this.selectType(type);
|
2018-08-28 05:03:55 +00:00
|
|
|
if (path) {
|
2021-12-17 03:44:29 +00:00
|
|
|
await this.next().path(path).submit();
|
2019-04-10 14:36:32 +00:00
|
|
|
} else {
|
|
|
|
await this.next().submit();
|
2018-08-28 05:03:55 +00:00
|
|
|
}
|
|
|
|
},
|
2018-04-03 14:16:57 +00:00
|
|
|
};
|