casper: Extract 12-custom-profile.

Breaking the Casper tests into smaller tests
will make it a lot easier in the future to
hone in on test flakes.

Having small tests adds little overhead--most
of the slowness comes from starting the server.
The only extra steps here are logging in and
entering "Manage Organization", which is two
lines of code.

We split out the custom profile test first,
since the code for custom profiles has the
annoying property that it can only run once
before failing, as it has the side effect
of creating a field name that can't be reused.
We only need to run loops to test flakes, so
this isn't an immediate blocker.
This commit is contained in:
Steve Howell 2020-04-10 10:48:09 +00:00 committed by showell
parent 19ca41c5e1
commit c2cf55ce1b
2 changed files with 62 additions and 50 deletions

View File

@ -282,56 +282,6 @@ casper.then(function () {
});
});
// Test custom profile fields
casper.test.info("Testing custom profile fields");
casper.thenClick("li[data-section='profile-field-settings']");
casper.then(function () {
casper.waitUntilVisible('.admin-profile-field-form', function () {
casper.fill('form.admin-profile-field-form', {
name: 'Teams',
field_type: '1',
});
casper.click("form.admin-profile-field-form button[type='submit']");
});
});
casper.then(function () {
casper.waitUntilVisible('#admin-add-profile-field-status img', function () {
casper.test.assertSelectorHasText('div#admin-add-profile-field-status', 'Saved');
});
casper.waitUntilVisible('.profile-field-row span.profile_field_name', function () {
casper.test.assertSelectorHasText('.profile-field-row span.profile_field_name', 'Teams');
casper.test.assertSelectorHasText('.profile-field-row span.profile_field_type', 'Short text');
casper.click('.profile-field-row button.open-edit-form');
});
});
casper.then(function () {
casper.waitUntilVisible('tr.profile-field-form form', function () {
casper.fill('tr.profile-field-form form.name-setting', {
name: 'team',
});
casper.click('tr.profile-field-form button.submit');
});
});
casper.then(function () {
casper.waitUntilVisible('#admin-profile-field-status img', function () {
casper.test.assertSelectorHasText('div#admin-profile-field-status', 'Saved');
});
casper.waitForSelectorTextChange('.profile-field-row span.profile_field_name', function () {
casper.test.assertSelectorHasText('.profile-field-row span.profile_field_name', 'team');
casper.test.assertSelectorHasText('.profile-field-row span.profile_field_type', 'Short text');
casper.click('.profile-field-row button.delete');
});
});
casper.then(function () {
casper.waitUntilVisible('#admin-profile-field-status img', function () {
casper.test.assertSelectorHasText('div#admin-profile-field-status', 'Saved');
});
});
// Test custom realm filters
casper.then(function () {
casper.click("li[data-section='filter-settings']");

View File

@ -0,0 +1,62 @@
var common = require('../casper_lib/common.js');
common.start_and_log_in();
common.manage_organization();
// Test custom profile fields
casper.test.info("Testing custom profile fields");
casper.thenClick("li[data-section='profile-field-settings']");
casper.then(function () {
casper.waitUntilVisible('.admin-profile-field-form', function () {
casper.fill('form.admin-profile-field-form', {
name: 'Teams',
field_type: '1',
});
casper.click("form.admin-profile-field-form button[type='submit']");
});
});
casper.then(function () {
casper.waitUntilVisible('#admin-add-profile-field-status img', function () {
casper.test.assertSelectorHasText('div#admin-add-profile-field-status', 'Saved');
});
casper.waitUntilVisible('.profile-field-row span.profile_field_name', function () {
casper.test.assertSelectorHasText('.profile-field-row span.profile_field_name', 'Teams');
casper.test.assertSelectorHasText('.profile-field-row span.profile_field_type', 'Short text');
casper.click('.profile-field-row button.open-edit-form');
});
});
casper.then(function () {
casper.waitUntilVisible('tr.profile-field-form form', function () {
casper.fill('tr.profile-field-form form.name-setting', {
name: 'team',
});
casper.click('tr.profile-field-form button.submit');
});
});
casper.then(function () {
casper.waitUntilVisible('#admin-profile-field-status img', function () {
casper.test.assertSelectorHasText('div#admin-profile-field-status', 'Saved');
});
casper.waitForSelectorTextChange('.profile-field-row span.profile_field_name', function () {
casper.test.assertSelectorHasText('.profile-field-row span.profile_field_name', 'team');
casper.test.assertSelectorHasText('.profile-field-row span.profile_field_type', 'Short text');
casper.click('.profile-field-row button.delete');
});
});
casper.then(function () {
casper.waitUntilVisible('#admin-profile-field-status img', function () {
casper.test.assertSelectorHasText('div#admin-profile-field-status', 'Saved');
});
});
common.then_log_out();
casper.run(function () {
casper.test.done();
});