Add isLoggedIn/isNotLoggedIn assertions

Created on 8 June 2023, about 1 year ago

Add for Cypress and Playwright.

  IShouldBeLoggedIn: async (page) => {
    await page.goto('/user', { waitUntil: 'networkidle' });
    await expect(page.locator('body.user-logged-in').first()).toHaveCount(1);
    await expect(page).toHaveURL(/.*(?!user\/login)/);
  },
  IShouldNotBeLoggedIn: async (page) => {
    await page.goto('/user/login', { waitUntil: 'networkidle' });
    await expect(page.locator('body.user-logged-in').first()).toHaveCount(0);
    await expect(page).toHaveURL(/.*user\/login/);

h/t Petar Basic of Drunomics:
https://github.com/drunomics/playwright-drupal-starter/blob/main/tests/playwright/tests/helpers/test-methods.js

πŸ“Œ Task
Status

Active

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States aangel

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024