add Path suffix

This commit is contained in:
Max Schmitt 2024-07-10 22:04:50 +02:00
parent 83324faa74
commit 41fba1a959
7 changed files with 69 additions and 69 deletions

View file

@ -518,10 +518,10 @@ Does not enforce fixed viewport, allows resizing window in the headed mode.
- `clientCertificates` <[Array]<[Object]>>
- `url` <[string]> Glob pattern to match the URLs that the certificate is valid for.
- `certs` <[Array]<[Object]>> List of client certificates to be used.
- `cert` ?<[string]> Path to the file with the certificate in PEM format.
- `key` ?<[string]> Path to the file with the private key in PEM format.
- `certPath` ?<[string]> Path to the file with the certificate in PEM format.
- `keyPath` ?<[string]> Path to the file with the private key in PEM format.
- `pfxPath` ?<[string]> Path to the PFX or PKCS12 encoded private key and certificate chain.
- `passphrase` ?<[string]> Passphrase for the private key (PEM or PFX).
- `pfx` ?<[string]> Path to the PFX or PKCS12 encoded private key and certificate chain.
An array of client certificates to be used. Each certificate object must have `cert` and `key` or `pfx` to load the client certificate. Optionally, `passphrase` property should be provided if the private key is encrypted. If the certificate is valid only for specific URLs, the `url` property should be provided with a glob pattern to match the URLs that the certificate is valid for.

View file

