open-vault/ui/tests/pages/components/mount-backend-form.js

33 lines
1,005 B
JavaScript
Raw Normal View History

2018-08-28 05:03:55 +00:00
import { clickable, collection, fillable, text, value } from 'ember-cli-page-object';
2018-04-03 14:16:57 +00:00
import fields from './form-field';
import errorText from './message-in-page';
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(),
mountType: value(),
}),
type: fillable('[name="mount-type"]'),
async selectType(type) {
return this.types.filterBy('mountType', type)[0].select();
2018-08-28 05:03:55 +00:00
},
async mount(type, path) {
await this.selectType(type);
2018-08-28 05:03:55 +00:00
if (path) {
return this.next()
.path(path)
.submit();
2018-08-28 05:03:55 +00:00
}
return this.next().submit();
2018-08-28 05:03:55 +00:00
},
2018-04-03 14:16:57 +00:00
};