Commit graph

9297 commits

Author SHA1 Message Date
Dmitry Gozman 9ede66abd6 cherry-pick(#18997): fix(reuse): stop pending operations upon reuse/disconnect
SHA 503f8f51dc
2022-11-22 14:01:10 -10:00
Pavel Feldman 76dc43e9ba cherry-pick(#18993): fix(electron): tolerate connection closed during quit 2022-11-22 11:53:04 -08:00
Andrey Lushnikov f38b2c86eb
chore: mark v1.28.1 (#18974) 2022-11-21 16:09:26 -08:00
Andrey Lushnikov 0d5098b7c0
cherry-pick(#18968): Revert "fix(webserver): do not spawn webserver as a new process group" (#18973)
This reverts commit 26044c11c0 (PR #18564)

Fixes #18865
2022-11-21 15:54:56 -08:00
Dmitry Gozman bbe27dc564 cherry-pick(#18929): fix(role selector): expanded=false does not match elements without aria-expanded
Fixes #18920.
2022-11-21 15:24:17 -08:00
Pavel Feldman 226eedf019 cherry-pick(#18972): fix(electron): consistently emit ready event after app is loaded 2022-11-21 15:16:19 -08:00
Playwright Service 36f8a6399c
chery-pick(#18884): docs(locator): code snippet fixes (#18887) 2022-11-18 08:20:27 +01:00
Yury Semikhatsky d284219c32
cherry-pick(#18854): docs: Java, .NET, Python release notes 1.28 (#18858) 2022-11-16 11:59:31 -10:00
Dmitry Gozman 8f9bf0f0ac cherry-pick(#18818): chore: multiply overloaded options in csharp
This way we'll get the same treatment in docs generator as well as
dotnet api generator.

This also adds non-suffixed aliases for string options, e.g. `Name` in
addition to `NameString` and `NameRegex`.

Fixes #18407.
2022-11-15 14:22:38 -10:00
Dmitry Gozman c3335e4619 cherry-pick(#18799): chore: allow py code blocks for python
Turns out, we have some snippets that use `py` instead of `python`.
2022-11-15 14:21:43 -10:00
Andrey Lushnikov 5459be0585
cherry-pick(#18768): chore: verify tab groups in docs during lint (#18837)
This extracts the logic from playwright.dev so that we get early
warnings.

Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2022-11-15 16:21:02 -08:00
Pavel Feldman 553a211b65 cherry-pick(#18832): docs: remove images from locators.md 2022-11-15 13:14:59 -08:00
Andrey Lushnikov f7087bfe3b
cherry-pick(#18830): chore: update WebKit browser version to 16.4 (#18831) 2022-11-15 13:11:02 -08:00
Andrey Lushnikov 2720c72f65
chore: mark 1.28.0 (#18754) 2022-11-15 11:52:35 -08:00
Andrey Lushnikov 74314712fb
cherry-pick(#18802): doc: version 1.28 release notes (#18829) 2022-11-15 11:52:08 -08:00
Dmitry Gozman ba1a1bd99d cherry-pick(#18819): fix(locators): frameLocator().nth serialized correctly
Fixes #18798.
2022-11-15 10:59:34 -08:00
Pavel Feldman 09c2d891ef cherry-pick(#18822): chore(electron): filter test args out 2022-11-15 10:49:55 -08:00
Pavel Feldman e20be6c01e cherry-pick(#18804): fix(electron): stall node while browser is starting 2022-11-15 09:57:23 -08:00
Yury Semikhatsky 5ceac3fe5d
cherry-pick(#18800): chore: hide TestProject.setup and TestInfo.storage (#18803) 2022-11-14 19:02:02 -08:00
Pavel Feldman c6d7cb4fd8 cherry-pick(#18801): fix: recorder dark theme and strict explore locator parser 2022-11-14 16:50:03 -08:00
Pavel Feldman 2fd36db85e cherry-pick(#18796): chore: ignore untrusted clicks when recording 2022-11-14 15:37:07 -08:00
Yury Semikhatsky db93e9766e
cherry-pick(#18791): Revert "chore(driver): roll driver to recent Nod… (#18794)
…e.js LTS version (#18636)"

The new node resolves loalhost to ::1 by default which breaks API tests
in the ports (Java in particular). Reverting to the previous LTS to
allow some time to implement happy eyeballs algorithm on our end by next
release.

This reverts commit 63a0b75186. Reference
https://github.com/microsoft/playwright/issues/18790
2022-11-14 13:58:13 -08:00
Dmitry Gozman 0cf4d9455d cherry-pick(#18719): fix(getByRole): name and exact
Following the `getByText()` and other methods:

- By default, matching is substring and case-insensitive. Before, it was
only case-insensitive, but not substring.
- With new option `exact: true`, matching is full string and
case-sensitive.
- Matching always normalizes whitespace.
- Codegen generates `exact: false` by default.
- `internal:role` treats `[name="foo"i]` as non-exact match.

Various fixes:
- Updated `getByRole` docs to match the reality.
- Locator generator edge cases.
2022-11-14 08:05:50 -10:00
Pavel Feldman 2e484b46a2 Revert "chore: support narrow terminal windows for messages (#18714)"
This reverts commit 23171c5037.
2022-11-14 10:03:29 -08:00
Andrey Lushnikov 251cc9e229
chore: fix docs (#18751) 2022-11-11 13:44:40 -08:00
Andrey Lushnikov 7685c929bf
chore: use '--disable-component-update' flag to avoid component updates (#18745) 2022-11-11 13:44:09 -08:00
sand4rt 46559a37c1
fix(ct): setting ctTemplateDir does not work (#18152)
closes: https://github.com/microsoft/playwright/issues/18116
2022-11-11 09:52:39 -08:00
Debbie O'Brien 2e84c63f0d
docs: update locators in getting started (#18738) 2022-11-11 16:24:26 +01:00
Debbie O'Brien ad5fe28416
docs: improve locators examples and flow (#18548) 2022-11-11 16:23:00 +01:00
Andrey Lushnikov 26044c11c0
fix(webserver): do not spawn webserver as a new process group (#18564)
This patch stops using `processLauncher` to launch web servers. Process
Launcher
will spawn a new process group which is separate from test runner.

This might result in unexpected behavior, e.g. `kill -sigkill
-<testrunnerpid>` will orphan web server process.

Instead, this patch simply spawns web server and sends `SIGTERM` to it
when ready.
2022-11-10 22:30:06 -08:00
Pavel Feldman 2841b0b3dc fix: address ff test failure with new event mode 2022-11-10 17:31:43 -08:00
Andrey Lushnikov f3a99fdd69
chore: address API review comments for the snapshotPathTemplate (#18716)
This patch:
- updates documentation to lead users from `TestConfig.snapshotDir` and
  `testInfo.snapshotSuffix` to `TestConfig.snapshotPathTemplate` as a
  better and more flexible alternative.
- drops `{snapshotSuffix}` from documentation
- stops using `snapshotSuffix = ''` in our own tests and switches us
  to the `snapshotPathTemplate`.
- adds `{testName}` token.
2022-11-10 17:23:57 -08:00
Pavel Feldman d5eb74fa5d
chore: allow toggling recorder/traceviewer color modes (#18718)
Fixes: https://github.com/microsoft/playwright/issues/18700
2022-11-10 17:20:09 -08:00
Andrey Lushnikov dfb4ad388a
feat: support custom png comparator (#18689)
This way we might experiment with different custom PNG comparators
for VRT.
2022-11-10 16:16:05 -08:00
Pavel Feldman e42583f477
chore: soften selectors and hit target colors (#18709)
Fixes: https://github.com/microsoft/playwright/issues/18618
2022-11-10 16:04:12 -08:00
Chris Alley 1ec614bfc4
docs: fix grammar within class test API documentation (#18627) 2022-11-10 15:53:48 -08:00
Andrey Lushnikov 23171c5037
chore: support narrow terminal windows for messages (#18714)
This patch starts using a message box that's not really a box and thus
is better behaving on a narrow-width terminals.

Before:
<img width="744" alt="image"
src="https://user-images.githubusercontent.com/746130/201216551-abbac0f8-71b4-413f-9f4e-159c7123ef3d.png">

After:
<img width="745" alt="image"
src="https://user-images.githubusercontent.com/746130/201216504-25257727-06c8-4ae9-8557-a2d937b7ca0b.png">

Signed-off-by: Andrey Lushnikov <aslushnikov@gmail.com>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
2022-11-10 15:50:52 -08:00
Andrey Lushnikov db826c9c8c
chore: drive-by fixes for the snapshotPathTemplate (#18715)
- Use `snapshotPathTemplate` for docker screenshots in html-reporter
- Mark the snapshot path template test as slow since it re-spawns
  worker for each project.
- Fix docker smoke tests
2022-11-10 15:50:13 -08:00
Max Schmitt 56d7d47d43
fix(codegen): make select work with size attribute (#18712)
Fixes https://github.com/microsoft/playwright/issues/18711
2022-11-10 15:06:53 -08:00
Yury Semikhatsky 0765182a4d
fix: conversion to snake case (#18707)
Fixes https://github.com/microsoft/playwright/issues/18695
2022-11-10 14:54:07 -08:00
Dmitry Gozman 194abc35cd
Revert #18561 "feat(test runner): test.reset() to reset options to default/config value" (#18704)
This reverts commit 6fef227f43.

Not shipping in 1.28.
2022-11-10 14:45:05 -08:00
Pavel Feldman ac25fdd74b
chore: fix ff tests with new events mode (#18708) 2022-11-10 12:59:27 -08:00
Dmitry Gozman 6d456d30dc
docs: improve test.describe.configure() (#18705) 2022-11-10 12:29:38 -08:00
Dmitry Gozman 7c80b77c57
feat(clear): remove clear() methods from all classes except Locator (#18703)
The preferred way is to use the locator, so we should not encourage the
use of `ElementHandle` or `Page` in the new APIs.
2022-11-10 12:29:14 -08:00
Pavel Feldman ca2e7ef199
chore: report paused signal to the debug controller clients (#18701) 2022-11-10 12:15:29 -08:00
Andrey Lushnikov f52fa4ceba
chore(snapshotPathTemplate): address review comments (#18702) 2022-11-10 11:37:41 -08:00
Dante Monaldo e6a1bdffee
docs(auth): fix session storage examples (#18686)
Co-authored-by: Dante <dante@usebasis.co>
2022-11-10 09:43:42 -08:00
Pavel Feldman c25e67a0e7
chore: conditionally dispatch network events (#18687) 2022-11-09 21:10:57 -08:00
Dmitry Gozman cafa558845
fix(codegen): update priorites in selector generator (#18688)
- prefer `role=checkbox` over `input[type=checkbox]`
- prefer `#id` over `input[type=checkbox]` and `role=checkbox`
- prefer `text=foo` over `internal:has-text=foo`
- ignore `none` and `presentation` roles
- remove non-strict support
2022-11-09 17:22:13 -08:00
Andrey Lushnikov 6d491f928d
feat(playwright-test): introduce snapshotPathTemplate configuration (#18568)
This configuration option allows to set a string with template
values for precise control over snapshot path location.

An example of `snapshotPathTemplate` usage:

```ts
// playwright.config.ts
// Notice the `testDir` configuration!
export default {
  testDir: './tests',
  snapshotPathTemplate: './__screenshots__/{platform}/{projectName}/{testFilePath}/{arg}{ext}',
}
```

Currently supported "magic tokens" inside the `snapshotPathTemplate`
are:

- `{testDir}` - project's `testDir`
- `{snapshotDir}` - project's `snapshotDir`
- `{platform}` - `process.platform`
- `{projectName}` - Project's sanitized name
- `{testFileDir}` - Directories in relative path from `testDir` to test
  file path (e.g. `page/` in the example below)
- `{testFileName}` - Test file name (with extension) (e.g.
  `page-click.spec.ts` in the example below)
- `{testFilePath}` - Relative path from `testDir` to test file path
  (e.g. `page/page-click.spec.ts` in the example below)
- `{ext}` - snapshot extension (with dots)
- `{arg}` - joined snapshot name parts, without extension (e.g.
`foo/bar/baz` in the example below)
- `{snapshotSuffix}` - `testInfo.snapshotSuffix` value.

Consider the following file structure:

```
playwright.config.ts
tests/
└── page/
    └── page-click.spec.ts
```

The following `page-click.spec.ts`:

```ts
// page-click.spec.ts
import { test, expect } from '@playwright/test';

test('should work', async ({ page }) => {
  await expect(page).toHaveScreenshot(['foo', 'bar', 'baz.png']);
});
```

Fixes #7792
2022-11-09 15:29:07 -08:00