public function FancyLoginJavascriptTest::testLinks in Fancy Login 3.0.x
Same name and namespace in other branches
- 8.2 tests/src/FunctionalJavascript/FancyLoginJavascriptTest.php \Drupal\Tests\fancy_login\FunctionalJavascript\FancyLoginJavascriptTest::testLinks()
File
- tests/
src/ FunctionalJavascript/ FancyLoginJavascriptTest.php, line 305
Class
- FancyLoginJavascriptTest
- @group fancy_login
Namespace
Drupal\Tests\fancy_login\FunctionalJavascriptCode
public function testLinks() {
// Confirm popup opened
$this
->assertJsCondition('jQuery("#fancy_login_dim_screen").not(":animated")');
$this
->assertJsCondition('jQuery("#fancy-login-user-login-form").not(":animated")');
// Click link
$this
->clickLink('Request new password');
// Wait until new form has loaded
$this
->assertJsCondition('jQuery("#fancy-login-user-pass").length');
$this
->assertJsCondition('jQuery("#fancy-login-user-pass").not(":animated")');
// Click Link to return to original form
$this
->clickLink('Sign in');
// Wait until new form has loaded
$this
->assertJsCondition('jQuery("#fancy-login-user-login-form").length');
$this
->assertJsCondition('jQuery("#fancy-login-user-pass").not(":animated")');
// Click the create account link and confirm redirect goes to correct page
$this
->clickLink('Create new account');
$this
->getSession()
->wait(5000);
$this
->assertStatusCodeEquals(200);
$this
->assertSession()
->addressMatches('/\\/user\\/register$/');
// Go back to node 1
$this
->drupalGet('/node/1');
$this
->assertStatusCodeEquals(200);
// Next confirm that the create new account link works on the password reset form
$this
->openPopup();
// Ensure popup is open
$this
->assertJsCondition('jQuery("#fancy_login_dim_screen").not(":animated")');
$this
->assertJsCondition('jQuery("#fancy-login-user-login-form").not(":animated")');
// Switch forms
$this
->clickLink('Request new password');
// Wait until form is loaded
$this
->assertJsCondition('jQuery("#fancy-login-user-pass").length');
$this
->assertJsCondition('jQuery("#fancy-login-user-pass").not(":animated")');
// Click the create new account link and confirm correct page loads
$this
->clickLink('Create new account');
$this
->getSession()
->wait(5000);
$this
->assertStatusCodeEquals(200);
$this
->assertSession()
->addressMatches('/\\/user\\/register$/');
}