@ -154,10 +154,10 @@ export default defineConfig({
use: {
...devices['Desktop Edge'],
clientCertificates: [{
url: 'https://example.com',
url: 'https://example.com/**',
certs: [{
cert: 'client/alice_cert.pem',
key: 'client/alice_key.pem',
certPath: './cert.pem',
keyPath: './key.pem',
passphase: 'mysecretpassword',
}],
}],

View file

@ -558,10 +558,10 @@ export async function toClientCertificatesProtocol(clientCertificates?: BrowserC
url: clientCertificate.url,
certs: await Promise.all(clientCertificate.certs.map(async cert => {
return {
cert: cert.cert ? await fs.promises.readFile(cert.cert) : undefined,
key: cert.key ? await fs.promises.readFile(cert.key) : undefined,
cert: cert.certPath ? await fs.promises.readFile(cert.certPath) : undefined,
key: cert.keyPath ? await fs.promises.readFile(cert.keyPath) : undefined,
pfx: cert.pfxPath ? await fs.promises.readFile(cert.pfxPath) : undefined,
passphrase: cert.passphrase,
pfx: cert.pfx ? await fs.promises.readFile(cert.pfx) : undefined,
};
}))
};

View file

@ -50,10 +50,10 @@ export const kLifecycleEvents: Set<LifecycleEvent> = new Set(['load', 'domconten
export type ClientCertificate = {
url: string;
certs: {
cert?: string;
key?: string;
certPath?: string;
keyPath?: string;
pfxPath?: string;
passphrase?: string;
pfx?: string;
}[];
};

View file

@ -13245,22 +13245,22 @@ export interface BrowserType<Unused = {}> {
/**
* Path to the file with the certificate in PEM format.
*/
cert?: string;
certPath?: string;
/**
* Path to the file with the private key in PEM format.
*/
key?: string;
keyPath?: string;
/**
* Path to the PFX or PKCS12 encoded private key and certificate chain.
*/
pfxPath?: string;
/**
* Passphrase for the private key (PEM or PFX).
*/
passphrase?: string;
/**
* Path to the PFX or PKCS12 encoded private key and certificate chain.
*/
pfx?: string;
}>;
}>;
@ -15657,22 +15657,22 @@ export interface APIRequest {
/**
* Path to the file with the certificate in PEM format.
*/
cert?: string;
certPath?: string;
/**
* Path to the file with the private key in PEM format.
*/
key?: string;
keyPath?: string;
/**
* Path to the PFX or PKCS12 encoded private key and certificate chain.
*/
pfxPath?: string;
/**
* Passphrase for the private key (PEM or PFX).
*/
passphrase?: string;
/**
* Path to the PFX or PKCS12 encoded private key and certificate chain.
*/
pfx?: string;
}>;
}>;
@ -16851,22 +16851,22 @@ export interface Browser extends EventEmitter {
/**
* Path to the file with the certificate in PEM format.
*/
cert?: string;
certPath?: string;
/**
* Path to the file with the private key in PEM format.
*/
key?: string;
keyPath?: string;
/**
* Path to the PFX or PKCS12 encoded private key and certificate chain.
*/
pfxPath?: string;
/**
* Passphrase for the private key (PEM or PFX).
*/
passphrase?: string;
/**
* Path to the PFX or PKCS12 encoded private key and certificate chain.
*/
pfx?: string;
}>;
}>;
@ -20326,22 +20326,22 @@ export interface BrowserContextOptions {
/**
* Path to the file with the certificate in PEM format.
*/
cert?: string;
certPath?: string;
/**
* Path to the file with the private key in PEM format.
*/
key?: string;
keyPath?: string;
/**
* Path to the PFX or PKCS12 encoded private key and certificate chain.
*/
pfxPath?: string;
/**
* Passphrase for the private key (PEM or PFX).
*/
passphrase?: string;
/**
* Path to the PFX or PKCS12 encoded private key and certificate chain.
*/
pfx?: string;
}>;
}>;

View file

@ -5225,10 +5225,10 @@ export interface PlaywrightTestOptions {
* use: {
* ...devices['Desktop Edge'],
* clientCertificates: [{
* url: 'https://example.com',
* url: 'https://example.com/**',
* certs: [{
* cert: 'client/alice_cert.pem',
* key: 'client/alice_key.pem',
* certPath: './cert.pem',
* keyPath: './key.pem',
* passphase: 'mysecretpassword',
* }],
* }],

View file

@ -65,10 +65,10 @@ const kValidationSubTests: [BrowserContextOptions, string][] = [
clientCertificates: [{
url: 'test',
certs: [{
cert: kDummyFileName,
key: kDummyFileName,
certPath: kDummyFileName,
keyPath: kDummyFileName,
pfxPath: kDummyFileName,
passphrase: kDummyFileName,
pfx: kDummyFileName,
}]
}]
}, 'pfx is specified together with cert, key or passphrase'],
@ -77,10 +77,10 @@ const kValidationSubTests: [BrowserContextOptions, string][] = [
clientCertificates: [{
url: 'test',
certs: [{
cert: kDummyFileName,
key: kDummyFileName,
certPath: kDummyFileName,
keyPath: kDummyFileName,
pfxPath: kDummyFileName,
passphrase: kDummyFileName,
pfx: kDummyFileName,
}]
}]
}, 'Cannot specify both proxy and clientCertificates'],
@ -105,8 +105,8 @@ test.describe('fetch', () => {
clientCertificates: [{
url: server.PREFIX,
certs: [{
cert: asset('client-certificates/client/alice_cert.pem'),
key: asset('client-certificates/client/alice_key.pem'),
certPath: asset('client-certificates/client/alice_cert.pem'),
keyPath: asset('client-certificates/client/alice_key.pem'),
}],
}],
});
@ -122,8 +122,8 @@ test.describe('fetch', () => {
clientCertificates: [{
url: serverURL,
certs: [{
cert: asset('client-certificates/client/alice_cert.pem'),
key: asset('client-certificates/client/alice_key.pem'),
certPath: asset('client-certificates/client/alice_cert.pem'),
keyPath: asset('client-certificates/client/alice_key.pem'),
}],
}],
});
@ -136,8 +136,8 @@ test.describe('fetch', () => {
clientCertificates: [{
url: serverURL,
certs: [{
cert: asset('client-certificates/client/bob_cert.pem'),
key: asset('client-certificates/client/bob_key.pem'),
certPath: asset('client-certificates/client/bob_cert.pem'),
keyPath: asset('client-certificates/client/bob_key.pem'),
}],
}],
});
@ -153,8 +153,8 @@ test.describe('fetch', () => {
clientCertificates: [{
url: serverURL,
certs: [{
cert: asset('client-certificates/client/alice_cert.pem'),
key: asset('client-certificates/client/alice_key.pem'),
certPath: asset('client-certificates/client/alice_cert.pem'),
keyPath: asset('client-certificates/client/alice_key.pem'),
}],
}],
ignoreHTTPSErrors: true,
@ -172,8 +172,8 @@ test.describe('fetch', () => {
clientCertificates: [{
url: serverURL,
certs: [{
cert: asset('client-certificates/client/alice_cert.pem'),
key: asset('client-certificates/client/alice_key.pem'),
certPath: asset('client-certificates/client/alice_cert.pem'),
keyPath: asset('client-certificates/client/alice_key.pem'),
}],
}],
});
@ -201,8 +201,8 @@ test.describe('browser', () => {
clientCertificates: [{
url: server.PREFIX,
certs: [{
cert: asset('client-certificates/client/alice_cert.pem'),
key: asset('client-certificates/client/alice_key.pem'),
certPath: asset('client-certificates/client/alice_cert.pem'),
keyPath: asset('client-certificates/client/alice_key.pem'),
}],
}],
});
@ -218,8 +218,8 @@ test.describe('browser', () => {
clientCertificates: [{
url: 'https://not-matching.com',
certs: [{
cert: asset('client-certificates/client/alice_cert.pem'),
key: asset('client-certificates/client/alice_key.pem'),
certPath: asset('client-certificates/client/alice_cert.pem'),
keyPath: asset('client-certificates/client/alice_key.pem'),
}],
}],
});
@ -233,8 +233,8 @@ test.describe('browser', () => {
clientCertificates: [{
url: serverURLRewrittenToLocalhost,
certs: [{
cert: asset('client-certificates/client/bob_cert.pem'),
key: asset('client-certificates/client/bob_key.pem'),
certPath: asset('client-certificates/client/bob_cert.pem'),
keyPath: asset('client-certificates/client/bob_key.pem'),
}],
}],
});
@ -249,8 +249,8 @@ test.describe('browser', () => {
clientCertificates: [{
url: serverURLRewrittenToLocalhost,
certs: [{
cert: asset('client-certificates/client/alice_cert.pem'),
key: asset('client-certificates/client/alice_key.pem'),
certPath: asset('client-certificates/client/alice_cert.pem'),
keyPath: asset('client-certificates/client/alice_key.pem'),
}],
}],
});
@ -272,8 +272,8 @@ test.describe('browser', () => {
clientCertificates: [{
url: serverURLRewrittenToLocalhost,
certs: [{
cert: asset('client-certificates/client/alice_cert.pem'),
key: asset('client-certificates/client/alice_key.pem'),
certPath: asset('client-certificates/client/alice_cert.pem'),
keyPath: asset('client-certificates/client/alice_key.pem'),
}],
}],
});