dh-auth-library 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,6 @@
1
- # NL Portal Playwright Libraries
1
+ # DH Authorizatoin Library
2
2
 
3
- A Playwright library for testing NL Portal implementaties.
4
- test
3
+ A Playwright library for all login implementations in Den Haag
5
4
 
6
5
  it is published an npm package too and should be imported like that
7
6
 
@@ -9,27 +8,39 @@ it is published an npm package too and should be imported like that
9
8
 
10
9
  ## 📦 Purpose
11
10
 
12
- This repository contains the base objects that are needed for testing nl-portal implementations
13
- It is the base for the nl-portal-playwright-template but could also be used directly if wanted
14
- The template however will be the easiest way to setup your testautomation
11
+ Within DenHaag we will have several different repositories which will all have to use certain
12
+ types of login like AD, digid and eHerkenning.
13
+
14
+ In order to prevent each repo to have it's own implementation we created this library which
15
+ will take care of all login logic and even maintains the sessions during the testrun
15
16
 
16
17
  ---
17
18
 
18
19
  ## 🧱 Structure
19
20
 
20
21
  packages/
21
- ├── auth/ # Login en storage-state helpers for api requests and UI tests on localhost, digid and eherkenning
22
- ├── core/ # Constains most util classes
23
- ├── nl-portal/ # NL Portal pages, base_fixture and some utils that help with testing and testdata
22
+ ├── auth/ # Contains all classes for handling login and sessions
23
+ ├── constants/ # Constains accounts and types that can be used
24
24
 
25
25
  ---
26
26
 
27
27
  ## Auth
28
28
 
29
- The auth directory does contain fixtures for digid and eherkenning but you will still need to to create
30
- your own login pages with login logic for this.
31
- The login logic should be added to the session_helper.ts and session_manager.ts
29
+ # api
30
+
31
+ Has the authentication logic for api calls for nl-portal
32
+
33
+ # loginhandlers
34
+
35
+ Has all the login handlers that are needed for the nl-portal-playwright-libraries
36
+
37
+ # pages
38
+
39
+ Has all the login pages and the login overview page
40
+
41
+ # utils
32
42
 
43
+ Has the sessionFileHelper which takes care of the filename for each session
33
44
 
34
45
  ## Publishing to npm
35
46
 
