dh-auth-library 2.0.1 → 2.1.1
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/dist/auth/getLoginHandler.d.ts +2 -2
- package/dist/auth/getSessionHandler.d.ts +4 -2
- package/dist/auth/loginhandlers/digidGemachtigdeLoginHandler.d.ts +1 -1
- package/dist/auth/loginhandlers/digidLoginHandler.d.ts +1 -1
- package/dist/auth/loginhandlers/eHerkenningBewindvoerderLoginHandler.d.ts +9 -0
- package/dist/auth/loginhandlers/eHerkenningLoginHandler.d.ts +9 -0
- package/dist/auth/pages/baseLoginPage.d.ts +25 -0
- package/dist/auth/pages/digidLoginPage.d.ts +3 -3
- package/dist/auth/pages/eHerkenningLoginPage.d.ts +12 -7
- package/dist/auth/pages/index.d.ts +1 -1
- package/dist/auth/sessionHandler.d.ts +1 -1
- package/dist/index.cjs.js +307 -361
- package/dist/index.es.js +308 -362
- package/package.json +1 -1
- package/dist/auth/pages/loginOverzichtPage.d.ts +0 -71
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AuthType } from '../constants/
|
|
1
|
+
import { AuthType } from '../constants/index';
|
|
2
2
|
import { LoginHandler } from './loginHandler';
|
|
3
|
-
import { LoginOptions } from './pages/
|
|
3
|
+
import { LoginOptions } from './pages/index';
|
|
4
4
|
/**
|
|
5
5
|
* Shortcut for creating the login handler for an auth type. Creating the handler directly, e.g.
|
|
6
6
|
* `new DigidLoginHandler(options)`, checks at compile time that the required options are there;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { LoginHandler } from './loginHandler';
|
|
2
|
-
import { TestProfile } from '../constants';
|
|
2
|
+
import { TestProfile } from '../constants/index';
|
|
3
|
+
import { LoginOptionsWithButton } from './pages/index';
|
|
3
4
|
/**
|
|
4
5
|
* @param testProfile the test user to log in
|
|
6
|
+
* @param loginOptionsWithButtons with the login button and the accept cookiebutton if necessary
|
|
5
7
|
* @param loginHandler the login handler for the app the user logs in to, with that app's options, e.g.
|
|
6
8
|
* `new DigidLoginHandler({ loginButton, ... })` or `getLoginHandler(authType, options)`. Required for
|
|
7
9
|
* auth types that need options (`ad-session`, `digid`, `digid_gemachtigde`); left out, the handler
|
|
@@ -17,4 +19,4 @@ import { TestProfile } from '../constants';
|
|
|
17
19
|
*
|
|
18
20
|
* getSessionHandler(digidUser1, openFormsDigid);
|
|
19
21
|
*/
|
|
20
|
-
export declare function getSessionHandler(testProfile: TestProfile, loginHandler?: LoginHandler): import("nl-portal-playwright-libraries").SessionHandler;
|
|
22
|
+
export declare function getSessionHandler(testProfile: TestProfile, loginOptionsWithButtons: LoginOptionsWithButton, loginHandler?: LoginHandler): import("nl-portal-playwright-libraries").SessionHandler;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Page } from '@playwright/test';
|
|
2
2
|
import { Account } from 'nl-portal-playwright-libraries';
|
|
3
|
-
import { LoginOptionsWithButton } from '../pages/loginOverzichtPage';
|
|
4
3
|
import { LoginHandler } from '../loginHandler';
|
|
4
|
+
import { LoginOptionsWithButton } from '../pages/index';
|
|
5
5
|
export declare class DigidGemachtigdeLoginHandler implements LoginHandler {
|
|
6
6
|
private readonly options;
|
|
7
7
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Page } from '@playwright/test';
|
|
2
2
|
import { Account } from 'nl-portal-playwright-libraries';
|
|
3
|
-
import { LoginOptionsWithButton } from '../pages/
|
|
3
|
+
import { LoginOptionsWithButton } from '../pages/index';
|
|
4
4
|
import { LoginHandler } from '../loginHandler';
|
|
5
5
|
export declare class DigidLoginHandler implements LoginHandler {
|
|
6
6
|
private readonly options;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { Page } from '@playwright/test';
|
|
2
2
|
import { Account } from 'nl-portal-playwright-libraries';
|
|
3
3
|
import { LoginHandler } from '../loginHandler';
|
|
4
|
+
import { LoginOptionsWithButton } from '../pages/index';
|
|
4
5
|
export declare class EHerkenningBewindvoerderLoginHandler implements LoginHandler {
|
|
6
|
+
private readonly options;
|
|
7
|
+
/**
|
|
8
|
+
* Create one per app, so every test user that logs in to that app shares its options.
|
|
9
|
+
*
|
|
10
|
+
* @param options the app's DigiD login button (required), and optionally where to start and the
|
|
11
|
+
* app's cookie banner, supplied by the consumer of this library
|
|
12
|
+
*/
|
|
13
|
+
constructor(options: LoginOptionsWithButton);
|
|
5
14
|
/**
|
|
6
15
|
* @param page the Playwright page to perform the login on
|
|
7
16
|
* @param account login details, supplied by the consumer of this library
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { Page } from '@playwright/test';
|
|
2
2
|
import { Account } from 'nl-portal-playwright-libraries';
|
|
3
|
+
import { LoginOptionsWithButton } from '../pages';
|
|
3
4
|
import { LoginHandler } from '../loginHandler';
|
|
4
5
|
export declare class EHerkenningLoginHandler implements LoginHandler {
|
|
6
|
+
private readonly options;
|
|
7
|
+
/**
|
|
8
|
+
* Create one per app, so every test user that logs in to that app shares its options.
|
|
9
|
+
*
|
|
10
|
+
* @param options the app's DigiD login button (required), and optionally where to start and the
|
|
11
|
+
* app's cookie banner, supplied by the consumer of this library
|
|
12
|
+
*/
|
|
13
|
+
constructor(options: LoginOptionsWithButton);
|
|
5
14
|
/**
|
|
6
15
|
* @param page the Playwright page to perform the login on
|
|
7
16
|
* @param account login details, supplied by the consumer of this library
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BasePage } from 'nl-portal-playwright-libraries';
|
|
2
|
+
import { Locator, Page } from '@playwright/test';
|
|
3
|
+
/** {@link LoginOptions} for logins that start from a button in the app (e.g. DigiD), so `loginButton` is required. */
|
|
4
|
+
export type LoginOptionsWithButton = LoginOptions & Required<Pick<LoginOptions, 'loginButton'>>;
|
|
5
|
+
export interface LoginOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Returns the button that starts the login. A function because the page doesn't exist yet when
|
|
8
|
+
* the login handler is created. Required for DigiD; eHerkenning doesn't use these options yet.
|
|
9
|
+
*/
|
|
10
|
+
loginButton?: (page: Page) => Locator;
|
|
11
|
+
/** URL of the page with the login button. Defaults to `PORTAL_BASE_URL`. */
|
|
12
|
+
startUrl?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Returns the button that accepts the app's cookie banner after logging in, so the consent is
|
|
15
|
+
* saved in the session. Left out, no cookie banner is accepted.
|
|
16
|
+
*/
|
|
17
|
+
cookieButton?: (page: Page) => Locator;
|
|
18
|
+
}
|
|
19
|
+
export declare class BaseLoginPage extends BasePage {
|
|
20
|
+
constructor(page: Page);
|
|
21
|
+
/**
|
|
22
|
+
* Accepts the app's cookie banner when the consumer supplied one, so the consent is in the saved session.
|
|
23
|
+
*/
|
|
24
|
+
acceptCookiesForApp(options: LoginOptionsWithButton): Promise<void>;
|
|
25
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Locator, Page } from '@playwright/test';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export declare class DigidLoginPage extends
|
|
2
|
+
import { Account, BasePage } from 'nl-portal-playwright-libraries';
|
|
3
|
+
import { LoginOptionsWithButton } from './baseLoginPage';
|
|
4
|
+
export declare class DigidLoginPage extends BasePage {
|
|
5
5
|
constructor(page: Page);
|
|
6
6
|
/**
|
|
7
7
|
* @param account login details, supplied by the consumer of this library
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Page } from '@playwright/test';
|
|
2
|
-
import { LoginOverzichtPage } from './loginOverzichtPage';
|
|
3
2
|
import { Account } from 'nl-portal-playwright-libraries';
|
|
4
|
-
|
|
3
|
+
import { BaseLoginPage, LoginOptionsWithButton } from './baseLoginPage';
|
|
4
|
+
export declare class EHerkenningLoginPage extends BaseLoginPage {
|
|
5
5
|
private readonly dropdownSelectIdentityProvider;
|
|
6
6
|
private readonly buttonConfirmIdentityProviderSelection;
|
|
7
7
|
private readonly textfieldUsername;
|
|
@@ -19,24 +19,29 @@ export declare class EHerkenningLoginPage extends LoginOverzichtPage {
|
|
|
19
19
|
/**
|
|
20
20
|
* @param fileName path of the storage state file to write the session to
|
|
21
21
|
* @param account login details, supplied by the consumer of this library
|
|
22
|
+
* @param options
|
|
22
23
|
*/
|
|
23
|
-
loginWithEHerkenningAndCreateSession(fileName: string, account: Account): Promise<void>;
|
|
24
|
+
loginWithEHerkenningAndCreateSession(fileName: string, account: Account, options: LoginOptionsWithButton): Promise<void>;
|
|
24
25
|
/**
|
|
25
26
|
* @param account login details, supplied by the consumer of this library
|
|
27
|
+
* @param options
|
|
26
28
|
*/
|
|
27
|
-
loginWithEHerkenning(account: Account): Promise<void>;
|
|
29
|
+
loginWithEHerkenning(account: Account, options: LoginOptionsWithButton): Promise<void>;
|
|
28
30
|
/**
|
|
29
31
|
* @param fileName path of the storage state file to write the session to
|
|
30
32
|
* @param account login details, supplied by the consumer of this library
|
|
33
|
+
* @param options
|
|
31
34
|
*/
|
|
32
|
-
loginWithEHerkenningVestigingAndCreateSession(fileName: string, account: Account): Promise<void>;
|
|
35
|
+
loginWithEHerkenningVestigingAndCreateSession(fileName: string, account: Account, options: LoginOptionsWithButton): Promise<void>;
|
|
33
36
|
/**
|
|
34
37
|
* @param account login details, supplied by the consumer of this library
|
|
38
|
+
* @param options
|
|
35
39
|
*/
|
|
36
|
-
loginWithEHerkenningVestiging(account: Account): Promise<void>;
|
|
40
|
+
loginWithEHerkenningVestiging(account: Account, options: LoginOptionsWithButton): Promise<void>;
|
|
37
41
|
/**
|
|
38
42
|
* @param gemachtigde login details of the authorized representative (bewindvoerder), supplied by the consumer of this library
|
|
43
|
+
* @param options
|
|
39
44
|
* @param file optional path of the storage state file to write the session to
|
|
40
45
|
*/
|
|
41
|
-
loginAsProfessionalBewindvoerder(gemachtigde: Account, file?: string): Promise<void>;
|
|
46
|
+
loginAsProfessionalBewindvoerder(gemachtigde: Account, options: LoginOptionsWithButton, file?: string): Promise<void>;
|
|
42
47
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { ADLoginPage } from './adLoginPage';
|
|
2
2
|
export { DigidLoginPage } from './digidLoginPage';
|
|
3
3
|
export { EHerkenningLoginPage } from './eHerkenningLoginPage';
|
|
4
|
-
export {
|
|
4
|
+
export { BaseLoginPage, type LoginOptionsWithButton, type LoginOptions } from './baseLoginPage';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Account, SessionHandler } from 'nl-portal-playwright-libraries';
|
|
2
2
|
import { LoginHandler } from './loginHandler';
|
|
3
|
-
import { AuthType } from '../constants';
|
|
3
|
+
import { AuthType } from '../constants/index';
|
|
4
4
|
export declare const MAX_SESSION_TIME_IN_MINUTES = 10;
|
|
5
5
|
/**
|
|
6
6
|
* This class creates the correct SessionHandler
|