mirror of
https://github.com/google/nomulus.git
synced 2025-06-26 06:14:54 +02:00
Add another test contact for Registry Lock testing (#324)
* Add another test contact for Registry Lock testing Previously, we only had two contacts -- one per registrar. This PR adds a second, registry-lock-enabled, contact to one registrar for two reasons: 1. For registry-lock-related testing, we'd like to be able to test both positively and negatively, making sure that the permissions work the way they should 2. In general, the UI tests should include the case where we have multiple contacts in the same registrar. Previously, this was never the case in tests. * Merge remote-tracking branch 'origin/master' into addTestContact
This commit is contained in:
parent
d32b52d3a2
commit
2a5a3b709a
6 changed files with 38 additions and 5 deletions
|
@ -193,6 +193,7 @@ public final class AppEngineRule extends ExternalResource {
|
|||
.setPassword("foo-BAR2")
|
||||
.setPhoneNumber("+1.3334445555")
|
||||
.setPhonePasscode("12345")
|
||||
.setRegistryLockAllowed(false)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -206,6 +207,7 @@ public final class AppEngineRule extends ExternalResource {
|
|||
.setPassword("password2")
|
||||
.setPhoneNumber("+1.2223334444")
|
||||
.setPhonePasscode("22222")
|
||||
.setRegistryLockAllowed(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -241,6 +243,19 @@ public final class AppEngineRule extends ExternalResource {
|
|||
.build();
|
||||
}
|
||||
|
||||
public static RegistrarContact makeRegistrarContact3() {
|
||||
return new RegistrarContact.Builder()
|
||||
.setParent(makeRegistrar2())
|
||||
.setName("Marla Singer")
|
||||
.setEmailAddress("Marla.Singer@crr.com")
|
||||
.setPhoneNumber("+1.2128675309")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.TECH))
|
||||
.setGaeUserId(THE_REGISTRAR_GAE_USER_ID)
|
||||
.setAllowedToSetRegistryLockPassword(true)
|
||||
.setRegistryLockPassword("hi")
|
||||
.build();
|
||||
}
|
||||
|
||||
/** Hack to make sure AppEngineRule is always wrapped in a TemporaryFolder rule. */
|
||||
@Override
|
||||
public Statement apply(Statement base, Description description) {
|
||||
|
@ -412,6 +427,10 @@ public final class AppEngineRule extends ExternalResource {
|
|||
public static void loadInitialData() {
|
||||
persistSimpleResources(
|
||||
ImmutableList.of(
|
||||
makeRegistrar1(), makeRegistrarContact1(), makeRegistrar2(), makeRegistrarContact2()));
|
||||
makeRegistrar1(),
|
||||
makeRegistrarContact1(),
|
||||
makeRegistrar2(),
|
||||
makeRegistrarContact2(),
|
||||
makeRegistrarContact3()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import static google.registry.model.ofy.ObjectifyService.ofy;
|
|||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||
|
||||
import com.google.common.collect.ImmutableSortedSet;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.ofy.CommitLogManifest;
|
||||
import google.registry.model.ofy.CommitLogMutation;
|
||||
|
@ -62,13 +63,16 @@ public class ResaveEnvironmentEntitiesCommandTest
|
|||
transform(
|
||||
ofy().load().type(CommitLogMutation.class).list(),
|
||||
mutation -> ofy().load().fromEntity(mutation.getEntity()));
|
||||
ImmutableSortedSet<RegistrarContact> theRegistrarContacts =
|
||||
loadRegistrar("TheRegistrar").getContacts();
|
||||
assertThat(savedEntities)
|
||||
.containsExactly(
|
||||
// The Registrars and RegistrarContacts are created by AppEngineRule.
|
||||
loadRegistrar("TheRegistrar"),
|
||||
loadRegistrar("NewRegistrar"),
|
||||
Registry.get("tld"),
|
||||
getOnlyElement(loadRegistrar("TheRegistrar").getContacts()),
|
||||
theRegistrarContacts.first(),
|
||||
theRegistrarContacts.last(),
|
||||
getOnlyElement(loadRegistrar("NewRegistrar").getContacts()));
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.junit.Test;
|
|||
import org.junit.rules.Timeout;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
/** WebDriver tests for Registrar Console UI. */
|
||||
@RunWith(RepeatableRunner.class)
|
||||
|
@ -78,6 +79,12 @@ public class RegistrarConsoleWebTest extends WebDriverTestCase {
|
|||
assertThat(driver.waitForElement(By.id(eltId)).isDisplayed()).isFalse();
|
||||
}
|
||||
|
||||
/** Checks that searching with the given By produces at least one element with the given text. */
|
||||
void assertEltTextPresent(By by, String toFind) {
|
||||
assertThat(driver.findElements(by).stream().map(WebElement::getText).anyMatch(toFind::equals))
|
||||
.isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEditButtonsVisibility_owner() throws Throwable {
|
||||
driver.get(server.getUrl("/registrar#whois-settings"));
|
||||
|
@ -190,9 +197,11 @@ public class RegistrarConsoleWebTest extends WebDriverTestCase {
|
|||
ImmutableList<RegistrarContact> contacts =
|
||||
server.runInAppEngineEnvironment(
|
||||
() -> loadRegistrar("TheRegistrar").getContacts().asList());
|
||||
assertEltText("contacts[0].name", contacts.get(0).getName());
|
||||
assertEltText("contacts[0].emailAddress", contacts.get(0).getEmailAddress());
|
||||
assertEltText("contacts[0].phoneNumber", contacts.get(0).getPhoneNumber());
|
||||
for (RegistrarContact contact : contacts) {
|
||||
assertEltTextPresent(By.id("contacts[0].name"), contact.getName());
|
||||
assertEltTextPresent(By.id("contacts[0].emailAddress"), contact.getEmailAddress());
|
||||
assertEltTextPresent(By.id("contacts[0].phoneNumber"), contact.getPhoneNumber());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -13,6 +13,7 @@ contacts:
|
|||
ADDED:
|
||||
{parent=Key<?>(EntityGroupRoot("cross-tld")/Registrar("TheRegistrar")), name=Extra Terrestrial, emailAddress=etphonehome@example.com, phoneNumber=+1.2345678901, faxNumber=null, types=[ADMIN, BILLING, TECH, WHOIS], gaeUserId=null, visibleInWhoisAsAdmin=true, visibleInWhoisAsTech=false, visibleInDomainWhoisAsAbuse=false, allowedToSetRegistryLockPassword=false}
|
||||
REMOVED:
|
||||
{parent=Key<?>(EntityGroupRoot("cross-tld")/Registrar("TheRegistrar")), name=Marla Singer, emailAddress=Marla.Singer@crr.com, phoneNumber=+1.2128675309, faxNumber=null, types=[TECH], gaeUserId=31337, visibleInWhoisAsAdmin=false, visibleInWhoisAsTech=false, visibleInDomainWhoisAsAbuse=false, allowedToSetRegistryLockPassword=false},
|
||||
{parent=Key<?>(EntityGroupRoot("cross-tld")/Registrar("TheRegistrar")), name=John Doe, emailAddress=johndoe@theregistrar.com, phoneNumber=+1.1234567890, faxNumber=null, types=[ADMIN], gaeUserId=31337, visibleInWhoisAsAdmin=false, visibleInWhoisAsTech=false, visibleInDomainWhoisAsAbuse=false, allowedToSetRegistryLockPassword=false},
|
||||
{parent=Key<?>(EntityGroupRoot("cross-tld")/Registrar("TheRegistrar")), name=Jian-Yang, emailAddress=jyang@bachman.accelerator, phoneNumber=+1.1234567890, faxNumber=null, types=[TECH], gaeUserId=null, visibleInWhoisAsAdmin=false, visibleInWhoisAsTech=false, visibleInDomainWhoisAsAbuse=false, allowedToSetRegistryLockPassword=false}
|
||||
FINAL CONTENTS:
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 93 KiB |
Binary file not shown.
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 50 KiB |
Loading…
Add table
Add a link
Reference in a new issue