@@ -12,6 +12,6 @@ export type ApiFixtures = {
12
12
  * Per specfile it is not problem but this should be done in every specfile to assure a valid token
13
13
  *
14
14
  * @param baseTest
15
- * @param handlerResolver
15
+ * @param handler
16
16
  */
17
- export declare function getApiTokenFromSession(baseTest: typeof base, handlerResolver: () => SessionHandler): import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & ApiFixtures, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions>;
17
+ export declare function getApiTokenFromSession(baseTest: typeof base, handler: SessionHandler): import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & ApiFixtures, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions>;
@@ -1,3 +1,2 @@
1
- export * from './apiAuthentication';
2
1
  export * from './apiTokenHelper';
3
2
  export * from './sessionHandlerResolvers';
@@ -1,6 +1,3 @@
1
- export declare function getBurgerSessionHandler(): import("nl-portal-playwright-libraries").SessionHandler;
2
- export declare function getBedrijfSessionHandler(): import("nl-portal-playwright-libraries").SessionHandler;
3
- export declare function getVestigingSessionHandler(): import("nl-portal-playwright-libraries").SessionHandler;
4
- export declare function getDigidGemachtigdeSessionHandler(): import("nl-portal-playwright-libraries").SessionHandler;
5
- export declare function getEHerkenningBewindvoerderSessionHandler(): import("nl-portal-playwright-libraries").SessionHandler;
6
- export declare function getAdSessionHandler(): import("nl-portal-playwright-libraries").SessionHandler;
1
+ import { Account } from 'nl-portal-playwright-libraries';
2
+ import { AuthType } from '../../constants/authTypes';
3
+ export declare function getSessionHandler(authType: AuthType, account: Account): import("nl-portal-playwright-libraries").SessionHandler;
@@ -10,6 +10,6 @@ export declare class DigidLoginPage extends LoginOverzichtPage {
10
10
  * Je krijgt dan een speciaal scherm waar je moet bevestigen voordat je door kan
11
11
  */
12
12
  handleAnySpecialADLoginScreen(): Promise<void>;
13
- loginWithDigid(account?: Account, gemachtigde?: boolean): Promise<import("@playwright/test").Response>;
13
+ loginWithDigid(account: Account, gemachtigde?: boolean): Promise<import("@playwright/test").Response>;
14
14
  loginAlsDigidGemachtigde(): Promise<void>;
15
15
  }
@@ -12,11 +12,10 @@ export declare class EHerkenningLoginPage extends LoginOverzichtPage {
12
12
  private readonly inputBsn;
13
13
  private readonly buttonZoek;
14
14
  constructor(page: Page);
15
- probeerInTeLoggenMetEHerkenning(account?: Account): Promise<void>;
16
- loginWithEHerkenningAndCreateSession(fileName: string, account?: Account): Promise<void>;
17
- loginWithEHerkenning(account?: Account): Promise<void>;
18
- loginWithEHerkenningVestigingAndCreateSession(fileName: string, account?: Account): Promise<void>;
19
- loginWithEHerkenningVestiging(account?: Account): Promise<void>;
20
- loginAlsProfessioneelBewindvoerder(gemachtigde?: Account, file?: string): Promise<void>;
21
- valideerDatNietGemachtigdBerichtZichtbaarIs(): Promise<void>;
15
+ probeerInTeLoggenMetEHerkenning(account: Account): Promise<void>;
16
+ loginWithEHerkenningAndCreateSession(fileName: string, account: Account): Promise<void>;
17
+ loginWithEHerkenning(account: Account): Promise<void>;
18
+ loginWithEHerkenningVestigingAndCreateSession(fileName: string, account: Account): Promise<void>;
19
+ loginWithEHerkenningVestiging(account: Account): Promise<void>;
20
+ loginAlsProfessioneelBewindvoerder(gemachtigde: Account, file?: string): Promise<void>;
22
21
  }
@@ -1,6 +1,6 @@
1
1
  import { Account, SessionHandler } from 'nl-portal-playwright-libraries';
2
- import { AuthType } from '../constants/authTypes';
3
2
  import { LoginHandler } from '../constants/loginHandler';
3
+ import { AuthType } from '../constants';
4
4
  export declare const MAX_SESSION_TIME_IN_MINUTES = 10;
5
5
  /**
6
6
  * This class creates the correct SessionHandler
@@ -1,14 +1,15 @@
1
1
  import { Browser } from '@playwright/test';
2
+ import { Account } from 'nl-portal-playwright-libraries';
2
3
  /**
3
4
  * Easy way to create the filenames for the sessions
4
5
  */
5
6
  export declare class SessionFileHelper {
6
- static getLocalhostFileName(browser: Browser): string;
7
- static getLocalhostFileNameBedrijf(browser: Browser): string;
8
- static getDigidFileName(browser: Browser): string;
9
- static getDigidGemachtigdeFileName(browser: Browser): string;
10
- static getEHerkenningFileName(browser: Browser): string;
11
- static getEHerkenningVestigingFileName(browser: Browser): string;
12
- static getEHerkenningBewindvoerderFileName(browser: Browser): string;
13
- static getADFileName(browser: Browser): string;
7
+ static getLocalhostFileName(browser: Browser, account: Account): string;
8
+ static getLocalhostFileNameBedrijf(browser: Browser, account: Account): string;
9
+ static getDigidFileName(browser: Browser, account: Account): string;
10
+ static getDigidGemachtigdeFileName(browser: Browser, account: Account): string;
11
+ static getEHerkenningFileName(browser: Browser, account: Account): string;
12
+ static getEHerkenningVestigingFileName(browser: Browser, account: Account): string;
13
+ static getEHerkenningBewindvoerderFileName(browser: Browser, account: Account): string;
14
+ static getADFileName(browser: Browser, account: Account): string;
14
15
  }
@@ -1,34 +1,12 @@
1
1
  import { AuthType } from './authTypes';
2
- export type AccountType = 'burger' | 'bedrijf' | 'vestiging' | 'digid-gemachtigde';
2
+ /**
3
+ * Interface for TestProfiles
4
+ * accountId should be used for identifying the account
5
+ * authType is used to determine the type of authentication (digid, eHerkenning etc)
6
+ * id can be used for extra information like bsn number or kvk number
7
+ */
3
8
  export interface TestProfile {
4
- accountType: AccountType;
9
+ accountId: string;
5
10
  authType: AuthType;
6
11
  id: string;
7
12
  }
8
- export declare const profiles: {
9
- burger: {
10
- accountType: "burger";
11
- authType: "digid";
12
- id: string;
13
- };
14
- bedrijf: {
15
- accountType: "bedrijf";
16
- authType: "eherkenning";
17
- id: string;
18
- };
19
- vestiging: {
20
- accountType: "vestiging";
21
- authType: "eherkenning_vestiging";
22
- id: string;
23
- };
24
- gemachtigde: {
25
- accountType: "digid-gemachtigde";
26
- authType: "digid_gemachtigde";
27
- id: string;
28
- };
29
- bewindvoerder: {
30
- accountType: "bedrijf";
31
- authType: "eherkenning_bewindvoerder";
32
- id: string;
33
- };
34
- };
@@ -1 +1,4 @@
1
+ /**
2
+ * All possible types of authentication within DenHaag
3
+ */
1
4
  export type AuthType = 'localhost_burger' | 'localhost_bedrijf' | 'digid' | 'digid_gemachtigde' | 'eherkenning' | 'eherkenning_vestiging' | 'eherkenning_bewindvoerder' | 'ad-session';
@@ -1,6 +1,3 @@
1
- export * from './accounts';
1
+ export * from './loginHandler';
2
2
  export * from './accountTypes';
3
3
  export * from './authTypes';
4
- export * from './loginHandler';
5
- export * from './testAccounts';
6
- export * from './testProfiles';