✅ Add E2E for basic settings dialog behaviour
This commit is contained in:
1 parent
c9186edd34
commit
a846fd8f83
3 files changed
+62
-5
No files matched your search
@@ -1,6 +1,6 @@
|
||||
<div id="settings_dialog" class="modal hide fade large" tabindex="-1" role="dialog" aria-labelledby="settings_dialog_label" aria-hidden="true">
|
||||
<div id="settings_dialog" data-test-id="settings-dialog" class="modal hide fade large" tabindex="-1" role="dialog" aria-labelledby="settings_dialog_label" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<button type="button" data-test-id="settings-close-x" class="close" data-dismiss="modal">×</button>
|
||||
<h3 id="settings_dialog_label">{{ _('OctoPrint Settings') }} <i class="fa fa-spinner fa-spin" data-bind="visible: receiving"></i></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
@@ -49,8 +49,8 @@
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn aboutlink" data-bind="click: about.show"><i class="fa fa-info-circle"></i> {{ _('About OctoPrint') }}</button>
|
||||
<button class="btn" data-bind="click: function() { cancelData() }" aria-hidden="true">{{ _('Close') }}</button>
|
||||
<button class="btn btn-primary" data-bind="click: function() { saveData(undefined, $root.hide) }, enable: !exchanging(), css: {disabled: exchanging()}"><i class="fa fa-spinner fa-spin" data-bind="visible: sending"></i> {{ _('Save') }}</button>
|
||||
<button class="btn" data-test-id="settings-close-button" data-bind="click: function() { cancelData() }" aria-hidden="true">{{ _('Close') }}</button>
|
||||
<button class="btn btn-primary" data-test-id="settings-save" data-bind="click: function() { saveData(undefined, $root.hide) }, enable: !exchanging(), css: {disabled: exchanging()}"><i class="fa fa-spinner fa-spin" data-bind="visible: sending"></i> {{ _('Save') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<a id="navbar_show_settings" title="{{ _('Settings')|edq }}" class="pull-right" href="#settings_dialog" data-bind="click: function() { $root.show(); }">
|
||||
<a id="navbar_show_settings" data-test-id="settings-open" title="{{ _('Settings')|edq }}" class="pull-right" href="#settings_dialog" data-bind="click: function() { $root.show(); }">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
@@ -0,0 +1,57 @@
|
||||
import { prepare_server, login, disconnect, await_coreui } from "../util/util"
|
||||
|
||||
context('Test settings dialog opens and closes', () => {
|
||||
const username = 'admin';
|
||||
const password = 'test';
|
||||
|
||||
beforeEach(() => {
|
||||
prepare_server();
|
||||
|
||||
// login
|
||||
login(username, password);
|
||||
|
||||
cy.visit('/');
|
||||
await_coreui();
|
||||
});
|
||||
|
||||
it('opens settings', () => {
|
||||
cy.get('[data-test-id=settings-open]')
|
||||
.click();
|
||||
cy.get('[data-test-id=settings-dialog]')
|
||||
.should('be.visible');
|
||||
});
|
||||
|
||||
describe('close settings', () => {
|
||||
beforeEach(() => {
|
||||
cy.get('[data-test-id=settings-open]')
|
||||
.click();
|
||||
cy.get('[data-test-id=settings-dialog]')
|
||||
.should('be.visible');
|
||||
});
|
||||
|
||||
it('closes settings via button', () => {
|
||||
cy.get('[data-test-id=settings-close-button')
|
||||
.click();
|
||||
});
|
||||
|
||||
it('closes settings via x', () => {
|
||||
cy.get('[data-test-id=settings-close-x')
|
||||
.click({ force: true });
|
||||
});
|
||||
|
||||
it.skip('closes settings via click outside', () => {
|
||||
cy.get('body')
|
||||
.click();
|
||||
});
|
||||
|
||||
it.skip('closes settings via ESC', () => {
|
||||
cy.get('[data-test-id=settings-dialog]')
|
||||
.trigger('keydown', { key: 'Escape', which: 27, code: 'Escape' });
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
cy.get('[data-test-id=settings-dialog]')
|
||||
.should('not.be.visible');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user