Skip to content

Commit

Permalink
Invoke settings in test blocks only
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewvc committed Mar 21, 2020
1 parent 8b75416 commit 18a6cb6
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions x-pack/test/functional/apps/uptime/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,33 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
const es = getService('es');

describe('uptime settings page', () => {
const settingsPage = () => pageObjects.uptime.settings;
beforeEach('navigate to clean app root', async () => {
// make 10 checks
await makeChecks(es, 'myMonitor', 1, 1, 1);
await pageObjects.uptime.goToRoot();
});

const settingsPage = pageObjects.uptime.settings;

it('loads the default settings', async () => {
await pageObjects.uptime.settings.go();

const fields = await settingsPage.loadFields();
const fields = await settingsPage().loadFields();
expect(fields).to.eql(defaultDynamicSettings);
});

it('should disable the apply button when invalid or unchanged', async () => {
await pageObjects.uptime.settings.go();

// Disabled because it's the original value
expect(await settingsPage.applyButtonIsDisabled()).to.eql(true);
expect(await settingsPage().applyButtonIsDisabled()).to.eql(true);

// Enabled because it's a new, different, value
await settingsPage.changeHeartbeatIndicesInput('somethingNew');
expect(await settingsPage.applyButtonIsDisabled()).to.eql(false);
await settingsPage().changeHeartbeatIndicesInput('somethingNew');
expect(await settingsPage().applyButtonIsDisabled()).to.eql(false);

// Disabled because it's blank
await settingsPage.changeHeartbeatIndicesInput('');
expect(await settingsPage.applyButtonIsDisabled()).to.eql(true);
await settingsPage().changeHeartbeatIndicesInput('');
expect(await settingsPage().applyButtonIsDisabled()).to.eql(true);
});

it('changing index pattern setting is reflected elsewhere in UI', async () => {
Expand All @@ -55,8 +54,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
await pageObjects.uptime.settings.go();

const newFieldValues: DynamicSettings = { heartbeatIndices: 'new*' };
await settingsPage.changeHeartbeatIndicesInput(newFieldValues.heartbeatIndices);
await settingsPage.apply();
await settingsPage().changeHeartbeatIndicesInput(newFieldValues.heartbeatIndices);
await settingsPage().apply();

await pageObjects.uptime.goToRoot();

Expand All @@ -65,7 +64,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {

// Verify that the settings page shows the value we previously saved
await pageObjects.uptime.settings.go();
const fields = await settingsPage.loadFields();
const fields = await settingsPage().loadFields();
expect(fields).to.eql(newFieldValues);
});
});
Expand Down

0 comments on commit 18a6cb6

Please sign in to comment.