From 33f45e3f53b72d1cfbb76e87972d3465896a2d72 Mon Sep 17 00:00:00 2001 From: Debbie O'Brien Date: Tue, 19 Jul 2022 15:24:50 +0200 Subject: [PATCH] docs(debug): fix lang specific code (#15713) Co-authored-by: Max Schmitt --- docs/src/auth.md | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/docs/src/auth.md b/docs/src/auth.md index 661aa9f06e..a4dbb5c281 100644 --- a/docs/src/auth.md +++ b/docs/src/auth.md @@ -148,14 +148,48 @@ var context = await browser.NewContextAsync(new() ``` ### Code generation +* langs: js Logging in via the UI and then reusing authentication state can be combined to implement **login once and run multiple scenarios**. The lifecycle looks like: 1. Run tests (for example, with `npm run test`). -1. Login via UI and retrieve authentication state. +2. Login via UI and retrieve authentication state. * In Jest, this can be executed in [`globalSetup`](https://jestjs.io/docs/en/configuration#globalsetup-string). -1. In each test, load authentication state in `beforeEach` or `beforeAll` step. +3. In each test, load authentication state in `beforeEach` or `beforeAll` step. + +This approach will also **work in CI environments**, since it does not rely on any external state. + +### Code generation +* langs: python + +Logging in via the UI and then reusing authentication state can be combined to implement **login once and run multiple scenarios**. The lifecycle looks like: + +1. Run tests (for example, with `pytest`). +2. Login via UI and retrieve authentication state. +3. In each test, load authentication state using `autouse=True` fixture with `scope=function`. + +This approach will also **work in CI environments**, since it does not rely on any external state. + +### Code generation +* langs: csharp + +Logging in via the UI and then reusing authentication state can be combined to implement **login once and run multiple scenarios**. The lifecycle looks like: + +1. Run tests (for example, with `dotnet test`). +2. Login via UI and retrieve authentication state. +3. In each test, load authentication state in `SetUp`. + +This approach will also **work in CI environments**, since it does not rely on any external state. + +### Code generation +* langs: java + +Logging in via the UI and then reusing authentication state can be combined to implement **login once and run multiple scenarios**. The lifecycle looks like: + +1. Run tests (for example, with `mvn test`). +2. Login via UI and retrieve authentication state. +3. In each test, load authentication state in `@beforeEach` or `@beforeAll` step. This approach will also **work in CI environments**, since it does not rely on any external state.