npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@redhat-cloud-services/playwright-test-auth

v0.0.2

Published

Reusable Red Hat SSO authentication utilities for Playwright e2e testing

Downloads

587

Readme

@redhat-cloud-services/playwright-test-auth

Reusable Red Hat SSO authentication utilities for Playwright e2e testing.

Installation

npm install --save-dev @redhat-cloud-services/playwright-test-auth

Usage

Global Setup (Recommended)

Configure Playwright to use the global setup to authenticate once and reuse the session across all tests:

playwright.config.ts:

import { defineConfig } from '@playwright/test';

export default defineConfig({
  globalSetup: require.resolve('@redhat-cloud-services/playwright-test-auth/global-setup'),
  use: {
    baseURL: 'https://stage.foo.redhat.com:1337',
    storageState: 'playwright/.auth/user.json',
  },
  // ... other config
});

Set environment variables:

export E2E_USER='your-username'
export E2E_PASSWORD='your-password'

Test Setup

Block cookie prompts in your tests:

import { test } from '@playwright/test';
import { disableCookiePrompt } from '@redhat-cloud-services/playwright-test-auth';

test.beforeEach(async ({ page }) => {
  await disableCookiePrompt(page);
  await page.goto('/');
});

Manual Login

For tests that need to handle login manually:

import { login, ensureLoggedIn } from '@redhat-cloud-services/playwright-test-auth';

// Direct login
await login(page, username, password);

// Or check if already logged in, login if needed
await ensureLoggedIn(page);

API

globalSetup(config: FullConfig)

Playwright global setup function that performs login once and saves authentication state.

disableCookiePrompt(page: Page)

Blocks TrustArc cookie consent prompts to prevent flaky tests.

login(page: Page, user: string, password: string)

Performs Red Hat SSO login flow.

Parameters:

  • page: Playwright Page object
  • user: Username for authentication
  • password: Password for authentication

ensureLoggedIn(page: Page)

Checks if user is already logged in. If not, performs login using E2E_USER and E2E_PASSWORD environment variables.

Parameters:

  • page: Playwright Page object

APP_TEST_HOST_PORT

Default test host: 'stage.foo.redhat.com:1337'

Environment Variables

  • E2E_USER - Username for authentication
  • E2E_PASSWORD - Password for authentication

Technical Notes

Import Strategy

This package uses playwright imports instead of @playwright/test to avoid the "Requiring @playwright/test second time" error that occurs when using functions in global setup files. This is a Playwright requirement - global setup files must use the core playwright library.

All relative imports include .js extensions for proper ESM module resolution.

Error Handling

The auth functions use standard JavaScript error throwing instead of Playwright's expect assertions. This makes them safe to use in global setup without any dependency chain issues, while still providing clear error messages:

  • 'Proxy config incorrect - Lockdown page detected' - when proxy configuration is wrong
  • 'Invalid login credentials' - when login fails
  • 'Login failed - user greeting not displayed' - when post-login verification fails

License

ISC