mirror of
https://github.com/google/nomulus.git
synced 2025-07-09 12:43:24 +02:00
Move the Javascript tests to use Jasmine/Karma
This commit is contained in:
parent
e378855093
commit
b644a9f4c9
12 changed files with 4012 additions and 689 deletions
|
@ -558,6 +558,15 @@ compileProdJS.dependsOn processTestResources
|
||||||
compileProdJS.dependsOn soyToJS
|
compileProdJS.dependsOn soyToJS
|
||||||
assemble.dependsOn compileProdJS
|
assemble.dependsOn compileProdJS
|
||||||
|
|
||||||
|
task karmaTest(type: Exec) {
|
||||||
|
dependsOn ':npmInstall'
|
||||||
|
workingDir rootProject.projectDir
|
||||||
|
executable 'node_modules/karma/bin/karma'
|
||||||
|
args('start')
|
||||||
|
}
|
||||||
|
|
||||||
|
test.dependsOn karmaTest
|
||||||
|
|
||||||
// Make testing artifacts available to be depended up on by other projects.
|
// Make testing artifacts available to be depended up on by other projects.
|
||||||
// TODO: factor out google.registry.testing to be a separate project.
|
// TODO: factor out google.registry.testing to be a separate project.
|
||||||
task testJar(type: Jar) {
|
task testJar(type: Jar) {
|
||||||
|
|
|
@ -16,28 +16,25 @@ goog.setTestOnly();
|
||||||
|
|
||||||
goog.require('goog.dispose');
|
goog.require('goog.dispose');
|
||||||
goog.require('goog.testing.MockControl');
|
goog.require('goog.testing.MockControl');
|
||||||
goog.require('goog.testing.jsunit');
|
|
||||||
goog.require('registry.Component');
|
goog.require('registry.Component');
|
||||||
goog.require('registry.Console');
|
goog.require('registry.Console');
|
||||||
|
|
||||||
|
describe("component test", function() {
|
||||||
|
let mocks;
|
||||||
|
|
||||||
var mocks = new goog.testing.MockControl();
|
beforeEach(function() {
|
||||||
|
mocks = new goog.testing.MockControl();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(function() {
|
||||||
|
mocks.$tearDown();
|
||||||
|
});
|
||||||
|
|
||||||
function setUp() {
|
it("testCreationAndDisposal_dontTouchConsoleObject", function() {
|
||||||
mocks = new goog.testing.MockControl();
|
var console = mocks.createStrictMock(registry.Console);
|
||||||
}
|
mocks.$replayAll();
|
||||||
|
var component = new registry.Component(console);
|
||||||
|
goog.dispose(component);
|
||||||
function tearDown() {
|
mocks.$verifyAll();
|
||||||
mocks.$tearDown();
|
});
|
||||||
}
|
});
|
||||||
|
|
||||||
|
|
||||||
function testCreationAndDisposal_dontTouchConsoleObject() {
|
|
||||||
var console = mocks.createStrictMock(registry.Console);
|
|
||||||
mocks.$replayAll();
|
|
||||||
var component = new registry.Component(console);
|
|
||||||
goog.dispose(component);
|
|
||||||
mocks.$verifyAll();
|
|
||||||
}
|
|
||||||
|
|
|
@ -19,112 +19,105 @@ goog.require('goog.dom.classlist');
|
||||||
goog.require('goog.json');
|
goog.require('goog.json');
|
||||||
goog.require('goog.testing.MockControl');
|
goog.require('goog.testing.MockControl');
|
||||||
goog.require('goog.testing.PropertyReplacer');
|
goog.require('goog.testing.PropertyReplacer');
|
||||||
goog.require('goog.testing.asserts');
|
|
||||||
goog.require('goog.testing.jsunit');
|
|
||||||
goog.require('goog.testing.net.XhrIo');
|
goog.require('goog.testing.net.XhrIo');
|
||||||
goog.require('registry.registrar.ConsoleTestUtil');
|
goog.require('registry.registrar.ConsoleTestUtil');
|
||||||
goog.require('registry.testing');
|
goog.require('registry.testing');
|
||||||
goog.require('registry.util');
|
goog.require('registry.util');
|
||||||
|
|
||||||
|
describe("console tests", function() {
|
||||||
|
const $ = goog.dom.getRequiredElement;
|
||||||
|
const stubs = new goog.testing.PropertyReplacer();
|
||||||
|
|
||||||
const $ = goog.dom.getRequiredElement;
|
const test = {
|
||||||
const stubs = new goog.testing.PropertyReplacer();
|
testXsrfToken: 'testToken',
|
||||||
|
testClientId: 'daddy',
|
||||||
|
mockControl: new goog.testing.MockControl()
|
||||||
|
};
|
||||||
|
|
||||||
const test = {
|
beforeEach(function() {
|
||||||
testXsrfToken: 'testToken',
|
registry.testing.addToDocument('<div id="test"/>');
|
||||||
testClientId: 'daddy',
|
registry.testing.addToDocument('<div class="kd-butterbar"/>');
|
||||||
mockControl: new goog.testing.MockControl()
|
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
|
||||||
};
|
registry.registrar.ConsoleTestUtil.renderConsoleMain($('test'), {
|
||||||
|
xsrfToken: test.testXsrfToken,
|
||||||
|
clientId: test.testClientId,
|
||||||
function setUp() {
|
});
|
||||||
registry.testing.addToDocument('<div id="test"/>');
|
registry.registrar.ConsoleTestUtil.setup(test);
|
||||||
registry.testing.addToDocument('<div class="kd-butterbar"/>');
|
const regNavlist = $('reg-navlist');
|
||||||
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
|
const active = regNavlist.querySelector('a[href="#contact-us"]');
|
||||||
registry.registrar.ConsoleTestUtil.renderConsoleMain($('test'), {
|
expect(active).not.toBeNull();
|
||||||
xsrfToken: test.testXsrfToken,
|
|
||||||
clientId: test.testClientId,
|
|
||||||
});
|
});
|
||||||
registry.registrar.ConsoleTestUtil.setup(test);
|
|
||||||
const regNavlist = $('reg-navlist');
|
|
||||||
const active = regNavlist.querySelector('a[href="#contact-us"]');
|
|
||||||
assertTrue(active != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
afterEach(function() {
|
||||||
function tearDown() {
|
goog.testing.net.XhrIo.cleanup();
|
||||||
goog.testing.net.XhrIo.cleanup();
|
stubs.reset();
|
||||||
stubs.reset();
|
test.mockControl.$tearDown();
|
||||||
test.mockControl.$tearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function testButter() {
|
|
||||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
|
||||||
productName: 'Foo Registry'
|
|
||||||
});
|
});
|
||||||
registry.util.butter('butter msg');
|
|
||||||
const butter = goog.dom.getElementByClass(goog.getCssName('kd-butterbar'));
|
|
||||||
assertNotNull(butter.innerHTML.match(/.*butter msg.*/));
|
|
||||||
assertTrue(goog.dom.classlist.contains(butter, goog.getCssName('shown')));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
it("testButter", function() {
|
||||||
/** Authed user with no path op specified should nav to welcome page. */
|
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||||
function testShowLoginOrDash() {
|
productName: 'Foo Registry'
|
||||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
});
|
||||||
productName: 'Foo Registry'
|
registry.util.butter('butter msg');
|
||||||
|
const butter = goog.dom.getElementByClass(goog.getCssName('kd-butterbar'));
|
||||||
|
expect(butter.innerHTML.match(/.*butter msg.*/)).not.toBeNull();
|
||||||
|
expect(goog.dom.classlist.contains(butter, goog.getCssName('shown'))).toBe(true);
|
||||||
});
|
});
|
||||||
assertNotNull(goog.dom.getElement('domain-registrar-dashboard'));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/** Authed user with no path op specified should nav to welcome page. */
|
||||||
function testNavToResources() {
|
it("testShowLoginOrDash", function() {
|
||||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||||
path: 'resources',
|
productName: 'Foo Registry'
|
||||||
xsrfToken: test.testXsrfToken,
|
});
|
||||||
technicalDocsUrl: 'http://example.com/techdocs',
|
expect(goog.dom.getElement('domain-registrar-dashboard')).not.toBeNull();
|
||||||
readonly: true,
|
|
||||||
});
|
});
|
||||||
const xhr = goog.testing.net.XhrIo.getSendInstances().pop();
|
|
||||||
assertTrue(xhr.isActive());
|
|
||||||
assertEquals('/registrar-settings', xhr.getLastUri());
|
|
||||||
assertEquals(test.testXsrfToken,
|
|
||||||
xhr.getLastRequestHeaders()['X-CSRF-Token']);
|
|
||||||
xhr.simulateResponse(200, goog.json.serialize({
|
|
||||||
status: 'SUCCESS',
|
|
||||||
message: 'OK',
|
|
||||||
results: [{
|
|
||||||
driveFolderId: 'blahblah'
|
|
||||||
}]
|
|
||||||
}));
|
|
||||||
assertContains('blahblah', $('reg-resources-driveLink').getAttribute('href'));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
it("testNavToResources", function() {
|
||||||
function testNavToContactUs() {
|
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
path: 'resources',
|
||||||
path: 'contact-us',
|
xsrfToken: test.testXsrfToken,
|
||||||
xsrfToken: test.testXsrfToken,
|
technicalDocsUrl: 'http://example.com/techdocs',
|
||||||
productName: 'Domain Registry',
|
readonly: true,
|
||||||
integrationEmail: 'integration@example.com',
|
});
|
||||||
supportEmail: 'support@example.com',
|
const xhr = goog.testing.net.XhrIo.getSendInstances().pop();
|
||||||
announcementsEmail: 'announcement@example.com',
|
expect(xhr.isActive()).toBe(true);
|
||||||
supportPhoneNumber: '+1 (888) 555 0123'
|
expect('/registrar-settings').toEqual(xhr.getLastUri());
|
||||||
|
expect(test.testXsrfToken).toEqual(
|
||||||
|
xhr.getLastRequestHeaders()['X-CSRF-Token']);
|
||||||
|
xhr.simulateResponse(200, goog.json.serialize({
|
||||||
|
status: 'SUCCESS',
|
||||||
|
message: 'OK',
|
||||||
|
results: [{
|
||||||
|
driveFolderId: 'blahblah'
|
||||||
|
}]
|
||||||
|
}));
|
||||||
|
expect($('reg-resources-driveLink').getAttribute('href')).toContain('blahblah');
|
||||||
});
|
});
|
||||||
const xhr = goog.testing.net.XhrIo.getSendInstances().pop();
|
|
||||||
assertTrue(xhr.isActive());
|
it("testNavToContactUs", function() {
|
||||||
assertEquals('/registrar-settings', xhr.getLastUri());
|
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||||
assertEquals(test.testXsrfToken,
|
path: 'contact-us',
|
||||||
xhr.getLastRequestHeaders()['X-CSRF-Token']);
|
xsrfToken: test.testXsrfToken,
|
||||||
const passcode = '5-5-5-5-5';
|
productName: 'Domain Registry',
|
||||||
xhr.simulateResponse(200, goog.json.serialize({
|
integrationEmail: 'integration@example.com',
|
||||||
status: 'SUCCESS',
|
supportEmail: 'support@example.com',
|
||||||
message: 'OK',
|
announcementsEmail: 'announcement@example.com',
|
||||||
results: [{
|
supportPhoneNumber: '+1 (888) 555 0123'
|
||||||
phonePasscode: passcode
|
});
|
||||||
}]
|
const xhr = goog.testing.net.XhrIo.getSendInstances().pop();
|
||||||
}));
|
expect(xhr.isActive()).toBe(true);
|
||||||
assertEquals(passcode,
|
expect('/registrar-settings').toEqual(xhr.getLastUri());
|
||||||
goog.dom.getTextContent($('domain-registrar-phone-passcode')));
|
expect(test.testXsrfToken).toEqual(
|
||||||
}
|
xhr.getLastRequestHeaders()['X-CSRF-Token']);
|
||||||
|
const passcode = '5-5-5-5-5';
|
||||||
|
xhr.simulateResponse(200, goog.json.serialize({
|
||||||
|
status: 'SUCCESS',
|
||||||
|
message: 'OK',
|
||||||
|
results: [{
|
||||||
|
phonePasscode: passcode
|
||||||
|
}]
|
||||||
|
}));
|
||||||
|
expect(passcode).toEqual(
|
||||||
|
goog.dom.getTextContent($('domain-registrar-phone-passcode')));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -19,353 +19,347 @@ goog.require('goog.dispose');
|
||||||
goog.require('goog.dom');
|
goog.require('goog.dom');
|
||||||
goog.require('goog.testing.MockControl');
|
goog.require('goog.testing.MockControl');
|
||||||
goog.require('goog.testing.PropertyReplacer');
|
goog.require('goog.testing.PropertyReplacer');
|
||||||
goog.require('goog.testing.asserts');
|
|
||||||
goog.require('goog.testing.jsunit');
|
|
||||||
goog.require('goog.testing.net.XhrIo');
|
goog.require('goog.testing.net.XhrIo');
|
||||||
goog.require('registry.registrar.ConsoleTestUtil');
|
goog.require('registry.registrar.ConsoleTestUtil');
|
||||||
goog.require('registry.testing');
|
goog.require('registry.testing');
|
||||||
goog.require('registry.util');
|
goog.require('registry.util');
|
||||||
|
|
||||||
|
describe("contact settings test", function() {
|
||||||
|
const $ = goog.dom.getRequiredElement;
|
||||||
|
const stubs = new goog.testing.PropertyReplacer();
|
||||||
|
let testContact = null;
|
||||||
|
|
||||||
const $ = goog.dom.getRequiredElement;
|
const test = {
|
||||||
const stubs = new goog.testing.PropertyReplacer();
|
testXsrfToken: '༼༎෴ ༎༽',
|
||||||
let testContact = null;
|
testClientId: 'testClientId',
|
||||||
|
mockControl: new goog.testing.MockControl()
|
||||||
const test = {
|
|
||||||
testXsrfToken: '༼༎෴ ༎༽',
|
|
||||||
testClientId: 'testClientId',
|
|
||||||
mockControl: new goog.testing.MockControl()
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
function setUp() {
|
|
||||||
registry.testing.addToDocument('<div id="test"/>');
|
|
||||||
registry.testing.addToDocument('<div class="kd-butterbar"/>');
|
|
||||||
testContact = createTestContact();
|
|
||||||
registry.registrar.ConsoleTestUtil.renderConsoleMain($('test'), {
|
|
||||||
xsrfToken: test.testXsrfToken,
|
|
||||||
clientId: test.testClientId,
|
|
||||||
});
|
|
||||||
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
|
|
||||||
registry.registrar.ConsoleTestUtil.setup(test);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function tearDown() {
|
|
||||||
goog.dispose(test.console);
|
|
||||||
goog.testing.net.XhrIo.cleanup();
|
|
||||||
stubs.reset();
|
|
||||||
test.mockControl.$tearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function testCollectionView() {
|
|
||||||
testContactWithoutType = createTestContact('notype@example.com');
|
|
||||||
testContactWithoutType.types = '';
|
|
||||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
|
||||||
path: 'contact-settings',
|
|
||||||
xsrfToken: test.testXsrfToken,
|
|
||||||
clientId: test.testClientId
|
|
||||||
});
|
|
||||||
registry.testing.assertReqMockRsp(
|
|
||||||
test.testXsrfToken,
|
|
||||||
'/registrar-settings',
|
|
||||||
{op: 'read', id: 'testClientId', args: {}},
|
|
||||||
{
|
|
||||||
status: 'SUCCESS',
|
|
||||||
message: 'OK',
|
|
||||||
results: [{
|
|
||||||
contacts: [testContact, testContactWithoutType]
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
);
|
|
||||||
assertEquals(1, $('admin-contacts').childNodes.length);
|
|
||||||
assertEquals(1, $('other-contacts').childNodes.length);
|
|
||||||
// XXX: Needs more field testing.
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function testItemView() {
|
|
||||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
|
||||||
path: 'contact-settings/test@example.com',
|
|
||||||
xsrfToken: test.testXsrfToken,
|
|
||||||
clientId: test.testClientId
|
|
||||||
});
|
|
||||||
registry.testing.assertReqMockRsp(
|
|
||||||
test.testXsrfToken,
|
|
||||||
'/registrar-settings',
|
|
||||||
{op: 'read', id: 'testClientId', args: {}},
|
|
||||||
{
|
|
||||||
status: 'SUCCESS',
|
|
||||||
message: 'OK',
|
|
||||||
results: [{
|
|
||||||
contacts: [testContact]
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
);
|
|
||||||
assertEquals(testContact.name, $('contacts[0].name').value);
|
|
||||||
assertEquals(testContact.emailAddress, $('contacts[0].emailAddress').value);
|
|
||||||
assertEquals(testContact.phoneNumber, $('contacts[0].phoneNumber').value);
|
|
||||||
assertEquals(testContact.faxNumber, $('contacts[0].faxNumber').value);
|
|
||||||
// XXX: Types are no longer broken out as individual settings, so relying on
|
|
||||||
// screenshot test.
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// XXX: Should be hoisted.
|
|
||||||
function testItemEditButtons() {
|
|
||||||
testItemView();
|
|
||||||
registry.testing.assertVisible($('reg-app-btns-edit'));
|
|
||||||
registry.testing.assertHidden($('reg-app-btns-save'));
|
|
||||||
registry.testing.click($('reg-app-btn-edit'));
|
|
||||||
registry.testing.assertHidden($('reg-app-btns-edit'));
|
|
||||||
registry.testing.assertVisible($('reg-app-btns-save'));
|
|
||||||
registry.testing.click($('reg-app-btn-cancel'));
|
|
||||||
registry.testing.assertVisible($('reg-app-btns-edit'));
|
|
||||||
registry.testing.assertHidden($('reg-app-btns-save'));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function testItemEdit() {
|
|
||||||
testItemView();
|
|
||||||
registry.testing.click($('reg-app-btn-edit'));
|
|
||||||
$('contacts[0].name').setAttribute('value', 'bob');
|
|
||||||
registry.testing.click($('reg-app-btn-save'));
|
|
||||||
testContact.name = 'bob';
|
|
||||||
registry.testing.assertReqMockRsp(
|
|
||||||
test.testXsrfToken,
|
|
||||||
'/registrar-settings',
|
|
||||||
{
|
|
||||||
op: 'update',
|
|
||||||
id: 'testClientId',
|
|
||||||
args: {
|
|
||||||
contacts: [testContact],
|
|
||||||
readonly: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
status: 'SUCCESS',
|
|
||||||
message: 'OK',
|
|
||||||
results: [{
|
|
||||||
contacts: [testContact]
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
);
|
|
||||||
registry.testing.assertObjectEqualsPretty(
|
|
||||||
testContact,
|
|
||||||
simulateJsonForContact(registry.util.parseForm('item').contacts[0]));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function testChangeContactTypes() {
|
|
||||||
testItemView();
|
|
||||||
registry.testing.click($('reg-app-btn-edit'));
|
|
||||||
$('contacts[0].type.admin').removeAttribute('checked');
|
|
||||||
$('contacts[0].type.legal').setAttribute('checked', 'checked');
|
|
||||||
$('contacts[0].type.marketing').setAttribute('checked', 'checked');
|
|
||||||
registry.testing.click($('reg-app-btn-save'));
|
|
||||||
testContact.types = 'LEGAL,MARKETING';
|
|
||||||
registry.testing.assertReqMockRsp(
|
|
||||||
test.testXsrfToken,
|
|
||||||
'/registrar-settings',
|
|
||||||
{
|
|
||||||
op: 'update',
|
|
||||||
id: 'testClientId',
|
|
||||||
args: {
|
|
||||||
contacts: [testContact],
|
|
||||||
readonly: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
status: 'SUCCESS',
|
|
||||||
message: 'OK',
|
|
||||||
results: [{
|
|
||||||
contacts: [testContact]
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
);
|
|
||||||
registry.testing.assertObjectEqualsPretty(
|
|
||||||
testContact,
|
|
||||||
simulateJsonForContact(registry.util.parseForm('item').contacts[0]));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function testOneOfManyUpdate() {
|
|
||||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
|
||||||
path: 'contact-settings/test@example.com',
|
|
||||||
xsrfToken: test.testXsrfToken,
|
|
||||||
clientId: test.testClientId
|
|
||||||
});
|
|
||||||
const testContacts = [
|
|
||||||
createTestContact('new1@asdf.com'),
|
|
||||||
testContact,
|
|
||||||
createTestContact('new2@asdf.com')
|
|
||||||
];
|
|
||||||
registry.testing.assertReqMockRsp(
|
|
||||||
test.testXsrfToken,
|
|
||||||
'/registrar-settings',
|
|
||||||
{op: 'read', id: 'testClientId', args: {}},
|
|
||||||
{
|
|
||||||
status: 'SUCCESS',
|
|
||||||
message: 'OK',
|
|
||||||
results: [{
|
|
||||||
contacts: testContacts
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
);
|
|
||||||
// Edit testContact.
|
|
||||||
registry.testing.click($('reg-app-btn-edit'));
|
|
||||||
$('contacts[1].type.admin').removeAttribute('checked');
|
|
||||||
$('contacts[1].type.legal').setAttribute('checked', 'checked');
|
|
||||||
$('contacts[1].type.marketing').setAttribute('checked', 'checked');
|
|
||||||
registry.testing.click($('reg-app-btn-save'));
|
|
||||||
|
|
||||||
// Should save them all back, with only testContact changed.
|
|
||||||
testContacts[1].types = 'LEGAL,MARKETING';
|
|
||||||
registry.testing.assertReqMockRsp(
|
|
||||||
test.testXsrfToken,
|
|
||||||
'/registrar-settings',
|
|
||||||
{
|
|
||||||
op: 'update',
|
|
||||||
id: 'testClientId',
|
|
||||||
args: {
|
|
||||||
contacts: testContacts,
|
|
||||||
readonly: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
status: 'SUCCESS',
|
|
||||||
message: 'OK',
|
|
||||||
results: [{
|
|
||||||
contacts: testContacts
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function testDomainWhoisAbuseContactOverride() {
|
|
||||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
|
||||||
path: 'contact-settings/test@example.com',
|
|
||||||
xsrfToken: test.testXsrfToken,
|
|
||||||
clientId: test.testClientId
|
|
||||||
});
|
|
||||||
const oldDomainWhoisAbuseContact = createTestContact('old@asdf.com');
|
|
||||||
oldDomainWhoisAbuseContact.visibleInDomainWhoisAsAbuse = true;
|
|
||||||
const testContacts = [oldDomainWhoisAbuseContact, testContact];
|
|
||||||
registry.testing.assertReqMockRsp(
|
|
||||||
test.testXsrfToken,
|
|
||||||
'/registrar-settings',
|
|
||||||
{op: 'read', id: 'testClientId', args: {}},
|
|
||||||
{status: 'SUCCESS', message: 'OK', results: [{contacts: testContacts}]});
|
|
||||||
// Edit testContact.
|
|
||||||
registry.testing.click($('reg-app-btn-edit'));
|
|
||||||
$('contacts[1].visibleInDomainWhoisAsAbuse.true')
|
|
||||||
.setAttribute('checked', 'checked');
|
|
||||||
$('contacts[1].visibleInDomainWhoisAsAbuse.false').removeAttribute('checked');
|
|
||||||
registry.testing.click($('reg-app-btn-save'));
|
|
||||||
|
|
||||||
// Should save them all back, and flip the old abuse contact's visibility
|
|
||||||
// boolean.
|
|
||||||
testContact.visibleInDomainWhoisAsAbuse = true;
|
|
||||||
oldDomainWhoisAbuseContact.visibleInDomainWhoisAsAbuse = false;
|
|
||||||
registry.testing.assertReqMockRsp(
|
|
||||||
test.testXsrfToken,
|
|
||||||
'/registrar-settings',
|
|
||||||
{
|
|
||||||
op: 'update',
|
|
||||||
id: 'testClientId',
|
|
||||||
args: {contacts: testContacts, readonly: false},
|
|
||||||
},
|
|
||||||
{status: 'SUCCESS', message: 'OK', results: [{contacts: testContacts}]});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function testDelete() {
|
|
||||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
|
||||||
path: 'contact-settings/test@example.com',
|
|
||||||
xsrfToken: test.testXsrfToken,
|
|
||||||
clientId: test.testClientId
|
|
||||||
});
|
|
||||||
const testContacts = [
|
|
||||||
createTestContact('new1@asdf.com'),
|
|
||||||
testContact,
|
|
||||||
createTestContact('new2@asdf.com')
|
|
||||||
];
|
|
||||||
registry.testing.assertReqMockRsp(
|
|
||||||
test.testXsrfToken,
|
|
||||||
'/registrar-settings',
|
|
||||||
{op: 'read', id: 'testClientId', args: {}},
|
|
||||||
{
|
|
||||||
status: 'SUCCESS',
|
|
||||||
message: 'OK',
|
|
||||||
results: [{
|
|
||||||
contacts: testContacts
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
);
|
|
||||||
// Delete testContact.
|
|
||||||
registry.testing.click($('reg-app-btn-edit'));
|
|
||||||
registry.testing.click($('reg-app-btn-delete'));
|
|
||||||
|
|
||||||
// Should save them all back, with testContact gone.
|
|
||||||
goog.array.removeAt(testContacts, 1);
|
|
||||||
registry.testing.assertReqMockRsp(
|
|
||||||
test.testXsrfToken,
|
|
||||||
'/registrar-settings',
|
|
||||||
{
|
|
||||||
op: 'update',
|
|
||||||
id: 'testClientId',
|
|
||||||
args: {contacts: testContacts, readonly: false},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
status: 'SUCCESS',
|
|
||||||
message: 'OK',
|
|
||||||
results: [{
|
|
||||||
contacts: testContacts
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string=} opt_email
|
|
||||||
* @return {!Object}
|
|
||||||
*/
|
|
||||||
function createTestContact(opt_email) {
|
|
||||||
const nameMail = opt_email || 'test@example.com';
|
|
||||||
return {
|
|
||||||
name: nameMail,
|
|
||||||
emailAddress: nameMail,
|
|
||||||
phoneNumber: '+1.2345551234',
|
|
||||||
faxNumber: '+1.2345551234',
|
|
||||||
visibleInWhoisAsAdmin: false,
|
|
||||||
visibleInWhoisAsTech: false,
|
|
||||||
visibleInDomainWhoisAsAbuse: false,
|
|
||||||
types: 'ADMIN'
|
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
beforeEach(function() {
|
||||||
|
registry.testing.addToDocument('<div id="test"/>');
|
||||||
|
registry.testing.addToDocument('<div class="kd-butterbar"/>');
|
||||||
|
testContact = createTestContact();
|
||||||
|
registry.registrar.ConsoleTestUtil.renderConsoleMain($('test'), {
|
||||||
|
xsrfToken: test.testXsrfToken,
|
||||||
|
clientId: test.testClientId,
|
||||||
|
});
|
||||||
|
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
|
||||||
|
registry.registrar.ConsoleTestUtil.setup(test);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(function() {
|
||||||
|
goog.dispose(test.console);
|
||||||
|
goog.testing.net.XhrIo.cleanup();
|
||||||
|
stubs.reset();
|
||||||
|
test.mockControl.$tearDown();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("testCollectionView", function() {
|
||||||
|
testContactWithoutType = createTestContact('notype@example.com');
|
||||||
|
testContactWithoutType.types = '';
|
||||||
|
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||||
|
path: 'contact-settings',
|
||||||
|
xsrfToken: test.testXsrfToken,
|
||||||
|
clientId: test.testClientId
|
||||||
|
});
|
||||||
|
registry.testing.assertReqMockRsp(
|
||||||
|
test.testXsrfToken,
|
||||||
|
'/registrar-settings',
|
||||||
|
{op: 'read', id: 'testClientId', args: {}},
|
||||||
|
{
|
||||||
|
status: 'SUCCESS',
|
||||||
|
message: 'OK',
|
||||||
|
results: [{
|
||||||
|
contacts: [testContact, testContactWithoutType]
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
expect(1).toEqual($('admin-contacts').childNodes.length);
|
||||||
|
expect(1).toEqual($('other-contacts').childNodes.length);
|
||||||
|
// XXX: Needs more field testing.
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
it("testItemView", function() {
|
||||||
* Convert parsed formContact to simulated wire form.
|
testItemView();
|
||||||
* @param {!Element} contact
|
expect(testContact.name).toEqual($('contacts[0].name').value);
|
||||||
* @return {!Object}
|
expect(testContact.emailAddress).toEqual($('contacts[0].emailAddress').value);
|
||||||
*/
|
expect(testContact.phoneNumber).toEqual($('contacts[0].phoneNumber').value);
|
||||||
function simulateJsonForContact(contact) {
|
expect(testContact.faxNumber).toEqual($('contacts[0].faxNumber').value);
|
||||||
contact.visibleInWhoisAsAdmin = contact.visibleInWhoisAsAdmin == 'true';
|
// XXX: Types are no longer broken out as individual settings, so relying on
|
||||||
contact.visibleInWhoisAsTech = contact.visibleInWhoisAsTech == 'true';
|
// screenshot test.
|
||||||
contact.visibleInDomainWhoisAsAbuse = contact.visibleInDomainWhoisAsAbuse == 'true';
|
});
|
||||||
contact.types = '';
|
|
||||||
for (const tNdx in contact.type) {
|
// XXX: Should be hoisted.
|
||||||
if (contact.type[tNdx]) {
|
it("testItemEditButtons", function() {
|
||||||
if (contact.types.length > 0) {
|
testItemView();
|
||||||
contact.types += ',';
|
registry.testing.assertVisible($('reg-app-btns-edit'));
|
||||||
}
|
registry.testing.assertHidden($('reg-app-btns-save'));
|
||||||
contact.types += ('' + tNdx).toUpperCase();
|
registry.testing.click($('reg-app-btn-edit'));
|
||||||
}
|
registry.testing.assertHidden($('reg-app-btns-edit'));
|
||||||
|
registry.testing.assertVisible($('reg-app-btns-save'));
|
||||||
|
registry.testing.click($('reg-app-btn-cancel'));
|
||||||
|
registry.testing.assertVisible($('reg-app-btns-edit'));
|
||||||
|
registry.testing.assertHidden($('reg-app-btns-save'));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("testItemEdit", function() {
|
||||||
|
testItemView();
|
||||||
|
registry.testing.click($('reg-app-btn-edit'));
|
||||||
|
$('contacts[0].name').setAttribute('value', 'bob');
|
||||||
|
registry.testing.click($('reg-app-btn-save'));
|
||||||
|
testContact.name = 'bob';
|
||||||
|
registry.testing.assertReqMockRsp(
|
||||||
|
test.testXsrfToken,
|
||||||
|
'/registrar-settings',
|
||||||
|
{
|
||||||
|
op: 'update',
|
||||||
|
id: 'testClientId',
|
||||||
|
args: {
|
||||||
|
contacts: [testContact],
|
||||||
|
readonly: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
status: 'SUCCESS',
|
||||||
|
message: 'OK',
|
||||||
|
results: [{
|
||||||
|
contacts: [testContact]
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
registry.testing.assertObjectEqualsPretty(
|
||||||
|
testContact,
|
||||||
|
simulateJsonForContact(registry.util.parseForm('item').contacts[0]));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("testChangeContactTypes", function() {
|
||||||
|
testItemView();
|
||||||
|
registry.testing.click($('reg-app-btn-edit'));
|
||||||
|
$('contacts[0].type.admin').removeAttribute('checked');
|
||||||
|
$('contacts[0].type.legal').setAttribute('checked', 'checked');
|
||||||
|
$('contacts[0].type.marketing').setAttribute('checked', 'checked');
|
||||||
|
registry.testing.click($('reg-app-btn-save'));
|
||||||
|
testContact.types = 'LEGAL,MARKETING';
|
||||||
|
registry.testing.assertReqMockRsp(
|
||||||
|
test.testXsrfToken,
|
||||||
|
'/registrar-settings',
|
||||||
|
{
|
||||||
|
op: 'update',
|
||||||
|
id: 'testClientId',
|
||||||
|
args: {
|
||||||
|
contacts: [testContact],
|
||||||
|
readonly: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
status: 'SUCCESS',
|
||||||
|
message: 'OK',
|
||||||
|
results: [{
|
||||||
|
contacts: [testContact]
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
registry.testing.assertObjectEqualsPretty(
|
||||||
|
testContact,
|
||||||
|
simulateJsonForContact(registry.util.parseForm('item').contacts[0]));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("testOneOfManyUpdate", function() {
|
||||||
|
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||||
|
path: 'contact-settings/test@example.com',
|
||||||
|
xsrfToken: test.testXsrfToken,
|
||||||
|
clientId: test.testClientId
|
||||||
|
});
|
||||||
|
const testContacts = [
|
||||||
|
createTestContact('new1@asdf.com'),
|
||||||
|
testContact,
|
||||||
|
createTestContact('new2@asdf.com')
|
||||||
|
];
|
||||||
|
registry.testing.assertReqMockRsp(
|
||||||
|
test.testXsrfToken,
|
||||||
|
'/registrar-settings',
|
||||||
|
{op: 'read', id: 'testClientId', args: {}},
|
||||||
|
{
|
||||||
|
status: 'SUCCESS',
|
||||||
|
message: 'OK',
|
||||||
|
results: [{
|
||||||
|
contacts: testContacts
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
// Edit testContact.
|
||||||
|
registry.testing.click($('reg-app-btn-edit'));
|
||||||
|
$('contacts[1].type.admin').removeAttribute('checked');
|
||||||
|
$('contacts[1].type.legal').setAttribute('checked', 'checked');
|
||||||
|
$('contacts[1].type.marketing').setAttribute('checked', 'checked');
|
||||||
|
registry.testing.click($('reg-app-btn-save'));
|
||||||
|
|
||||||
|
// Should save them all back, with only testContact changed.
|
||||||
|
testContacts[1].types = 'LEGAL,MARKETING';
|
||||||
|
registry.testing.assertReqMockRsp(
|
||||||
|
test.testXsrfToken,
|
||||||
|
'/registrar-settings',
|
||||||
|
{
|
||||||
|
op: 'update',
|
||||||
|
id: 'testClientId',
|
||||||
|
args: {
|
||||||
|
contacts: testContacts,
|
||||||
|
readonly: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
status: 'SUCCESS',
|
||||||
|
message: 'OK',
|
||||||
|
results: [{
|
||||||
|
contacts: testContacts
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("testDomainWhoisAbuseContactOverride", function() {
|
||||||
|
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||||
|
path: 'contact-settings/test@example.com',
|
||||||
|
xsrfToken: test.testXsrfToken,
|
||||||
|
clientId: test.testClientId
|
||||||
|
});
|
||||||
|
const oldDomainWhoisAbuseContact = createTestContact('old@asdf.com');
|
||||||
|
oldDomainWhoisAbuseContact.visibleInDomainWhoisAsAbuse = true;
|
||||||
|
const testContacts = [oldDomainWhoisAbuseContact, testContact];
|
||||||
|
registry.testing.assertReqMockRsp(
|
||||||
|
test.testXsrfToken,
|
||||||
|
'/registrar-settings',
|
||||||
|
{op: 'read', id: 'testClientId', args: {}},
|
||||||
|
{status: 'SUCCESS', message: 'OK', results: [{contacts: testContacts}]});
|
||||||
|
// Edit testContact.
|
||||||
|
registry.testing.click($('reg-app-btn-edit'));
|
||||||
|
$('contacts[1].visibleInDomainWhoisAsAbuse.true')
|
||||||
|
.setAttribute('checked', 'checked');
|
||||||
|
$('contacts[1].visibleInDomainWhoisAsAbuse.false').removeAttribute('checked');
|
||||||
|
registry.testing.click($('reg-app-btn-save'));
|
||||||
|
|
||||||
|
// Should save them all back, and flip the old abuse contact's visibility
|
||||||
|
// boolean.
|
||||||
|
testContact.visibleInDomainWhoisAsAbuse = true;
|
||||||
|
oldDomainWhoisAbuseContact.visibleInDomainWhoisAsAbuse = false;
|
||||||
|
registry.testing.assertReqMockRsp(
|
||||||
|
test.testXsrfToken,
|
||||||
|
'/registrar-settings',
|
||||||
|
{
|
||||||
|
op: 'update',
|
||||||
|
id: 'testClientId',
|
||||||
|
args: {contacts: testContacts, readonly: false},
|
||||||
|
},
|
||||||
|
{status: 'SUCCESS', message: 'OK', results: [{contacts: testContacts}]});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("testDelete", function() {
|
||||||
|
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||||
|
path: 'contact-settings/test@example.com',
|
||||||
|
xsrfToken: test.testXsrfToken,
|
||||||
|
clientId: test.testClientId
|
||||||
|
});
|
||||||
|
const testContacts = [
|
||||||
|
createTestContact('new1@asdf.com'),
|
||||||
|
testContact,
|
||||||
|
createTestContact('new2@asdf.com')
|
||||||
|
];
|
||||||
|
registry.testing.assertReqMockRsp(
|
||||||
|
test.testXsrfToken,
|
||||||
|
'/registrar-settings',
|
||||||
|
{op: 'read', id: 'testClientId', args: {}},
|
||||||
|
{
|
||||||
|
status: 'SUCCESS',
|
||||||
|
message: 'OK',
|
||||||
|
results: [{
|
||||||
|
contacts: testContacts
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
// Delete testContact.
|
||||||
|
registry.testing.click($('reg-app-btn-edit'));
|
||||||
|
registry.testing.click($('reg-app-btn-delete'));
|
||||||
|
|
||||||
|
// Should save them all back, with testContact gone.
|
||||||
|
goog.array.removeAt(testContacts, 1);
|
||||||
|
registry.testing.assertReqMockRsp(
|
||||||
|
test.testXsrfToken,
|
||||||
|
'/registrar-settings',
|
||||||
|
{
|
||||||
|
op: 'update',
|
||||||
|
id: 'testClientId',
|
||||||
|
args: {contacts: testContacts, readonly: false},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
status: 'SUCCESS',
|
||||||
|
message: 'OK',
|
||||||
|
results: [{
|
||||||
|
contacts: testContacts
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
function testItemView() {
|
||||||
|
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||||
|
path: 'contact-settings/test@example.com',
|
||||||
|
xsrfToken: test.testXsrfToken,
|
||||||
|
clientId: test.testClientId
|
||||||
|
});
|
||||||
|
registry.testing.assertReqMockRsp(
|
||||||
|
test.testXsrfToken,
|
||||||
|
'/registrar-settings',
|
||||||
|
{op: 'read', id: 'testClientId', args: {}},
|
||||||
|
{
|
||||||
|
status: 'SUCCESS',
|
||||||
|
message: 'OK',
|
||||||
|
results: [{
|
||||||
|
contacts: [testContact]
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
delete contact['type'];
|
|
||||||
return contact;
|
/**
|
||||||
}
|
* @param {string=} opt_email
|
||||||
|
* @return {!Object}
|
||||||
|
*/
|
||||||
|
function createTestContact(opt_email) {
|
||||||
|
const nameMail = opt_email || 'test@example.com';
|
||||||
|
return {
|
||||||
|
name: nameMail,
|
||||||
|
emailAddress: nameMail,
|
||||||
|
phoneNumber: '+1.2345551234',
|
||||||
|
faxNumber: '+1.2345551234',
|
||||||
|
visibleInWhoisAsAdmin: false,
|
||||||
|
visibleInWhoisAsTech: false,
|
||||||
|
visibleInDomainWhoisAsAbuse: false,
|
||||||
|
types: 'ADMIN'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert parsed formContact to simulated wire form.
|
||||||
|
* @param {!Element} contact
|
||||||
|
* @return {!Object}
|
||||||
|
*/
|
||||||
|
function simulateJsonForContact(contact) {
|
||||||
|
contact.visibleInWhoisAsAdmin = contact.visibleInWhoisAsAdmin == 'true';
|
||||||
|
contact.visibleInWhoisAsTech = contact.visibleInWhoisAsTech == 'true';
|
||||||
|
contact.visibleInDomainWhoisAsAbuse = contact.visibleInDomainWhoisAsAbuse == 'true';
|
||||||
|
contact.types = '';
|
||||||
|
for (const tNdx in contact.type) {
|
||||||
|
if (contact.type[tNdx]) {
|
||||||
|
if (contact.types.length > 0) {
|
||||||
|
contact.types += ',';
|
||||||
|
}
|
||||||
|
contact.types += ('' + tNdx).toUpperCase();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete contact['type'];
|
||||||
|
return contact;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
|
@ -18,119 +18,117 @@ goog.require('goog.dispose');
|
||||||
goog.require('goog.dom');
|
goog.require('goog.dom');
|
||||||
goog.require('goog.testing.MockControl');
|
goog.require('goog.testing.MockControl');
|
||||||
goog.require('goog.testing.PropertyReplacer');
|
goog.require('goog.testing.PropertyReplacer');
|
||||||
goog.require('goog.testing.asserts');
|
|
||||||
goog.require('goog.testing.jsunit');
|
|
||||||
goog.require('goog.testing.net.XhrIo');
|
goog.require('goog.testing.net.XhrIo');
|
||||||
goog.require('registry.registrar.ConsoleTestUtil');
|
goog.require('registry.registrar.ConsoleTestUtil');
|
||||||
goog.require('registry.testing');
|
goog.require('registry.testing');
|
||||||
goog.require('registry.util');
|
goog.require('registry.util');
|
||||||
|
|
||||||
|
describe('security settings test', function() {
|
||||||
|
const $ = goog.dom.getRequiredElement;
|
||||||
|
const stubs = new goog.testing.PropertyReplacer();
|
||||||
|
|
||||||
const $ = goog.dom.getRequiredElement;
|
const expectedRegistrar = {
|
||||||
const stubs = new goog.testing.PropertyReplacer();
|
ipAddressWhitelist: [],
|
||||||
|
phonePasscode: '12345',
|
||||||
|
clientCertificate: null,
|
||||||
|
clientCertificateHash: null,
|
||||||
|
failoverClientCertificate: null
|
||||||
|
};
|
||||||
|
|
||||||
const expectedRegistrar = {
|
const test = {
|
||||||
ipAddressWhitelist: [],
|
testXsrfToken: '༼༎෴ ༎༽',
|
||||||
phonePasscode: '12345',
|
testClientId: 'testClientId',
|
||||||
clientCertificate: null,
|
mockControl: new goog.testing.MockControl()
|
||||||
clientCertificateHash: null,
|
};
|
||||||
failoverClientCertificate: null
|
|
||||||
};
|
|
||||||
|
|
||||||
const test = {
|
beforeEach(function() {
|
||||||
testXsrfToken: '༼༎෴ ༎༽',
|
registry.testing.addToDocument('<div id="test"/>');
|
||||||
testClientId: 'testClientId',
|
registry.testing.addToDocument('<div class="kd-butterbar"/>');
|
||||||
mockControl: new goog.testing.MockControl()
|
registry.registrar.ConsoleTestUtil.renderConsoleMain($('test'), {
|
||||||
};
|
xsrfToken: test.testXsrfToken,
|
||||||
|
clientId: test.testClientId,
|
||||||
|
});
|
||||||
function setUp() {
|
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
|
||||||
registry.testing.addToDocument('<div id="test"/>');
|
registry.registrar.ConsoleTestUtil.setup(test);
|
||||||
registry.testing.addToDocument('<div class="kd-butterbar"/>');
|
|
||||||
registry.registrar.ConsoleTestUtil.renderConsoleMain($('test'), {
|
|
||||||
xsrfToken: test.testXsrfToken,
|
|
||||||
clientId: test.testClientId,
|
|
||||||
});
|
});
|
||||||
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
|
|
||||||
registry.registrar.ConsoleTestUtil.setup(test);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
afterEach(function() {
|
||||||
function tearDown() {
|
goog.dispose(test.console);
|
||||||
goog.dispose(test.console);
|
goog.testing.net.XhrIo.cleanup();
|
||||||
goog.testing.net.XhrIo.cleanup();
|
stubs.reset();
|
||||||
stubs.reset();
|
test.mockControl.$tearDown();
|
||||||
test.mockControl.$tearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function testView() {
|
|
||||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
|
||||||
path: 'security-settings',
|
|
||||||
xsrfToken: test.testXsrfToken,
|
|
||||||
clientId: test.testClientId
|
|
||||||
});
|
});
|
||||||
registry.testing.assertReqMockRsp(
|
|
||||||
test.testXsrfToken,
|
|
||||||
'/registrar-settings',
|
|
||||||
{op: 'read', id: 'testClientId', args: {}},
|
|
||||||
{
|
|
||||||
status: 'SUCCESS',
|
|
||||||
message: 'OK',
|
|
||||||
results: [expectedRegistrar]
|
|
||||||
});
|
|
||||||
assertEquals(expectedRegistrar.phonePasscode,
|
|
||||||
registry.util.parseForm('item').phonePasscode);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
function testView() {
|
||||||
|
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||||
|
path: 'security-settings',
|
||||||
|
xsrfToken: test.testXsrfToken,
|
||||||
|
clientId: test.testClientId
|
||||||
|
});
|
||||||
|
registry.testing.assertReqMockRsp(
|
||||||
|
test.testXsrfToken,
|
||||||
|
'/registrar-settings',
|
||||||
|
{op: 'read', id: 'testClientId', args: {}},
|
||||||
|
{
|
||||||
|
status: 'SUCCESS',
|
||||||
|
message: 'OK',
|
||||||
|
results: [expectedRegistrar]
|
||||||
|
});
|
||||||
|
expect(expectedRegistrar.phonePasscode).toEqual(registry.util.parseForm('item').phonePasscode);
|
||||||
|
}
|
||||||
|
|
||||||
function testEdit() {
|
it("testView", function() {
|
||||||
testView();
|
testView();
|
||||||
|
});
|
||||||
|
|
||||||
registry.testing.click($('reg-app-btn-edit'));
|
it("testEdit", function() {
|
||||||
|
testView();
|
||||||
|
|
||||||
const form = document.forms.namedItem('item');
|
registry.testing.click($('reg-app-btn-edit'));
|
||||||
form.elements['newIp'].value = '1.1.1.1';
|
|
||||||
registry.testing.click($('btn-add-ip'));
|
|
||||||
form.elements['newIp'].value = '2.2.2.2';
|
|
||||||
registry.testing.click($('btn-add-ip'));
|
|
||||||
|
|
||||||
const exampleCert = $('exampleCert').value;
|
const form = document.forms.namedItem('item');
|
||||||
const exampleCertHash = '6NKKNBnd2fKFooBINmn3V7L3JOTHh02+2lAqYHdlTgk';
|
form.elements['newIp'].value = '1.1.1.1';
|
||||||
form.elements['clientCertificate'].value = exampleCert;
|
registry.testing.click($('btn-add-ip'));
|
||||||
form.elements['failoverClientCertificate'].value = 'bourgeois blues';
|
form.elements['newIp'].value = '2.2.2.2';
|
||||||
registry.testing.click($('reg-app-btn-save'));
|
registry.testing.click($('btn-add-ip'));
|
||||||
|
|
||||||
registry.testing.assertReqMockRsp(
|
const exampleCert = $('exampleCert').value;
|
||||||
test.testXsrfToken,
|
const exampleCertHash = '6NKKNBnd2fKFooBINmn3V7L3JOTHh02+2lAqYHdlTgk';
|
||||||
'/registrar-settings',
|
form.elements['clientCertificate'].value = exampleCert;
|
||||||
{op: 'update', id: 'testClientId', args: {
|
form.elements['failoverClientCertificate'].value = 'bourgeois blues';
|
||||||
clientCertificate: exampleCert,
|
registry.testing.click($('reg-app-btn-save'));
|
||||||
clientCertificateHash: null,
|
|
||||||
failoverClientCertificate: 'bourgeois blues',
|
|
||||||
ipAddressWhitelist: ['1.1.1.1', '2.2.2.2'],
|
|
||||||
phonePasscode: expectedRegistrar.phonePasscode,
|
|
||||||
readonly: false }},
|
|
||||||
{status: 'SUCCESS',
|
|
||||||
message: 'OK',
|
|
||||||
results: [{}]});
|
|
||||||
// XXX: The response above is ignored as the page re-issues a fetch. Should
|
|
||||||
// either provide the real response here and use anyTimes(), or have
|
|
||||||
// resource_component use this directly.
|
|
||||||
|
|
||||||
expectedRegistrar.clientCertificate = exampleCert;
|
registry.testing.assertReqMockRsp(
|
||||||
expectedRegistrar.clientCertificateHash = exampleCertHash;
|
test.testXsrfToken,
|
||||||
expectedRegistrar.failoverClientCertificate = 'bourgeois blues';
|
'/registrar-settings',
|
||||||
expectedRegistrar.ipAddressWhitelist = ['1.1.1.1/32', '2.2.2.2/32'];
|
{op: 'update', id: 'testClientId', args: {
|
||||||
registry.testing.assertReqMockRsp(
|
clientCertificate: exampleCert,
|
||||||
test.testXsrfToken,
|
clientCertificateHash: null,
|
||||||
'/registrar-settings',
|
failoverClientCertificate: 'bourgeois blues',
|
||||||
{op: 'read', id: 'testClientId', args: {}},
|
ipAddressWhitelist: ['1.1.1.1', '2.2.2.2'],
|
||||||
{status: 'SUCCESS',
|
phonePasscode: expectedRegistrar.phonePasscode,
|
||||||
message: 'OK',
|
readonly: false }},
|
||||||
results: [expectedRegistrar]});
|
{status: 'SUCCESS',
|
||||||
|
message: 'OK',
|
||||||
|
results: [{}]});
|
||||||
|
// XXX: The response above is ignored as the page re-issues a fetch. Should
|
||||||
|
// either provide the real response here and use anyTimes(), or have
|
||||||
|
// resource_component use this directly.
|
||||||
|
|
||||||
delete expectedRegistrar['clientCertificateHash'];
|
expectedRegistrar.clientCertificate = exampleCert;
|
||||||
registry.testing.assertObjectEqualsPretty(
|
expectedRegistrar.clientCertificateHash = exampleCertHash;
|
||||||
expectedRegistrar, registry.util.parseForm('item'));
|
expectedRegistrar.failoverClientCertificate = 'bourgeois blues';
|
||||||
}
|
expectedRegistrar.ipAddressWhitelist = ['1.1.1.1/32', '2.2.2.2/32'];
|
||||||
|
registry.testing.assertReqMockRsp(
|
||||||
|
test.testXsrfToken,
|
||||||
|
'/registrar-settings',
|
||||||
|
{op: 'read', id: 'testClientId', args: {}},
|
||||||
|
{status: 'SUCCESS',
|
||||||
|
message: 'OK',
|
||||||
|
results: [expectedRegistrar]});
|
||||||
|
|
||||||
|
delete expectedRegistrar['clientCertificateHash'];
|
||||||
|
registry.testing.assertObjectEqualsPretty(
|
||||||
|
expectedRegistrar, registry.util.parseForm('item'));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -19,152 +19,148 @@ goog.require('goog.dom');
|
||||||
goog.require('goog.dom.classlist');
|
goog.require('goog.dom.classlist');
|
||||||
goog.require('goog.testing.MockControl');
|
goog.require('goog.testing.MockControl');
|
||||||
goog.require('goog.testing.PropertyReplacer');
|
goog.require('goog.testing.PropertyReplacer');
|
||||||
goog.require('goog.testing.asserts');
|
|
||||||
goog.require('goog.testing.jsunit');
|
|
||||||
goog.require('goog.testing.net.XhrIo');
|
goog.require('goog.testing.net.XhrIo');
|
||||||
goog.require('registry.registrar.ConsoleTestUtil');
|
goog.require('registry.registrar.ConsoleTestUtil');
|
||||||
goog.require('registry.testing');
|
goog.require('registry.testing');
|
||||||
goog.require('registry.util');
|
goog.require('registry.util');
|
||||||
|
|
||||||
|
describe("whois settings test", function() {
|
||||||
|
const $ = goog.dom.getRequiredElement;
|
||||||
|
const $$ = goog.dom.getRequiredElementByClass;
|
||||||
|
const stubs = new goog.testing.PropertyReplacer();
|
||||||
|
|
||||||
const $ = goog.dom.getRequiredElement;
|
const test = {
|
||||||
const $$ = goog.dom.getRequiredElementByClass;
|
testXsrfToken: '༼༎෴ ༎༽',
|
||||||
const stubs = new goog.testing.PropertyReplacer();
|
testClientId: 'testClientId',
|
||||||
|
mockControl: new goog.testing.MockControl()
|
||||||
|
};
|
||||||
|
|
||||||
const test = {
|
beforeEach(function() {
|
||||||
testXsrfToken: '༼༎෴ ༎༽',
|
registry.testing.addToDocument('<div id="test"/>');
|
||||||
testClientId: 'testClientId',
|
registry.testing.addToDocument('<div class="kd-butterbar"/>');
|
||||||
mockControl: new goog.testing.MockControl()
|
registry.registrar.ConsoleTestUtil.renderConsoleMain($('test'), {
|
||||||
};
|
xsrfToken: test.testXsrfToken,
|
||||||
|
clientId: test.testClientId,
|
||||||
|
});
|
||||||
function setUp() {
|
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
|
||||||
registry.testing.addToDocument('<div id="test"/>');
|
registry.registrar.ConsoleTestUtil.setup(test);
|
||||||
registry.testing.addToDocument('<div class="kd-butterbar"/>');
|
|
||||||
registry.registrar.ConsoleTestUtil.renderConsoleMain($('test'), {
|
|
||||||
xsrfToken: test.testXsrfToken,
|
|
||||||
clientId: test.testClientId,
|
|
||||||
});
|
});
|
||||||
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
|
|
||||||
registry.registrar.ConsoleTestUtil.setup(test);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
afterEach(function() {
|
||||||
function tearDown() {
|
goog.dispose(test.console);
|
||||||
goog.dispose(test.console);
|
stubs.reset();
|
||||||
stubs.reset();
|
goog.testing.net.XhrIo.cleanup();
|
||||||
goog.testing.net.XhrIo.cleanup();
|
test.mockControl.$tearDown();
|
||||||
test.mockControl.$tearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates test registrar.
|
|
||||||
* @return {!Object}
|
|
||||||
*/
|
|
||||||
function createTestRegistrar() {
|
|
||||||
return {
|
|
||||||
emailAddress: 'test2.ui@example.com',
|
|
||||||
clientIdentifier: 'theRegistrar',
|
|
||||||
ianaIdentifier: 1,
|
|
||||||
icannReferralEmail: 'lol@sloth.test',
|
|
||||||
whoisServer: 'foo.bar.baz',
|
|
||||||
url: 'blah.blar',
|
|
||||||
phoneNumber: '+1.2125650000',
|
|
||||||
faxNumber: '+1.2125650001',
|
|
||||||
localizedAddress: {
|
|
||||||
street: ['111 Eighth Avenue', 'Eleventh Floor', 'lol'],
|
|
||||||
city: 'New York',
|
|
||||||
state: 'NY',
|
|
||||||
zip: '10011',
|
|
||||||
countryCode: 'US'
|
|
||||||
}};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function testView() {
|
|
||||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
|
||||||
path: 'whois-settings',
|
|
||||||
xsrfToken: test.testXsrfToken,
|
|
||||||
clientId: test.testClientId
|
|
||||||
});
|
});
|
||||||
const testRegistrar = createTestRegistrar();
|
|
||||||
registry.testing.assertReqMockRsp(
|
|
||||||
test.testXsrfToken,
|
|
||||||
'/registrar-settings',
|
|
||||||
{op: 'read', id: 'testClientId', args: {}},
|
|
||||||
{
|
|
||||||
status: 'SUCCESS',
|
|
||||||
message: 'OK',
|
|
||||||
results: [testRegistrar]
|
|
||||||
});
|
|
||||||
const parsed = registry.util.parseForm('item');
|
|
||||||
parsed.ianaIdentifier = parseInt(parsed.ianaIdentifier);
|
|
||||||
registry.testing.assertObjectEqualsPretty(testRegistrar, parsed);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates test registrar.
|
||||||
|
* @return {!Object}
|
||||||
|
*/
|
||||||
|
function createTestRegistrar() {
|
||||||
|
return {
|
||||||
|
emailAddress: 'test2.ui@example.com',
|
||||||
|
clientIdentifier: 'theRegistrar',
|
||||||
|
ianaIdentifier: 1,
|
||||||
|
icannReferralEmail: 'lol@sloth.test',
|
||||||
|
whoisServer: 'foo.bar.baz',
|
||||||
|
url: 'blah.blar',
|
||||||
|
phoneNumber: '+1.2125650000',
|
||||||
|
faxNumber: '+1.2125650001',
|
||||||
|
localizedAddress: {
|
||||||
|
street: ['111 Eighth Avenue', 'Eleventh Floor', 'lol'],
|
||||||
|
city: 'New York',
|
||||||
|
state: 'NY',
|
||||||
|
zip: '10011',
|
||||||
|
countryCode: 'US'
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
|
||||||
function testEdit() {
|
function testView() {
|
||||||
testView();
|
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||||
registry.testing.click($('reg-app-btn-edit'));
|
path: 'whois-settings',
|
||||||
$('emailAddress').value = 'test2.ui@example.com';
|
xsrfToken: test.testXsrfToken,
|
||||||
$('localizedAddress.street[0]').value = 'look at me i am';
|
clientId: test.testClientId
|
||||||
$('localizedAddress.street[1]').value = 'the mistress of the night';
|
});
|
||||||
$('localizedAddress.street[2]').value = '';
|
const testRegistrar = createTestRegistrar();
|
||||||
const parsed = registry.util.parseForm('item');
|
registry.testing.assertReqMockRsp(
|
||||||
parsed.readonly = false;
|
test.testXsrfToken,
|
||||||
registry.testing.click($('reg-app-btn-save'));
|
'/registrar-settings',
|
||||||
registry.testing.assertReqMockRsp(
|
{op: 'read', id: 'testClientId', args: {}},
|
||||||
test.testXsrfToken,
|
{
|
||||||
'/registrar-settings',
|
status: 'SUCCESS',
|
||||||
{op: 'update', id: 'testClientId', args: parsed},
|
message: 'OK',
|
||||||
{
|
results: [testRegistrar]
|
||||||
status: 'SUCCESS',
|
});
|
||||||
message: 'OK',
|
const parsed = registry.util.parseForm('item');
|
||||||
results: [parsed]
|
parsed.ianaIdentifier = parseInt(parsed.ianaIdentifier);
|
||||||
});
|
registry.testing.assertObjectEqualsPretty(testRegistrar, parsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
it("testView", function() {
|
||||||
|
testView();
|
||||||
|
});
|
||||||
|
|
||||||
function testEditFieldError_insertsError() {
|
it("testEdit", function() {
|
||||||
testView();
|
testView();
|
||||||
registry.testing.click($('reg-app-btn-edit'));
|
registry.testing.click($('reg-app-btn-edit'));
|
||||||
$('phoneNumber').value = 'foo';
|
$('emailAddress').value = 'test2.ui@example.com';
|
||||||
const parsed = registry.util.parseForm('item');
|
$('localizedAddress.street[0]').value = 'look at me i am';
|
||||||
parsed.readonly = false;
|
$('localizedAddress.street[1]').value = 'the mistress of the night';
|
||||||
registry.testing.click($('reg-app-btn-save'));
|
$('localizedAddress.street[2]').value = '';
|
||||||
const errMsg = 'Carpe brunchus. --Pablo';
|
const parsed = registry.util.parseForm('item');
|
||||||
registry.testing.assertReqMockRsp(
|
parsed.readonly = false;
|
||||||
test.testXsrfToken,
|
registry.testing.click($('reg-app-btn-save'));
|
||||||
'/registrar-settings',
|
registry.testing.assertReqMockRsp(
|
||||||
{op: 'update', id: 'testClientId', args: parsed},
|
test.testXsrfToken,
|
||||||
{
|
'/registrar-settings',
|
||||||
status: 'ERROR',
|
{op: 'update', id: 'testClientId', args: parsed},
|
||||||
field: 'phoneNumber',
|
{
|
||||||
message: errMsg
|
status: 'SUCCESS',
|
||||||
});
|
message: 'OK',
|
||||||
const msgBox = goog.dom.getNextElementSibling($('phoneNumber'));
|
results: [parsed]
|
||||||
assertTrue(goog.dom.classlist.contains(msgBox, 'kd-errormessage'));
|
});
|
||||||
assertTrue(goog.dom.classlist.contains($('phoneNumber'), 'kd-formerror'));
|
});
|
||||||
assertEquals(errMsg, goog.dom.getTextContent(msgBox));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
it("testEditFieldError_insertsError", function() {
|
||||||
|
testView();
|
||||||
|
registry.testing.click($('reg-app-btn-edit'));
|
||||||
|
$('phoneNumber').value = 'foo';
|
||||||
|
const parsed = registry.util.parseForm('item');
|
||||||
|
parsed.readonly = false;
|
||||||
|
registry.testing.click($('reg-app-btn-save'));
|
||||||
|
const errMsg = 'Carpe brunchus. --Pablo';
|
||||||
|
registry.testing.assertReqMockRsp(
|
||||||
|
test.testXsrfToken,
|
||||||
|
'/registrar-settings',
|
||||||
|
{op: 'update', id: 'testClientId', args: parsed},
|
||||||
|
{
|
||||||
|
status: 'ERROR',
|
||||||
|
field: 'phoneNumber',
|
||||||
|
message: errMsg
|
||||||
|
});
|
||||||
|
const msgBox = goog.dom.getNextElementSibling($('phoneNumber'));
|
||||||
|
expect(goog.dom.classlist.contains(msgBox, 'kd-errormessage')).toBe(true);
|
||||||
|
expect(goog.dom.classlist.contains($('phoneNumber'), 'kd-formerror')).toBe(true);
|
||||||
|
expect(errMsg).toEqual(goog.dom.getTextContent(msgBox));
|
||||||
|
});
|
||||||
|
|
||||||
function testEditNonFieldError_showsButterBar() {
|
it("testEditNonFieldError_showsButterBar", function() {
|
||||||
testView();
|
testView();
|
||||||
registry.testing.click($('reg-app-btn-edit'));
|
registry.testing.click($('reg-app-btn-edit'));
|
||||||
const parsed = registry.util.parseForm('item');
|
const parsed = registry.util.parseForm('item');
|
||||||
parsed.readonly = false;
|
parsed.readonly = false;
|
||||||
registry.testing.click($('reg-app-btn-save'));
|
registry.testing.click($('reg-app-btn-save'));
|
||||||
const errMsg = 'One must still have chaos in oneself to be able to give ' +
|
const errMsg = 'One must still have chaos in oneself to be able to give ' +
|
||||||
'birth to a dancing star. --Nietzsche';
|
'birth to a dancing star. --Nietzsche';
|
||||||
registry.testing.assertReqMockRsp(
|
registry.testing.assertReqMockRsp(
|
||||||
test.testXsrfToken,
|
test.testXsrfToken,
|
||||||
'/registrar-settings',
|
'/registrar-settings',
|
||||||
{op: 'update', id: 'testClientId', args: parsed},
|
{op: 'update', id: 'testClientId', args: parsed},
|
||||||
{
|
{
|
||||||
status: 'ERROR',
|
status: 'ERROR',
|
||||||
message: errMsg
|
message: errMsg
|
||||||
});
|
});
|
||||||
assertEquals(errMsg, goog.dom.getTextContent($$('kd-butterbar-text')));
|
expect(errMsg).toEqual(goog.dom.getTextContent($$('kd-butterbar-text')));
|
||||||
}
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -53,8 +53,7 @@ registry.testing.click = function(element) {
|
||||||
* @param {!Element} element
|
* @param {!Element} element
|
||||||
*/
|
*/
|
||||||
registry.testing.assertVisible = function(element) {
|
registry.testing.assertVisible = function(element) {
|
||||||
assertTrue('Element should have CSS "shown" class',
|
expect(goog.dom.classlist.contains(element, 'shown')).toBe(true);
|
||||||
goog.dom.classlist.contains(element, 'shown'));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,8 +62,7 @@ registry.testing.assertVisible = function(element) {
|
||||||
* @param {!Element} element
|
* @param {!Element} element
|
||||||
*/
|
*/
|
||||||
registry.testing.assertHidden = function(element) {
|
registry.testing.assertHidden = function(element) {
|
||||||
assertTrue('Element should have CSS "hidden" class',
|
expect(goog.dom.classlist.contains(element, 'hidden')).toBe(true);
|
||||||
goog.dom.classlist.contains(element, 'hidden'));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,7 +73,7 @@ registry.testing.assertHidden = function(element) {
|
||||||
*/
|
*/
|
||||||
registry.testing.assertObjectEqualsPretty = function(a, b) {
|
registry.testing.assertObjectEqualsPretty = function(a, b) {
|
||||||
try {
|
try {
|
||||||
assertObjectEquals(a, b);
|
expect(a).toEqual(b);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
e.message = e.message + '\n' +
|
e.message = e.message + '\n' +
|
||||||
'expected: ' + registry.testing.pretty_.format(a) + '\n' +
|
'expected: ' + registry.testing.pretty_.format(a) + '\n' +
|
||||||
|
@ -96,8 +94,8 @@ registry.testing.assertObjectEqualsPretty = function(a, b) {
|
||||||
registry.testing.assertReqMockRsp =
|
registry.testing.assertReqMockRsp =
|
||||||
function(xsrfToken, path, expectReqJson, mockRspJson) {
|
function(xsrfToken, path, expectReqJson, mockRspJson) {
|
||||||
var xhr = goog.testing.net.XhrIo.getSendInstances().pop();
|
var xhr = goog.testing.net.XhrIo.getSendInstances().pop();
|
||||||
assertTrue('XHR is active.', xhr.isActive());
|
expect(xhr.isActive()).toBe(true);
|
||||||
assertEquals(path, xhr.getLastUri());
|
expect(path).toEqual(xhr.getLastUri());
|
||||||
// XXX: XHR header checking should probably be added. Was inconsistent
|
// XXX: XHR header checking should probably be added. Was inconsistent
|
||||||
// between admin and registrar consoles.
|
// between admin and registrar consoles.
|
||||||
registry.testing.assertObjectEqualsPretty(
|
registry.testing.assertObjectEqualsPretty(
|
||||||
|
|
1
gradle/.gitignore
vendored
Normal file
1
gradle/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.idea
|
1
gradle/core/.gitignore
vendored
Normal file
1
gradle/core/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
out/*
|
57
karma.conf.js
Normal file
57
karma.conf.js
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
module.exports = function(config) {
|
||||||
|
config.set({
|
||||||
|
browsers: ['ChromeHeadless'],
|
||||||
|
frameworks: ['jasmine', 'closure'],
|
||||||
|
singleRun: true,
|
||||||
|
autoWatch: false,
|
||||||
|
files: [
|
||||||
|
'node_modules/google-closure-library/closure/goog/base.js',
|
||||||
|
'core/build/resources/test/**/*_test.js',
|
||||||
|
{
|
||||||
|
pattern: 'core/build/resources/test/**/!(*_test).js',
|
||||||
|
included: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pattern: 'core/build/resources/main/**/*.js',
|
||||||
|
included: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pattern: 'core/build/generated/source/custom/main/**/*.soy.js',
|
||||||
|
included: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pattern: 'node_modules/soyutils_usegoog.js',
|
||||||
|
included: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pattern: 'node_modules/google-closure-library/closure/goog/deps.js',
|
||||||
|
included: false,
|
||||||
|
served: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pattern: 'core/build/resources/main/google/registry/ui/assets/images/*.png',
|
||||||
|
included: false,
|
||||||
|
served: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pattern: 'core/build/resources/main/google/registry/ui/assets/images/icons/svg/*.svg',
|
||||||
|
included: false,
|
||||||
|
served: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
preprocessors: {
|
||||||
|
'node_modules/google-closure-library/closure/goog/deps.js': ['closure', 'closure-deps'],
|
||||||
|
'node_modules/google-closure-library/closure/goog/base.js': ['closure'],
|
||||||
|
'node_modules/google-closure-library/closure/**/*.js': ['closure'],
|
||||||
|
'core/build/resources/test/**/*_test.js': ['closure'],
|
||||||
|
'core/build/resources/test/**/!(*_test).js': ['closure'],
|
||||||
|
'core/build/resources/main/**/*.js': ['closure'],
|
||||||
|
'core/build/generated/source/custom/main/**/*.soy.js': ['closure'],
|
||||||
|
'node_modules/soyutils_usegoog.js': ['closure']
|
||||||
|
},
|
||||||
|
proxies: {
|
||||||
|
"/assets/": "/base/core/build/resources/main/google/registry/ui/assets/"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
3272
package-lock.json
generated
3272
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -18,5 +18,12 @@
|
||||||
"homepage": "https://github.com/google/nomulus#readme",
|
"homepage": "https://github.com/google/nomulus#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"google-closure-library": "20190325.0.0"
|
"google-closure-library": "20190325.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"jasmine-core": "^3.3.0",
|
||||||
|
"karma": "~0.13",
|
||||||
|
"karma-chrome-launcher": "^2.2.0",
|
||||||
|
"karma-closure": "^0.1.3",
|
||||||
|
"karma-jasmine": "^2.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue