2020-01-09 14:49:22 -08:00
|
|
|
/**
|
|
|
|
* Copyright (c) Microsoft Corporation.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2020-08-22 15:46:42 -07:00
|
|
|
import { Chromium } from './chromium/chromium';
|
2020-08-23 15:39:03 -07:00
|
|
|
import { WebKit } from './webkit/webkit';
|
2020-01-24 14:49:47 -08:00
|
|
|
import { Firefox } from './firefox';
|
2020-03-25 14:08:46 -07:00
|
|
|
import { selectors } from '../selectors';
|
2020-08-22 21:15:03 -07:00
|
|
|
import * as browserPaths from '../utils/browserPaths';
|
2020-01-09 14:49:22 -08:00
|
|
|
|
2020-01-24 14:49:47 -08:00
|
|
|
export class Playwright {
|
2020-03-25 14:08:46 -07:00
|
|
|
readonly selectors = selectors;
|
2020-07-24 16:36:00 -07:00
|
|
|
readonly chromium: Chromium;
|
|
|
|
readonly firefox: Firefox;
|
|
|
|
readonly webkit: WebKit;
|
2020-01-24 14:49:47 -08:00
|
|
|
|
2020-04-28 17:06:01 -07:00
|
|
|
constructor(packagePath: string, browsers: browserPaths.BrowserDescriptor[]) {
|
|
|
|
const chromium = browsers.find(browser => browser.name === 'chromium');
|
2020-07-24 16:36:00 -07:00
|
|
|
this.chromium = new Chromium(packagePath, chromium!);
|
2020-04-28 17:06:01 -07:00
|
|
|
|
|
|
|
const firefox = browsers.find(browser => browser.name === 'firefox');
|
2020-07-24 16:36:00 -07:00
|
|
|
this.firefox = new Firefox(packagePath, firefox!);
|
2020-04-28 17:06:01 -07:00
|
|
|
|
|
|
|
const webkit = browsers.find(browser => browser.name === 'webkit');
|
2020-07-24 16:36:00 -07:00
|
|
|
this.webkit = new WebKit(packagePath, webkit!);
|
2020-01-24 14:49:47 -08:00
|
|
|
}
|
2020-01-09 14:49:22 -08:00
|
|
|
}
|