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

34 lines
1,020 B
JavaScript
Raw Normal View History

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(),
id: attribute('id'),
2018-08-28 05:03:55 +00:00
}),
type: fillable('[name="mount-type"]'),
async selectType(type) {
return this.types.filterBy('id', 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) {
await this.next()
.path(path)
.submit();
} else {
await this.next().submit();
2018-08-28 05:03:55 +00:00
}
},
2018-04-03 14:16:57 +00:00
};