Socket
Socket
Sign inDemoInstall

@christianacca/angular-swa-auth-e2e-util

Package Overview
Dependencies
9
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @christianacca/angular-swa-auth-e2e-util

Helper library for faking Azure Static Web App authentication endpoints in a cypress test project


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

public-angular-swa-auth-e2e-util

Helper library for faking Azure Static Web App authentication endpoints in a cypress test project

Usage

1. Install library

npm install @christianacca/angular-swa-auth-e2e-util -D

2. Wire-up to support files

In your cypress test project include the following code in the support files:

// support/add-commands.ts

import { loggedIn, loggedInAs, loggedOut } from '@christianacca/angular-swa-auth-e2e-util';

declare global {
  // eslint-disable-next-line @typescript-eslint/no-namespace
  namespace Cypress {
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    interface Chainable<Subject> {
      loggedIn: typeof loggedIn;
      loggedInAs: typeof loggedInAs;
      loggedOut: typeof loggedOut;
    }
  }
}

//
// -- This is a parent command --
Cypress.Commands.add('loggedIn', loggedIn);
Cypress.Commands.add('loggedInAs', loggedInAs);
Cypress.Commands.add('loggedOut', loggedOut);
// support/global-before-each.ts

import { fakeStaticWebAppAuth } from '@christianacca/angular-swa-auth-e2e-util';

beforeEach(fakeStaticWebAppAuth);
// support/index.ts

import './add-commands';
import './global-before-each';

3. Fake login in your tests

describe('app', () => {
  context('user logged in', () => {
    beforeEach(() => {
      cy.loggedIn();
    });

    it('...', () => {
      cy.visit('/');

      // snip
    });
  });
});

Keywords

FAQs

Last updated on 16 Dec 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc