Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into feat/downloadTrace
Browse files Browse the repository at this point in the history
* upstream/master: (33 commits)
  chore: migrate expect(locator).toMatchText to protocol (microsoft#9117)
  browser(webkit): fix text padding (microsoft#9114)
  test: unflake "should have correct snapshot size" (microsoft#9099)
  fix: make Serializable type any (microsoft#9059)
  feat(test runner): add some fixture debugging (microsoft#8918)
  chore(typescript): bump typescript to v4.4.3 (microsoft#9087)
  test: add failing WebKit navigation test (microsoft#9097)
  fix(firefox): use global eval in injected script (microsoft#9101)
  feat(launch): connect to process.env.SELENIUM_REMOTE_URL instead of local launch (microsoft#9056)
  test: unflake "should close the context without awaiting the failed download" (microsoft#9094)
  chore: simplify dom tasks (microsoft#9089)
  test: unflake inspector/pause.spec.ts (microsoft#9096)
  test: unflake "should fail when frame detaches" (microsoft#9095)
  test: unflake "should timeout in socket while connecting" (microsoft#9093)
  fix(junit): produce a single system-out entry (microsoft#9091)
  fix(css selector): absolutize relative CSS selectors (microsoft#9088)
  feat(fetch): support options in playwright._newRequest (microsoft#9061)
  chore(registry): refactor logic of what browsers to download to top level (microsoft#9078)
  chore(babel): rename .babelrc to babel.config.json (microsoft#9076)
  docs: improve ignorehttpserrors description (microsoft#9081)
  ...
  • Loading branch information
sidharthv96 committed Sep 24, 2021
2 parents 1678023 + 0908dc9 commit c82284a
Show file tree
Hide file tree
Showing 89 changed files with 2,868 additions and 938 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/tests_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ on:
- release-*
paths:
- '.github/workflows/tests_docker.yml'
- '**/Dockerfile'
- '**/Dockerfile*'
- 'browsers.json'
- 'package.json'
pull_request:
paths:
- '.github/workflows/tests_docker.yml'
- '**/Dockerfile'
- '**/Dockerfile*'
- 'browsers.json'
- 'package.json'
branches:
Expand Down Expand Up @@ -47,16 +47,19 @@ jobs:
run: |
npm run clean
rm -rf node_modules/
# The whole folder has to be world-writable to avoid UID conflicts between this mount and docker.
chmod -R 777 .
if [[ ${{ matrix.user }} == 'root' ]]; then
sudo chown -R 0 $(pwd)
else
sudo chown -R 1000 $(pwd)
fi
- name: Launch container
run: docker run --rm -v $(pwd):/tmp/playwright --name playwright-docker-${{matrix.tag}}-test -d -t playwright:localbuild-${{ matrix.tag }} /bin/bash
run: docker run --rm --user=${{ matrix.user }} -v $(pwd):/tmp/playwright --workdir /tmp/playwright/ --name playwright-docker-${{ matrix.tag }}-test -d -t playwright:localbuild-${{ matrix.tag }} /bin/bash
- name: Run "npm ci" inside docker
run: docker exec --workdir /tmp/playwright/ --user=${{ matrix.user }} playwright-docker-${{matrix.tag}}-test npm ci
run: docker exec playwright-docker-${{ matrix.tag }}-test npm ci
- name: Run "npm run build" inside docker
run: docker exec --workdir /tmp/playwright/ --user=${{ matrix.user }} playwright-docker-${{matrix.tag}}-test npm run build
run: docker exec playwright-docker-${{ matrix.tag }}-test npm run build
- name: Run "npm run test" inside docker
run: docker exec --workdir /tmp/playwright/ --user=${{ matrix.user }} -e INSIDE_DOCKER=1 -e CI=1 playwright-docker-${{matrix.tag}}-test xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" npm run test
run: docker exec -e INSIDE_DOCKER=1 -e CI=1 playwright-docker-${{ matrix.tag }}-test xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" npm run test
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
if: always()
- uses: actions/upload-artifact@v1
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions browser_patches/webkit/BUILD_NUMBER
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
1548
Changed: dpino@igalia.com Fri Sep 17 17:38:21 UTC 2021
1549
Changed: max@schmitt.mx Thu 23 Sep 2021 21:05:36 CEST
13 changes: 0 additions & 13 deletions browser_patches/webkit/patches/bootstrap.diff
Original file line number Diff line number Diff line change
Expand Up @@ -5756,19 +5756,6 @@ index 16edb3bc689b8e2dde17597b642b706c1343e1f5..f363b2ca2410f22cff8d6ad908a88527
~UserGestureEmulationScope();

private:
diff --git a/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp b/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp
index 39e185d538e7e3970db879ca0d2934478815591e..de5d5b922256d73dc1391c01e11478bcdd92c03a 100644
--- a/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp
+++ b/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp
@@ -250,7 +250,7 @@ void LineLayout::prepareLayoutState()

auto& rootGeometry = m_layoutState.ensureGeometryForBox(rootLayoutBox());
rootGeometry.setContentBoxWidth(flow.contentSize().width());
- rootGeometry.setPadding(Layout::Edges { { flow.paddingStart(), flow.paddingEnd() }, { flow.paddingBefore(), flow.paddingAfter() } });
+ rootGeometry.setPadding(Layout::Edges{});
rootGeometry.setBorder(Layout::Edges { { flow.borderStart(), flow.borderEnd() }, { flow.borderBefore(), flow.borderAfter() } });
rootGeometry.setHorizontalMargin({ });
rootGeometry.setVerticalMargin({ });
diff --git a/Source/WebCore/loader/CookieJar.h b/Source/WebCore/loader/CookieJar.h
index 982691dd2dfe2f65201370a12302b5086703c126..4af72beb3b1405ffac78e89e7fbb2b14d6647903 100644
--- a/Source/WebCore/loader/CookieJar.h
Expand Down
29 changes: 29 additions & 0 deletions docs/src/api/class-playwright.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,35 @@ class PlaywrightExample
}
```

## async method: Playwright._newRequest
* langs: js
- returns: <[FetchRequest]>

**experimental** Creates new instances of [FetchRequest].

### option: Playwright._newRequest.useragent = %%-context-option-useragent-%%

### option: Playwright._newRequest.extraHTTPHeaders = %%-context-option-extrahttpheaders-%%

### option: Playwright._newRequest.httpCredentials = %%-context-option-httpcredentials-%%

### option: Playwright._newRequest.proxy = %%-browser-option-proxy-%%

### option: Playwright._newRequest.timeout
- `timeout` <[float]>

Maximum time in milliseconds to wait for the response. Defaults to
`30000` (30 seconds). Pass `0` to disable timeout.

### option: Playwright._newRequest.ignoreHTTPSErrors = %%-context-option-ignorehttpserrors-%%

### option: Playwright._newRequest.baseURL
- `baseURL` <[string]>

When using [`method: FetchRequest.get`], [`method: FetchRequest.post`], [`method: FetchRequest.fetch`] it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. Examples:
* baseURL: `http://localhost:3000` and sending rquest to `/bar.html` results in `http://localhost:3000/bar.html`
* baseURL: `http://localhost:3000/foo/` and sending rquest to `./bar.html` results in `http://localhost:3000/foo/bar.html`

## property: Playwright.chromium
- type: <[BrowserType]>

Expand Down
2 changes: 1 addition & 1 deletion docs/src/api/class-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Request's post body in a binary form, if any.

## method: Request.postDataJSON
* langs: js, python
- returns: <[null]|[any]>
- returns: <[null]|[Serializable]>

Returns parsed request's body for `form-urlencoded` and JSON as a fallback if any.

Expand Down
4 changes: 2 additions & 2 deletions docs/src/api/params.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ Whether to automatically download all the attachments. Defaults to `false` where
## context-option-ignorehttpserrors
- `ignoreHTTPSErrors` <[boolean]>

Whether to ignore HTTPS errors during navigation. Defaults to `false`.
Whether to ignore HTTPS errors when sending network requests. Defaults to `false`.

## context-option-bypasscsp
- `bypassCSP` <[boolean]>
Expand Down Expand Up @@ -395,7 +395,7 @@ A list of permissions to grant to all pages in this context. See
## context-option-extrahttpheaders
- `extraHTTPHeaders` <[Object]<[string], [string]>>

An object containing additional HTTP headers to be sent with every request. All header values must be strings.
An object containing additional HTTP headers to be sent with every request.

## context-option-offline
- `offline` <[boolean]>
Expand Down
95 changes: 0 additions & 95 deletions docs/src/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,101 +159,6 @@ implement **login once and run multiple scenarios**. The lifecycle looks like:

This approach will also **work in CI environments**, since it does not rely on any external state.

### Reuse authentication in Playwright Test
* langs: js

When using [Playwright Test](./intro.md), you can log in once in the global setup
and then reuse authentication state in tests. That way all your tests are completely
isolated, yet you only waste time logging in once for the entire test suite run.

First, introduce the global setup that would sign in once. In this example we use the `baseURL` and `storageState` options from the configuration file.

```js js-flavor=js
// global-setup.js
const { chromium } = require('@playwright/test');

module.exports = async config => {
const { baseURL, storageState } = config.projects[0].use;
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto(baseURL);
await page.fill('input[name="user"]', 'user');
await page.fill('input[name="password"]', 'password');
await page.click('text=Sign in');
await page.context().storageState({ path: storageState });
await browser.close();
};
```

```js js-flavor=ts
// global-setup.ts
import { chromium, FullConfig } from '@playwright/test';

async function globalSetup(config: FullConfig) {
const { baseURL, storageState } = config.projects[0].use;
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto(baseURL!);
await page.fill('input[name="user"]', 'user');
await page.fill('input[name="password"]', 'password');
await page.click('text=Sign in');
await page.context().storageState({ path: storageState as string });
await browser.close();
}

export default globalSetup;
```

Next specify `globalSetup`, `baseURL` and `storageState` in the configuration file.

```js js-flavor=js
// playwright.config.js
// @ts-check
/** @type {import('@playwright/test').PlaywrightTestConfig} */
const config = {
globalSetup: require.resolve('./global-setup'),
use: {
baseURL: 'http://localhost:3000/',
storageState: 'state.json',
},
};
module.exports = config;
```

```js js-flavor=ts
// playwright.config.ts
import { PlaywrightTestConfig } from '@playwright/test';

const config: PlaywrightTestConfig = {
globalSetup: require.resolve('./global-setup'),
use: {
baseURL: 'http://localhost:3000/',
storageState: 'state.json',
},
};
export default config;
```

Tests start already authenticated because we specify `storageState` that was populated by global setup.

```js js-flavor=ts
import { test } from '@playwright/test';

test('test', async ({ page }) => {
await page.goto('/');
// You are signed in!
});
```

```js js-flavor=js
const { test } = require('@playwright/test');

test('test', async ({ page }) => {
await page.goto('/');
// You are signed in!
});
```

### API reference
- [`method: BrowserContext.storageState`]
- [`method: Browser.newContext`]
Expand Down

0 comments on commit c82284a

Please sign in to comment.