3 namespace Drupal\FunctionalJavascriptTests\Core\Session;
5 use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
6 use Drupal\menu_link_content\Entity\MenuLinkContent;
9 * Tests that sessions don't expire.
13 class SessionTest extends JavascriptTestBase {
18 public static $modules = ['menu_link_content', 'block'];
23 protected function setUp() {
26 $account = $this->drupalCreateUser();
27 $this->drupalLogin($account);
29 $menu_link_content = MenuLinkContent::create([
30 'title' => 'Link to front page',
31 'menu_name' => 'tools',
32 'link' => ['uri' => 'route:<front>'],
34 $menu_link_content->save();
36 $this->drupalPlaceBlock('system_menu_block:tools');
40 * Tests that the session doesn't expire.
42 * Makes sure that drupal_valid_test_ua() works for multiple requests
43 * performed by the Mink browser. The SIMPLETEST_USER_AGENT cookie must always
46 public function testSessionExpiration() {
47 // Visit the front page and click the link back to the front page a large
49 $this->drupalGet('<front>');
51 $page = $this->getSession()->getPage();
53 for ($i = 0; $i < 25; $i++) {
54 $page->clickLink('Link to front page');