mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
AAE-22865 - Fixing webdriver version used and installed (#9749)
* Fixing webdriver version used and installed * Fixing webdriver selenium version * Disabling Code flow for grant password auth * Removing the install from the script as it's done in the postinstall now * It's funny how this tests work * Having codeflow disabled by default * Checking if Core tests pass * Refreshing as SSO button is broken after clicking apply
This commit is contained in:
parent
a1555074a7
commit
6bdfd83dac
2
.github/workflows/pull-request.yml
vendored
2
.github/workflows/pull-request.yml
vendored
@ -451,8 +451,6 @@ jobs:
|
|||||||
enable-cache: "true"
|
enable-cache: "true"
|
||||||
enable-node-modules-cache: "true"
|
enable-node-modules-cache: "true"
|
||||||
- uses: ./.github/actions/download-node-modules-and-artifacts
|
- uses: ./.github/actions/download-node-modules-and-artifacts
|
||||||
- name: setup chrome
|
|
||||||
uses: ./.github/actions/setup-chrome
|
|
||||||
- name: e2e
|
- name: e2e
|
||||||
uses: ./.github/actions/e2e
|
uses: ./.github/actions/e2e
|
||||||
with:
|
with:
|
||||||
|
@ -81,6 +81,8 @@ describe('SSO in ADF using ACS and AIS, Download Directive, Viewer, DocumentList
|
|||||||
browser.params.testConfig.appConfig.oauth2.clientId
|
browser.params.testConfig.appConfig.oauth2.clientId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
await browser.refresh();
|
||||||
|
|
||||||
await loginSsoPage.loginSSOIdentityService(acsUser.username, acsUser.password);
|
await loginSsoPage.loginSSOIdentityService(acsUser.username, acsUser.password);
|
||||||
|
|
||||||
await navigationBarPage.navigateToContentServices();
|
await navigationBarPage.navigateToContentServices();
|
||||||
|
@ -21,7 +21,6 @@ import { NavigationBarPage } from '../../../core/pages/navigation-bar.page';
|
|||||||
import { LoginShellPage } from '../../../core/pages/login-shell.page';
|
import { LoginShellPage } from '../../../core/pages/login-shell.page';
|
||||||
|
|
||||||
describe('Login component - SSO', () => {
|
describe('Login component - SSO', () => {
|
||||||
|
|
||||||
const settingsPage = new SettingsPage();
|
const settingsPage = new SettingsPage();
|
||||||
const loginSSOPage = new LoginPage();
|
const loginSSOPage = new LoginPage();
|
||||||
const loginPage = new LoginShellPage();
|
const loginPage = new LoginShellPage();
|
||||||
@ -36,15 +35,22 @@ describe('Login component - SSO', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('[C261050] Should be possible login with SSO', async () => {
|
it('[C261050] Should be possible login with SSO', async () => {
|
||||||
await settingsPage.setProviderEcmSso(browser.params.testConfig.appConfig.ecmHost,
|
await settingsPage.setProviderEcmSso(
|
||||||
|
browser.params.testConfig.appConfig.ecmHost,
|
||||||
browser.params.testConfig.appConfig.oauth2.host,
|
browser.params.testConfig.appConfig.oauth2.host,
|
||||||
browser.params.testConfig.appConfig.identityHost,
|
browser.params.testConfig.appConfig.identityHost,
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
browser.params.testConfig.appConfig.oauth2.clientId,
|
browser.params.testConfig.appConfig.oauth2.clientId,
|
||||||
browser.params.testConfig.appConfig.oauth2.redirectUriLogout);
|
browser.params.testConfig.appConfig.oauth2.redirectUriLogout
|
||||||
|
);
|
||||||
|
|
||||||
await loginSSOPage.loginSSOIdentityService(browser.params.testConfig.users.admin.username, browser.params.testConfig.users.admin.password);
|
await browser.refresh();
|
||||||
|
|
||||||
|
await loginSSOPage.loginSSOIdentityService(
|
||||||
|
browser.params.testConfig.users.admin.username,
|
||||||
|
browser.params.testConfig.users.admin.password
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[C280667] Should be redirect directly to keycloak without show the login page with silent login', async () => {
|
it('[C280667] Should be redirect directly to keycloak without show the login page with silent login', async () => {
|
||||||
@ -55,22 +61,31 @@ describe('Login component - SSO', () => {
|
|||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
browser.params.testConfig.appConfig.oauth2.clientId,
|
browser.params.testConfig.appConfig.oauth2.clientId,
|
||||||
browser.params.testConfig.appConfig.oauth2.redirectUriLogout);
|
browser.params.testConfig.appConfig.oauth2.redirectUriLogout
|
||||||
|
);
|
||||||
|
|
||||||
await loginSSOPage.loginSSOIdentityService(browser.params.testConfig.users.admin.username, browser.params.testConfig.users.admin.password);
|
await browser.refresh();
|
||||||
|
|
||||||
|
await loginSSOPage.loginSSOIdentityService(
|
||||||
|
browser.params.testConfig.users.admin.username,
|
||||||
|
browser.params.testConfig.users.admin.password
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Login component - SSO Grant type password (implicit flow false)', () => {
|
describe('Login component - SSO Grant type password (implicit flow false)', () => {
|
||||||
it('[C299158] Should be possible to login with SSO, with grant type password (Implicit Flow false)', async () => {
|
it('[C299158] Should be possible to login with SSO, with grant type password (Implicit Flow false)', async () => {
|
||||||
await settingsPage.setProviderEcmSso(browser.params.testConfig.appConfig.ecmHost,
|
await settingsPage.setProviderEcmSsoWithoutCodeFlow(
|
||||||
|
browser.params.testConfig.appConfig.ecmHost,
|
||||||
browser.params.testConfig.appConfig.oauth2.host,
|
browser.params.testConfig.appConfig.oauth2.host,
|
||||||
browser.params.testConfig.appConfig.identityHost,
|
browser.params.testConfig.appConfig.identityHost,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
browser.params.testConfig.appConfig.oauth2.clientId,
|
browser.params.testConfig.appConfig.oauth2.clientId,
|
||||||
browser.params.testConfig.appConfig.oauth2.redirectUriLogout);
|
browser.params.testConfig.appConfig.oauth2.redirectUriLogout
|
||||||
|
);
|
||||||
|
|
||||||
|
await browser.refresh();
|
||||||
await loginPage.waitForElements();
|
await loginPage.waitForElements();
|
||||||
|
|
||||||
await loginPage.enterUsername(browser.params.testConfig.users.admin.username);
|
await loginPage.enterUsername(browser.params.testConfig.users.admin.username);
|
||||||
|
@ -33,6 +33,7 @@ export class SettingsPage {
|
|||||||
silentLoginToggleElement = $(`${materialLocators.Slide.toggle.root}[formcontrolname="silentLogin"]`);
|
silentLoginToggleElement = $(`${materialLocators.Slide.toggle.root}[formcontrolname="silentLogin"]`);
|
||||||
implicitFlowLabel = $(`${materialLocators.Slide.toggle.root}[formcontrolname="implicitFlow"] label`);
|
implicitFlowLabel = $(`${materialLocators.Slide.toggle.root}[formcontrolname="implicitFlow"] label`);
|
||||||
implicitFlowElement = $(`${materialLocators.Slide.toggle.root}[formcontrolname="implicitFlow"]`);
|
implicitFlowElement = $(`${materialLocators.Slide.toggle.root}[formcontrolname="implicitFlow"]`);
|
||||||
|
codeFlowElement = $(`${materialLocators.Slide.toggle.root}[formcontrolname="codeFlow"]`);
|
||||||
applyButton = $('button[data-automation-id="settings-apply-button"]');
|
applyButton = $('button[data-automation-id="settings-apply-button"]');
|
||||||
providerDropdown = new DropdownPage($(`${materialLocators.Select.root}[id="adf-provider-selector"]`));
|
providerDropdown = new DropdownPage($(`${materialLocators.Select.root}[id="adf-provider-selector"]`));
|
||||||
|
|
||||||
@ -41,8 +42,7 @@ export class SettingsPage {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
currentUrl = await browser.getCurrentUrl();
|
currentUrl = await browser.getCurrentUrl();
|
||||||
} catch (e) {
|
} catch (e) {}
|
||||||
}
|
|
||||||
|
|
||||||
if (!currentUrl || currentUrl.indexOf(this.settingsURL) === -1) {
|
if (!currentUrl || currentUrl.indexOf(this.settingsURL) === -1) {
|
||||||
await browser.get(this.settingsURL);
|
await browser.get(this.settingsURL);
|
||||||
@ -59,7 +59,15 @@ export class SettingsPage {
|
|||||||
await BrowserActions.click(this.ssoRadioButton);
|
await BrowserActions.click(this.ssoRadioButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
async setProviderEcmSso(contentServiceURL, authHost, identityHost, silentLogin = true, implicitFlow = true, clientId?: string, logoutUrl: string = '/logout') {
|
async setProviderEcmSso(
|
||||||
|
contentServiceURL,
|
||||||
|
authHost,
|
||||||
|
identityHost,
|
||||||
|
silentLogin = true,
|
||||||
|
implicitFlow = true,
|
||||||
|
clientId?: string,
|
||||||
|
logoutUrl: string = '/logout'
|
||||||
|
) {
|
||||||
await this.goToSettingsPage();
|
await this.goToSettingsPage();
|
||||||
await this.setProvider('ECM');
|
await this.setProvider('ECM');
|
||||||
await this.clickSsoRadioButton();
|
await this.clickSsoRadioButton();
|
||||||
@ -74,6 +82,30 @@ export class SettingsPage {
|
|||||||
await browser.sleep(1000);
|
await browser.sleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async setProviderEcmSsoWithoutCodeFlow(
|
||||||
|
contentServiceURL,
|
||||||
|
authHost,
|
||||||
|
identityHost,
|
||||||
|
silentLogin = true,
|
||||||
|
implicitFlow = true,
|
||||||
|
clientId?: string,
|
||||||
|
logoutUrl: string = '/logout'
|
||||||
|
) {
|
||||||
|
await this.goToSettingsPage();
|
||||||
|
await this.setProvider('ECM');
|
||||||
|
await this.clickSsoRadioButton();
|
||||||
|
await this.setContentServicesURL(contentServiceURL);
|
||||||
|
await this.setAuthHost(authHost);
|
||||||
|
await this.setIdentityHost(identityHost);
|
||||||
|
await this.setSilentLogin(silentLogin);
|
||||||
|
await this.setCodeFlow(false);
|
||||||
|
await this.setImplicitFlow(implicitFlow);
|
||||||
|
await this.setClientId(clientId);
|
||||||
|
await this.setLogoutUrl(logoutUrl);
|
||||||
|
await this.clickApply();
|
||||||
|
await browser.sleep(1000);
|
||||||
|
}
|
||||||
|
|
||||||
async setLogoutUrl(logoutUrl) {
|
async setLogoutUrl(logoutUrl) {
|
||||||
await BrowserVisibility.waitUntilElementIsPresent(this.logoutUrlText);
|
await BrowserVisibility.waitUntilElementIsPresent(this.logoutUrlText);
|
||||||
await BrowserActions.clearSendKeys(this.logoutUrlText, logoutUrl);
|
await BrowserActions.clearSendKeys(this.logoutUrlText, logoutUrl);
|
||||||
@ -104,7 +136,7 @@ export class SettingsPage {
|
|||||||
|
|
||||||
const isChecked = (await BrowserActions.getAttribute(this.silentLoginToggleElement, 'class')).includes(materialLocators.Checked.root);
|
const isChecked = (await BrowserActions.getAttribute(this.silentLoginToggleElement, 'class')).includes(materialLocators.Checked.root);
|
||||||
|
|
||||||
if (isChecked && !enableToggle || !isChecked && enableToggle) {
|
if ((isChecked && !enableToggle) || (!isChecked && enableToggle)) {
|
||||||
await BrowserActions.click(this.silentLoginToggleLabel);
|
await BrowserActions.click(this.silentLoginToggleLabel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,8 +146,18 @@ export class SettingsPage {
|
|||||||
|
|
||||||
const isChecked = (await BrowserActions.getAttribute(this.implicitFlowElement, 'class')).includes(materialLocators.Checked.root);
|
const isChecked = (await BrowserActions.getAttribute(this.implicitFlowElement, 'class')).includes(materialLocators.Checked.root);
|
||||||
|
|
||||||
if (isChecked && !enableToggle || !isChecked && enableToggle) {
|
if ((isChecked && !enableToggle) || (!isChecked && enableToggle)) {
|
||||||
await BrowserActions.click(this.implicitFlowLabel);
|
await BrowserActions.click(this.implicitFlowLabel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async setCodeFlow(enableToggle) {
|
||||||
|
await BrowserVisibility.waitUntilElementIsVisible(this.codeFlowElement);
|
||||||
|
|
||||||
|
const isChecked = (await BrowserActions.getAttribute(this.codeFlowElement, 'class')).includes(materialLocators.Checked.root);
|
||||||
|
|
||||||
|
if ((isChecked && !enableToggle) || (!isChecked && enableToggle)) {
|
||||||
|
await BrowserActions.click(this.codeFlowElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
21
package-lock.json
generated
21
package-lock.json
generated
@ -7,6 +7,7 @@
|
|||||||
"": {
|
"": {
|
||||||
"name": "alfresco-ng2-components",
|
"name": "alfresco-ng2-components",
|
||||||
"version": "6.9.0",
|
"version": "6.9.0",
|
||||||
|
"hasInstallScript": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "14.1.3",
|
"@angular/animations": "14.1.3",
|
||||||
@ -84,7 +85,7 @@
|
|||||||
"@types/mocha": "^10.0.4",
|
"@types/mocha": "^10.0.4",
|
||||||
"@types/node": "18.0.0",
|
"@types/node": "18.0.0",
|
||||||
"@types/pdfjs-dist": "^2.10.378",
|
"@types/pdfjs-dist": "^2.10.378",
|
||||||
"@types/selenium-webdriver": "^4.0.11",
|
"@types/selenium-webdriver": "^4.1.17",
|
||||||
"@types/shelljs": "^0.8.15",
|
"@types/shelljs": "^0.8.15",
|
||||||
"@types/superagent": "^4.1.22",
|
"@types/superagent": "^4.1.22",
|
||||||
"@typescript-eslint/eslint-plugin": "5.59.8",
|
"@typescript-eslint/eslint-plugin": "5.59.8",
|
||||||
@ -142,7 +143,7 @@
|
|||||||
"protractor-smartrunner": "^2.0.0-beta6",
|
"protractor-smartrunner": "^2.0.0-beta6",
|
||||||
"rimraf": "^5.0.5",
|
"rimraf": "^5.0.5",
|
||||||
"sass-loader": "13.3.2",
|
"sass-loader": "13.3.2",
|
||||||
"selenium-webdriver": "4.1.0",
|
"selenium-webdriver": "^4.14.0",
|
||||||
"shelljs": "^0.8.5",
|
"shelljs": "^0.8.5",
|
||||||
"shx": "^0.3.4",
|
"shx": "^0.3.4",
|
||||||
"spdx-license-list": "^6.9.0",
|
"spdx-license-list": "^6.9.0",
|
||||||
@ -23619,9 +23620,10 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@types/selenium-webdriver": {
|
"node_modules/@types/selenium-webdriver": {
|
||||||
"version": "4.1.14",
|
"version": "4.1.17",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/selenium-webdriver/-/selenium-webdriver-4.1.17.tgz",
|
||||||
|
"integrity": "sha512-vtoMYktN2XcSlXwSmZq6H+25CiQMPCuGP7RUulfSmRmyI6wCerZPmNyMMrvcCcyDE/ofeWD1COLfux5plsVizw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/ws": "*"
|
"@types/ws": "*"
|
||||||
}
|
}
|
||||||
@ -48498,16 +48500,17 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/selenium-webdriver": {
|
"node_modules/selenium-webdriver": {
|
||||||
"version": "4.1.0",
|
"version": "4.14.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.14.0.tgz",
|
||||||
|
"integrity": "sha512-637rs8anqMKHbWxcBZpyG3Gcs+rBUtAUiqk0O/knUqH4Paj3MFUZrz88/pVGOLNryEVy2z92fZomT8p1ENl1gA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jszip": "^3.6.0",
|
"jszip": "^3.10.1",
|
||||||
"tmp": "^0.2.1",
|
"tmp": "^0.2.1",
|
||||||
"ws": ">=7.4.6"
|
"ws": ">=8.14.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 10.15.0"
|
"node": ">= 14.20.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/selfsigned": {
|
"node_modules/selfsigned": {
|
||||||
|
@ -34,7 +34,10 @@
|
|||||||
"js_api_build_esm5": "shx rm -rf ./dist/libs/js-api/esm5 && tsc -p ./lib/js-api/tsconfig/tsconfig.esm5.json",
|
"js_api_build_esm5": "shx rm -rf ./dist/libs/js-api/esm5 && tsc -p ./lib/js-api/tsconfig/tsconfig.esm5.json",
|
||||||
"js_api_build_esm2015": "shx rm -rf ./dist/libs/js-api/esm2015 && tsc -p ./lib/js-api/tsconfig/tsconfig.esm2015.json",
|
"js_api_build_esm2015": "shx rm -rf ./dist/libs/js-api/esm2015 && tsc -p ./lib/js-api/tsconfig/tsconfig.esm2015.json",
|
||||||
"js_api_build_types": "shx rm -rf ./dist/libs/js-api/typings && tsc -p ./lib/js-api/tsconfig/tsconfig.types.json",
|
"js_api_build_types": "shx rm -rf ./dist/libs/js-api/typings && tsc -p ./lib/js-api/tsconfig/tsconfig.types.json",
|
||||||
"js_api_assets": "shx cp ./lib/js-api/package.json ./dist/libs/js-api/ && shx cp ./lib/js-api/README.md ./dist/libs/js-api/ && shx cp ./lib/js-api/LICENSE.txt ./dist/libs/js-api/"
|
"js_api_assets": "shx cp ./lib/js-api/package.json ./dist/libs/js-api/ && shx cp ./lib/js-api/README.md ./dist/libs/js-api/ && shx cp ./lib/js-api/LICENSE.txt ./dist/libs/js-api/",
|
||||||
|
"postinstall": "npm run update-webdriver",
|
||||||
|
"update-webdriver": "./scripts/webdriver-update-newest/update-to-newest-webdriver.sh",
|
||||||
|
"update-webdriver:windows": "powershell -executionPolicy bypass ./scripts/update-webdriver.ps1"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -129,7 +132,7 @@
|
|||||||
"@types/mocha": "^10.0.4",
|
"@types/mocha": "^10.0.4",
|
||||||
"@types/node": "18.0.0",
|
"@types/node": "18.0.0",
|
||||||
"@types/pdfjs-dist": "^2.10.378",
|
"@types/pdfjs-dist": "^2.10.378",
|
||||||
"@types/selenium-webdriver": "^4.0.11",
|
"@types/selenium-webdriver": "^4.1.17",
|
||||||
"@types/shelljs": "^0.8.15",
|
"@types/shelljs": "^0.8.15",
|
||||||
"@types/superagent": "^4.1.22",
|
"@types/superagent": "^4.1.22",
|
||||||
"@typescript-eslint/eslint-plugin": "5.59.8",
|
"@typescript-eslint/eslint-plugin": "5.59.8",
|
||||||
@ -187,7 +190,7 @@
|
|||||||
"protractor-smartrunner": "^2.0.0-beta6",
|
"protractor-smartrunner": "^2.0.0-beta6",
|
||||||
"rimraf": "^5.0.5",
|
"rimraf": "^5.0.5",
|
||||||
"sass-loader": "13.3.2",
|
"sass-loader": "13.3.2",
|
||||||
"selenium-webdriver": "4.1.0",
|
"selenium-webdriver": "^4.14.0",
|
||||||
"shelljs": "^0.8.5",
|
"shelljs": "^0.8.5",
|
||||||
"shx": "^0.3.4",
|
"shx": "^0.3.4",
|
||||||
"spdx-license-list": "^6.9.0",
|
"spdx-license-list": "^6.9.0",
|
||||||
|
@ -141,15 +141,6 @@ done
|
|||||||
rm -rf ./e2e/downloads/
|
rm -rf ./e2e/downloads/
|
||||||
rm -rf ./e2e-output/
|
rm -rf ./e2e-output/
|
||||||
echo "====== BROWSER_RUN: $BROWSER_RUN ======"
|
echo "====== BROWSER_RUN: $BROWSER_RUN ======"
|
||||||
echo "====== Update webdriver-manager ====="
|
|
||||||
if [ "$CI" = "true" ]; then
|
|
||||||
export chrome=$(google-chrome --product-version)
|
|
||||||
echo "Updating wedriver-manager with chromedriver: $chrome."
|
|
||||||
./node_modules/protractor/bin/webdriver-manager update --gecko=false --versions.chrome=$chrome
|
|
||||||
else
|
|
||||||
echo "Updating wedriver-manager with latest chromedriver, be sure to use evergreen Chrome."
|
|
||||||
./node_modules/protractor/bin/webdriver-manager update --gecko=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
export DEBUG_OPTION=''
|
export DEBUG_OPTION=''
|
||||||
if [[ $DEBUG == "true" ]]; then
|
if [[ $DEBUG == "true" ]]; then
|
||||||
|
18
scripts/update-webdriver.ps1
Normal file
18
scripts/update-webdriver.ps1
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
$dir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
|
|
||||||
|
if ($env:CI -eq "true") {
|
||||||
|
Write-Host "Updating webdriver-manager with chromedriver: $env:npm_package_config_chromeDriver."
|
||||||
|
./node_modules/protractor/bin/webdriver-manager update --gecko=false --versions.chrome=$(google-chrome --product-version)
|
||||||
|
} else {
|
||||||
|
Write-Host "Updating webdriver-manager with latest chromedriver, be sure to use evergreen Chrome."
|
||||||
|
npx webdriver-manager update --gecko=false
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Host "`n==============================================================="
|
||||||
|
Write-Host "FAILED TO UPDATE WEBDRIVER-MANAGER, PLEASE DO IT MANUALLY!"
|
||||||
|
Write-Host "Run the following command (sometimes needs more than one kick):"
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "npx webdriver-manager update --gecko=false"
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "==============================================================="
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,9 @@
|
|||||||
"use strict";
|
'use strict';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
const semver = require("semver");
|
const semver = require('semver');
|
||||||
const config_1 = require("../config");
|
const config_1 = require('../config');
|
||||||
const http_utils_1 = require("../http_utils");
|
const http_utils_1 = require('../http_utils');
|
||||||
const config_source_1 = require("./config_source");
|
const config_source_1 = require('./config_source');
|
||||||
class ChromeXml extends config_source_1.XmlConfigSource {
|
class ChromeXml extends config_source_1.XmlConfigSource {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('chrome', config_1.Config.cdnUrls()['chrome']);
|
super('chrome', config_1.Config.cdnUrls()['chrome']);
|
||||||
@ -12,8 +12,7 @@ class ChromeXml extends config_source_1.XmlConfigSource {
|
|||||||
getUrl(version) {
|
getUrl(version) {
|
||||||
if (version === 'latest') {
|
if (version === 'latest') {
|
||||||
return this.getLatestChromeDriverVersion();
|
return this.getLatestChromeDriverVersion();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return this.getSpecificChromeDriverVersion(version);
|
return this.getSpecificChromeDriverVersion(version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -21,16 +20,17 @@ class ChromeXml extends config_source_1.XmlConfigSource {
|
|||||||
* Get a list of chrome drivers paths available for the configuration OS type and architecture.
|
* Get a list of chrome drivers paths available for the configuration OS type and architecture.
|
||||||
*/
|
*/
|
||||||
getVersionList() {
|
getVersionList() {
|
||||||
return this.getXml().then(xml => {
|
return this.getXml().then((xml) => {
|
||||||
let versionPaths = [];
|
let versionPaths = [];
|
||||||
let osType = this.getOsTypeName();
|
let osType = this.getOsTypeName();
|
||||||
for (let content of xml.ListBucketResult.Contents) {
|
for (let content of xml.ListBucketResult.Contents) {
|
||||||
let contentKey = content.Key[0];
|
let contentKey = content.Key[0];
|
||||||
if (
|
if (
|
||||||
// Filter for 32-bit devices, make sure x64 is not an option
|
// Filter for 32-bit devices, make sure x64 is not an option
|
||||||
(this.osarch.includes('64') || !contentKey.includes('64')) &&
|
(this.osarch.includes('64') || !contentKey.includes('64')) &&
|
||||||
// Filter for x86 macs, make sure m1 is not an option
|
// Filter for x86 macs, make sure m1 is not an option
|
||||||
((this.ostype === 'Darwin' && this.osarch === 'arm64') || !contentKey.includes('m1'))) {
|
((this.ostype === 'Darwin' && this.osarch === 'arm64') || !contentKey.includes('m1'))
|
||||||
|
) {
|
||||||
// Filter for only the osType
|
// Filter for only the osType
|
||||||
if (contentKey.includes(osType)) {
|
if (contentKey.includes(osType)) {
|
||||||
versionPaths.push(contentKey);
|
versionPaths.push(contentKey);
|
||||||
@ -46,97 +46,96 @@ class ChromeXml extends config_source_1.XmlConfigSource {
|
|||||||
getOsTypeName() {
|
getOsTypeName() {
|
||||||
// Get the os type name.
|
// Get the os type name.
|
||||||
if (this.ostype === 'Darwin') {
|
if (this.ostype === 'Darwin') {
|
||||||
return 'mac';
|
return 'mac-x64';
|
||||||
}
|
} else if (this.ostype === 'Windows_NT') {
|
||||||
else if (this.ostype === 'Windows_NT') {
|
return 'win64';
|
||||||
return 'win';
|
} else {
|
||||||
}
|
return 'linux64';
|
||||||
else {
|
|
||||||
return 'linux';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Gets the latest item from the XML.
|
* Gets the latest item from the XML.
|
||||||
*/
|
*/
|
||||||
getLatestChromeDriverVersion() {
|
getLatestChromeDriverVersion() {
|
||||||
const path = require('path')
|
const path = require('path');
|
||||||
const fs = require('fs')
|
const fs = require('fs');
|
||||||
|
|
||||||
const lastKnownGoodVersionsWithDownloads_Url = 'https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json';
|
const lastKnownGoodVersionsWithDownloads_Url =
|
||||||
return http_utils_1.requestBody(lastKnownGoodVersionsWithDownloads_Url).then(body => {
|
'https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json';
|
||||||
const latestVersion_Body = JSON.parse(body)['channels']['Stable']
|
return http_utils_1.requestBody(lastKnownGoodVersionsWithDownloads_Url).then((body) => {
|
||||||
|
const latestVersion_Body = JSON.parse(body)['channels']['Stable'];
|
||||||
|
|
||||||
const latestVersion = latestVersion_Body['version']
|
const latestVersion = latestVersion_Body['version'];
|
||||||
const latestVersion_Url = latestVersion_Body['downloads']['chromedriver'].find(obj => obj['platform'] == 'mac-x64')['url']
|
const latestVersion_Url = latestVersion_Body['downloads']['chromedriver'].find((obj) => obj['platform'] == 'mac-x64')['url'];
|
||||||
|
|
||||||
const latestMajorVersion = latestVersion.split('.')[0]
|
const latestMajorVersion = latestVersion.split('.')[0];
|
||||||
|
|
||||||
const localVersion_FileName = fs.readdirSync(path.resolve(__dirname, '..', '..', '..', 'selenium'))
|
const localVersion_FileName =
|
||||||
.find(f => f.startsWith(`chromedriver_${latestMajorVersion}`)) || ''
|
fs
|
||||||
|
.readdirSync(path.resolve(__dirname, '..', '..', '..', 'selenium'))
|
||||||
|
.find((f) => f.startsWith(`chromedriver_${latestMajorVersion}`)) || '';
|
||||||
|
|
||||||
const localVersion = localVersion_FileName.slice(13, -4)
|
const localVersion = localVersion_FileName.slice(13, -4);
|
||||||
const localVersion_Url = latestVersion_Url.replace(latestVersion, localVersion)
|
const localVersion_Url = latestVersion_Url.replace(latestVersion, localVersion);
|
||||||
|
|
||||||
const localMajorVersion = localVersion.split('.')[0]
|
const localMajorVersion = localVersion.split('.')[0];
|
||||||
|
|
||||||
if (latestMajorVersion == localMajorVersion) {
|
if (latestMajorVersion == localMajorVersion) {
|
||||||
return Promise.resolve({
|
return Promise.resolve({
|
||||||
url: localVersion_Url,
|
url: localVersion_Url,
|
||||||
version: localVersion,
|
version: localVersion
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
return Promise.resolve({
|
return Promise.resolve({
|
||||||
url: latestVersion_Url,
|
url: latestVersion_Url,
|
||||||
version: latestVersion,
|
version: latestVersion
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Gets a specific item from the XML.
|
* Gets a specific item from the XML.
|
||||||
*/
|
*/
|
||||||
getSpecificChromeDriverVersion(inputVersion) {
|
getSpecificChromeDriverVersion(versionRequired) {
|
||||||
return this.getVersionList().then(list => {
|
const path = require('path');
|
||||||
const specificVersion = getValidSemver(inputVersion);
|
const fs = require('fs');
|
||||||
if (specificVersion === '') {
|
|
||||||
throw new Error(`version ${inputVersion} ChromeDriver does not exist`);
|
let baseTagVersion = versionRequired.split('.');
|
||||||
}
|
baseTagVersion.splice(-1);
|
||||||
let itemFound = '';
|
baseTagVersion = baseTagVersion.join('.');
|
||||||
for (let item of list) {
|
|
||||||
// Get a semantic version.
|
const lastKnownGoodVersionsWithDownloads_Url =
|
||||||
let version = item.split('/')[0];
|
'https://googlechromelabs.github.io/chrome-for-testing/latest-patch-versions-per-build-with-downloads.json';
|
||||||
if (semver.valid(version) == null) {
|
return http_utils_1.requestBody(lastKnownGoodVersionsWithDownloads_Url).then((body) => {
|
||||||
const lookUpVersion = getValidSemver(version);
|
const version_Body = JSON.parse(body)['builds'][baseTagVersion];
|
||||||
if (semver.valid(lookUpVersion)) {
|
|
||||||
// Check to see if the specified version matches.
|
const opSys = this.getOsTypeName();
|
||||||
if (lookUpVersion === specificVersion) {
|
|
||||||
// When item found is null, check the os arch
|
const currentVersion = version_Body['version'];
|
||||||
// 64-bit version works OR not 64-bit version and the path does not have '64'
|
const currentVersion_Url = version_Body['downloads']['chromedriver'].find((obj) => obj['platform'] == opSys)['url'];
|
||||||
if (itemFound == '') {
|
|
||||||
if (this.osarch === 'x64' ||
|
const latestMajorVersion = currentVersion.split('.')[0];
|
||||||
(this.osarch !== 'x64' && !item.includes(this.getOsTypeName() + '64'))) {
|
|
||||||
itemFound = item;
|
const localVersion_FileName =
|
||||||
}
|
fs
|
||||||
if (this.osarch === 'arm64' && this.ostype === 'Darwin' && item.includes('m1')) {
|
.readdirSync(path.resolve(__dirname, '..', '..', '..', 'selenium'))
|
||||||
itemFound = item;
|
.find((f) => f.startsWith(`chromedriver_${latestMajorVersion}`)) || '';
|
||||||
}
|
|
||||||
}
|
const localVersion = localVersion_FileName.slice(13, -4);
|
||||||
else if (this.osarch === 'x64') {
|
const localVersion_Url = currentVersion_Url.replace(currentVersion, localVersion);
|
||||||
// No win64 version exists, so even on x64 we need to look for win32
|
|
||||||
const osTypeNameAndArch = this.getOsTypeName() + (this.getOsTypeName() === 'win' ? '32' : '64');
|
const localMajorVersion = localVersion.split('.')[0];
|
||||||
if (item.includes(osTypeNameAndArch)) {
|
|
||||||
itemFound = item;
|
if (latestMajorVersion == localMajorVersion) {
|
||||||
}
|
return Promise.resolve({
|
||||||
}
|
url: localVersion_Url,
|
||||||
}
|
version: localVersion
|
||||||
}
|
});
|
||||||
}
|
} else {
|
||||||
}
|
return Promise.resolve({
|
||||||
if (itemFound == '') {
|
url: currentVersion_Url,
|
||||||
return { url: '', version: inputVersion };
|
version: currentVersion
|
||||||
}
|
});
|
||||||
else {
|
|
||||||
return { url: config_1.Config.cdnUrls().chrome + itemFound, version: inputVersion };
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -163,8 +162,7 @@ function getValidSemver(version) {
|
|||||||
if (exec) {
|
if (exec) {
|
||||||
lookUpVersion = exec[1] + '.0';
|
lookUpVersion = exec[1] + '.0';
|
||||||
}
|
}
|
||||||
}
|
} catch (_) {
|
||||||
catch (_) {
|
|
||||||
// no-op: is this is not valid, do not throw here.
|
// no-op: is this is not valid, do not throw here.
|
||||||
}
|
}
|
||||||
// This supports downloading 74.0.3729.6
|
// This supports downloading 74.0.3729.6
|
||||||
@ -174,8 +172,7 @@ function getValidSemver(version) {
|
|||||||
if (exec) {
|
if (exec) {
|
||||||
lookUpVersion = exec[1];
|
lookUpVersion = exec[1];
|
||||||
}
|
}
|
||||||
}
|
} catch (_) {
|
||||||
catch (_) {
|
|
||||||
// no-op: if this does not work, use the other regex pattern.
|
// no-op: if this does not work, use the other regex pattern.
|
||||||
}
|
}
|
||||||
return lookUpVersion;
|
return lookUpVersion;
|
||||||
|
@ -1,12 +1,50 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
#set -x
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
BROWSER_TYPE=mac-x64
|
|
||||||
|
|
||||||
if [ ! -z "$1" ]; then BROWSER_TYPE=$1 ; fi
|
echo "Getting currently installed Chrome Version"
|
||||||
|
|
||||||
PATH_TO_COMMANDS=../../node_modules/webdriver-manager/built/lib/cmds
|
if [ "$CI" = "true" ]; then
|
||||||
PATH_TO_BINARIES=../../node_modules/webdriver-manager/built/lib/binaries
|
chromeVersion=$(google-chrome --version )
|
||||||
PATH_TO_SELENIUM=../../node_modules/webdriver-manager/selenium
|
else
|
||||||
|
chromeVersion=$(/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version )
|
||||||
|
fi
|
||||||
|
|
||||||
|
chromeVersion=${chromeVersion:14:20}
|
||||||
|
|
||||||
|
echo "Intalling webdriver for version: $chromeVersion"
|
||||||
|
|
||||||
|
function show_error() {
|
||||||
|
echo -e "\e[31m===============================================================\e[0m"
|
||||||
|
echo -e "\e[31mFAILED TO UPDATE WEBDRIVER-MANAGER, PLEASE DO IT MANUALLY!\e[0m"
|
||||||
|
echo -e "\e[31mRun the following command (sometimes needs more than one kick):\e[0m"
|
||||||
|
echo -e ""
|
||||||
|
echo -e "\e[31mnpx webdriver-manager update --gecko=false\e[0m"
|
||||||
|
echo -e ""
|
||||||
|
echo -e "====== WINDOWS USERS : PLEASE RUN THIS COMMAND: "
|
||||||
|
echo -e "npm run update-webdriver:windows"
|
||||||
|
echo -e "====== WINDOWS USERS ADVISORY END =================="
|
||||||
|
echo -e ""
|
||||||
|
echo -e "\e[31m===============================================================\e[0m"
|
||||||
|
}
|
||||||
|
|
||||||
|
ROOTDIR="$DIR/.."
|
||||||
|
|
||||||
|
if [ "$(uname)" == "Darwin" ]; then
|
||||||
|
BROWSER_TYPE="mac-x64"
|
||||||
|
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
|
||||||
|
BROWSER_TYPE="linux64"
|
||||||
|
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then
|
||||||
|
BROWSER_TYPE="win32"
|
||||||
|
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ]; then
|
||||||
|
BROWSER_TYPE="win64"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "BROWSER => $BROWSER_TYPE"
|
||||||
|
|
||||||
|
|
||||||
|
PATH_TO_COMMANDS=./node_modules/webdriver-manager/built/lib/cmds
|
||||||
|
PATH_TO_BINARIES=./node_modules/webdriver-manager/built/lib/binaries
|
||||||
|
PATH_TO_SELENIUM=./node_modules/webdriver-manager/selenium
|
||||||
|
|
||||||
# Remove existing drivers
|
# Remove existing drivers
|
||||||
rm -rf $PATH_TO_SELENIUM/selenium-server-*
|
rm -rf $PATH_TO_SELENIUM/selenium-server-*
|
||||||
@ -14,16 +52,25 @@ rm -rf $PATH_TO_SELENIUM/chromedriver-*
|
|||||||
rm -f $PATH_TO_SELENIUM/chromedriver_*
|
rm -f $PATH_TO_SELENIUM/chromedriver_*
|
||||||
|
|
||||||
# Replace browser type in file and create new file
|
# Replace browser type in file and create new file
|
||||||
sed "s/mac-x64/$BROWSER_TYPE/" chrome_xml_schema.js > chrome_xml.js
|
echo 'Replacing new webdriver files'
|
||||||
sed "s/mac-x64/$BROWSER_TYPE/" update_schema.js > update.js
|
sed "s/mac-x64/$BROWSER_TYPE/" $DIR/chrome_xml_schema.js > $DIR/chrome_xml.js && sed "s/mac-x64/$BROWSER_TYPE/" $DIR/update_schema.js > $DIR/update.js;
|
||||||
|
|
||||||
|
if [ "$?" -ne 0 ]; then
|
||||||
|
show_error
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "============== Trying to update the files =============="
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
# Replace webdriver files
|
# Replace webdriver files
|
||||||
cp -f update.js $PATH_TO_COMMANDS/update.js
|
echo "cp -f $DIR/update.js $PATH_TO_COMMANDS/update.js"
|
||||||
cp -f chrome_xml.js $PATH_TO_BINARIES/chrome_xml.js
|
cp -f $DIR/update.js $PATH_TO_COMMANDS/update.js
|
||||||
|
cp -f $DIR/chrome_xml.js $PATH_TO_BINARIES/chrome_xml.js
|
||||||
|
|
||||||
|
rm -f $DIR/update.js
|
||||||
|
rm -f $DIR/chrome_xml.js
|
||||||
|
|
||||||
|
node ./node_modules/webdriver-manager/bin/webdriver-manager update --gecko=false --versions.chrome=$chromeVersion
|
||||||
|
|
||||||
rm -f update.js
|
|
||||||
rm -f chrome_xml.js
|
|
||||||
|
|
||||||
#$(npm bin)/webdriver-manager update --gecko=false
|
|
||||||
node ../../node_modules/webdriver-manager/bin/webdriver-manager update --gecko=false
|
|
Loading…
x
Reference in New Issue
Block a user