fixig e2es

This commit is contained in:
Vito Albano
2023-12-15 10:21:24 +00:00
committed by VitoAlbano
parent d6390df7e9
commit a572b00e40
4 changed files with 113 additions and 63 deletions

View File

@@ -15,7 +15,15 @@
* limitations under the License. * limitations under the License.
*/ */
import { createApiService, CheckboxPage, LoginPage, UploadActions, UserModel, UsersActions, ViewerPage } from '@alfresco/adf-testing'; import { createApiService,
CheckboxPage,
LoginPage,
UploadActions,
UserModel,
UsersActions,
ViewerPage,
TogglePage
} from '@alfresco/adf-testing';
import { MetadataViewPage } from '../../core/pages/metadata-view.page'; import { MetadataViewPage } from '../../core/pages/metadata-view.page';
import { FileModel } from '../../models/ACS/file.model'; import { FileModel } from '../../models/ACS/file.model';
import { browser } from 'protractor'; import { browser } from 'protractor';
@@ -37,6 +45,7 @@ describe('CardView Component - properties', () => {
const viewerPage = new ViewerPage(); const viewerPage = new ViewerPage();
const metadataViewPage = new MetadataViewPage(); const metadataViewPage = new MetadataViewPage();
const contentServicesPage = new ContentServicesPage(); const contentServicesPage = new ContentServicesPage();
const togglePage = new TogglePage();
let acsUser: UserModel; let acsUser: UserModel;
@@ -145,7 +154,11 @@ describe('CardView Component - properties', () => {
await viewerPage.checkInfoSideBarIsDisplayed(); await viewerPage.checkInfoSideBarIsDisplayed();
await metadataViewPage.clickOnPropertiesTab(); await metadataViewPage.clickOnPropertiesTab();
await CheckboxPage.uncheck(metadataViewPage.defaultPropertiesSwitch); await metadataViewPage.informationButtonIsDisplayed();
await togglePage.disableToggle(metadataViewPage.defaultPropertiesSwitch);
await metadataViewPage.informationButtonIsNotDisplayed();
}); });
it('[C307975] Should be able to choose which aspect to show expanded in the info-drawer', async () => { it('[C307975] Should be able to choose which aspect to show expanded in the info-drawer', async () => {

View File

@@ -75,7 +75,8 @@ describe('Checklist component', () => {
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[0]); await taskPage.tasksListPage().checkContentIsDisplayed(tasks[0]);
await taskPage.tasksListPage().selectRow(tasks[0]); await taskPage.tasksListPage().selectRow(tasks[0]);
await (await taskPage.clickOnAddChecklistButton()).clickCreateChecklistButton(); await taskPage.clickOnAddChecklistButton();
await checklistDialog.clickCreateChecklistButton();
await taskPage.checkChecklistDialogIsNotDisplayed(); await taskPage.checkChecklistDialogIsNotDisplayed();
await taskPage.checkNoChecklistIsDisplayed(); await taskPage.checkNoChecklistIsDisplayed();
expect(await taskPage.getNumberOfChecklists()).toEqual('0'); expect(await taskPage.getNumberOfChecklists()).toEqual('0');

View File

@@ -46,13 +46,13 @@ 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 'win'; return 'win64';
} }
else { else {
return 'linux'; return 'linux64';
} }
} }
/** /**
@@ -95,48 +95,43 @@ class ChromeXml extends config_source_1.XmlConfigSource {
/** /**
* 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 = 'https://googlechromelabs.github.io/chrome-for-testing/latest-patch-versions-per-build-with-downloads.json';
let version = item.split('/')[0]; return http_utils_1.requestBody(lastKnownGoodVersionsWithDownloads_Url).then(body => {
if (semver.valid(version) == null) { const version_Body = JSON.parse(body)['builds'][baseTagVersion]
const lookUpVersion = getValidSemver(version);
if (semver.valid(lookUpVersion)) { const opSys = this.getOsTypeName();
// Check to see if the specified version matches.
if (lookUpVersion === specificVersion) { const currentVersion = version_Body['version']
// When item found is null, check the os arch const currentVersion_Url = version_Body['downloads']['chromedriver'].find(obj => obj['platform'] == opSys)['url']
// 64-bit version works OR not 64-bit version and the path does not have '64'
if (itemFound == '') { const latestMajorVersion = currentVersion.split('.')[0]
if (this.osarch === 'x64' ||
(this.osarch !== 'x64' && !item.includes(this.getOsTypeName() + '64'))) { const localVersion_FileName = fs.readdirSync(path.resolve(__dirname, '..', '..', '..', 'selenium'))
itemFound = item; .find(f => f.startsWith(`chromedriver_${latestMajorVersion}`)) || ''
}
if (this.osarch === 'arm64' && this.ostype === 'Darwin' && item.includes('m1')) { const localVersion = localVersion_FileName.slice(13, -4)
itemFound = item; const localVersion_Url = currentVersion_Url.replace(currentVersion, localVersion)
}
} const localMajorVersion = localVersion.split('.')[0]
else if (this.osarch === 'x64') {
// No win64 version exists, so even on x64 we need to look for win32 if (latestMajorVersion == localMajorVersion) {
const osTypeNameAndArch = this.getOsTypeName() + (this.getOsTypeName() === 'win' ? '32' : '64'); return Promise.resolve({
if (item.includes(osTypeNameAndArch)) { url: localVersion_Url,
itemFound = item; version: localVersion,
} })
} } else {
} return Promise.resolve({
} url: currentVersion_Url,
} version: currentVersion,
} })
if (itemFound == '') {
return { url: '', version: inputVersion };
}
else {
return { url: config_1.Config.cdnUrls().chrome + itemFound, version: inputVersion };
} }
}); });
} }

View File

@@ -1,12 +1,46 @@
#!/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 "\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 +48,23 @@ 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 update.js rm -f $DIR/update.js
rm -f chrome_xml.js rm -f $DIR/chrome_xml.js
#$(npm bin)/webdriver-manager update --gecko=false node ./node_modules/webdriver-manager/bin/webdriver-manager update --gecko=false --versions.chrome=$chromeVersion
node ../../node_modules/webdriver-manager/bin/webdriver-manager update --gecko=false