Skip to content

Commit

Permalink
refactor(playwrighttesting): jsdocs example fixes and doc markdown ch…
Browse files Browse the repository at this point in the history
…anges (Azure#31028)

### Packages impacted by this PR

@azure/microsoft-playwright-testing

### Issues associated with this PR


### Describe the problem that is addressed by this PR


### What are the possible designs available to address the problem? If
there are more than one possible design, why was the one in this PR
chosen?


### Are there test cases added in this PR? _(If not, why?)_


### Provide a list of related PRs _(if any)_


### Command used to generate this PR:**_(Applicable only to SDK release
request PRs)_

### Checklists
- [ ] Added impacted package name to the issue description
- [ ] Does this PR needs any fixes in the SDK Generator?** _(If so,
create an Issue in the
[Autorest/typescript](https://github.com/Azure/autorest.typescript)
repository and link it here)_
- [ ] Added a changelog (if necessary)

---------

Co-authored-by: Siddharth Singha Roy <ssingharoy@microsoft.com>
  • Loading branch information
Sid200026 and Siddharth Singha Roy authored Sep 9, 2024
1 parent 678e1ba commit 8856e48
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 25 deletions.
5 changes: 1 addition & 4 deletions sdk/playwrighttesting/microsoft-playwright-testing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ Follow these steps to run your existing Playwright test suite with the service.
|**Azure Subscription** | Select an Azure subscription where you want to create the workspace. |
|**Region** | This is where test run data will be stored for your workspace. |

> [!NOTE]
> If you don't see this screen, select an existing workspace and go to the next section.
### Install Microsoft Playwright Testing package
Expand All @@ -56,8 +55,7 @@ The service configuration serves to:
- Add Microsoft Playwright Testing reporting to your config.
- Override timeouts for service operations, if needed.

> [!NOTE]
> Make sure your project uses @playwright/test version 1.37 or above.
> Make sure your project uses @playwright/test version 1.47 or above.
### Obtain region endpoint

Expand All @@ -73,7 +71,6 @@ Ensure that the `PLAYWRIGHT_SERVICE_URL` that you obtained in previous step is a

We recommend using `dotenv` module to manage your environment. With `dotenv` you'll be using the `.env` file to define your environment variables.

> [!IMPORTANT]
> Don't forget to add `.env` file to your `.gitignore` file in order to not leak your secrets.
```sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ The service configuration serves to:
- Add Microsoft Playwright Testing reporting to your config.
- Override timeouts for service operations, if needed.

> [!NOTE]
> Make sure your project uses @playwright/test version 1.37 or above.
> Make sure your project uses @playwright/test version 1.47 or above.

### Obtain region endpoint

Expand All @@ -48,7 +47,6 @@ Ensure that the `PLAYWRIGHT_SERVICE_URL` that you obtained in previous step is a

We recommend using `dotenv` module to manage your environment. With `dotenv` you'll be using the `.env` file to define your environment variables.
> [!IMPORTANT]
> Don't forget to add `.env` file to your `.gitignore` file in order to not leak your secrets.

```sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ The service configuration serves to:
- Add Microsoft Playwright Testing reporting to your config.
- Override timeouts for service operations, if needed.

> [!NOTE]
> Make sure your project uses @playwright/test version 1.37 or above.
> Make sure your project uses @playwright/test version 1.47 or above.

### Configure authentication settings

Expand Down Expand Up @@ -81,7 +80,6 @@ Ensure that the `PLAYWRIGHT_SERVICE_ACCESS_TOKEN` and `PLAYWRIGHT_SERVICE_URL` t
We recommend using `dotenv` module to manage your environment. With `dotenv` you'll be using the `.env` file to define your environment variables.
> [!IMPORTANT]
> Don't forget to add `.env` file to your `.gitignore` file in order to not leak your secrets.
```sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ The service configuration serves to:
- Add Microsoft Playwright Testing reporting to your config.
- Override timeouts for service operations, if needed.

> [!NOTE]
> Make sure your project uses @playwright/test version 1.37 or above.
> Make sure your project uses @playwright/test version 1.47 or above.

### Obtain region endpoint

Expand All @@ -48,7 +47,6 @@ Ensure that the `PLAYWRIGHT_SERVICE_URL` that you obtained in previous step is a

We recommend using `dotenv` module to manage your environment. With `dotenv` you'll be using the `.env` file to define your environment variables.
> [!IMPORTANT]
> Don't forget to add `.env` file to your `.gitignore` file in order to not leak your secrets.

```sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ The service configuration serves to:
- Add Microsoft Playwright Testing reporting to your config.
- Override timeouts for service operations, if needed.

> [!NOTE]
> Make sure your project uses @playwright/test version 1.37 or above.
> Make sure your project uses @playwright/test version 1.47 or above.

### Configure authentication settings

Expand Down Expand Up @@ -81,7 +80,6 @@ Ensure that the `PLAYWRIGHT_SERVICE_ACCESS_TOKEN` and `PLAYWRIGHT_SERVICE_URL` t
We recommend using `dotenv` module to manage your environment. With `dotenv` you'll be using the `.env` file to define your environment variables.
> [!IMPORTANT]
> Don't forget to add `.env` file to your `.gitignore` file in order to not leak your secrets.
```sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export type ConnectOptions = {
*
* Maximum time in milliseconds to wait for the connection to be established.
*
* @defaultValue `0`
* @defaultValue `30000`
*/
timeout?: number;

Expand All @@ -82,8 +82,22 @@ export type ConnectOptions = {
*
* @example
* ```
* const { wsEndpoint, options }: BrowserConnectOptions = await getConnectOptions();
* const browser = await (playwright[browserName] as BrowserType).connect(wsEndpoint, options);
* import playwright, { test, expect, BrowserType } from "@playwright/test";
* import { getConnectOptions, BrowserConnectOptions } from "@azure/microsoft-playwright-testing";
*
* test("has title", async ({ browserName }) => {
* const { wsEndpoint, options } : BrowserConnectOptions = await getConnectOptions();
* const browser = await (playwright[browserName] as BrowserType).connect(wsEndpoint, options);
* const context = await browser.newContext();
* const page = await context.newPage();
*
* await page.goto("https://playwright.dev/");
* await expect(page).toHaveTitle(/Playwright/);
*
* await page.close();
* await context.close();
* await browser.close();
* });
* ```
*/
export type BrowserConnectOptions = EndpointOptions & {
Expand Down Expand Up @@ -111,7 +125,7 @@ export type PlaywrightConfigInput = {
*
* Path to the global teardown file. This file will be required and run after all the tests. It must export a single
* function. See also
* {@link https://playwright.dev/docs/api/class-testconfig#test-config-global-setup | testConfig.globalSetup}.
* {@link https://playwright.dev/docs/api/class-testconfig#test-config-global-teardown | testConfig.globalTeardown}.
*
* Learn more about {@link https://playwright.dev/docs/test-global-setup-teardown | global setup and teardown}.
*/
Expand Down Expand Up @@ -174,7 +188,7 @@ export type PlaywrightServiceAdditionalOptions = {
*
* Maximum time in milliseconds to wait for the connection to be established.
*
* @defaultValue `0`
* @defaultValue `30000`
*/
timeout?: number;

Expand Down Expand Up @@ -249,7 +263,7 @@ export type ApiErrorMessage = {
* import { defineConfig } from "@playwright/test";
*
* export default defineConfig({
* reporter: [["@azure/microsoft-playwright-testing", {
* reporter: [["@azure/microsoft-playwright-testing/reporter", {
* enableGitHubSummary: true
* }]],
* });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ const getServiceConfig = (
* ```
* import playwright, { test, expect, BrowserType } from "@playwright/test";
* import { getConnectOptions } from "@azure/microsoft-playwright-testing";
* import playwrightConfig from "./playwright.config";
*
* test('has title', async ({ browserName }) => {
* const { wsEndpoint, options } = await getConnectOptions();
Expand All @@ -131,7 +130,7 @@ const getServiceConfig = (
* await page.goto('https://playwright.dev/');
* await expect(page).toHaveTitle(/Playwright/);
*
* await page.close();
* await page.close();
* await context.close();
* await browser.close();
* });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import { ServiceErrorMessageConstants } from "../common/messages";
* import { defineConfig } from "@playwright/test";
*
* export default defineConfig({
* reporter: [["@azure/microsoft-playwright-testing"]]
* reporter: [["@azure/microsoft-playwright-testing/reporter"]]
* });
* ```
*/
Expand Down

0 comments on commit 8856e48

Please sign in to comment.