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.
*/
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 { FileModel } from '../../models/ACS/file.model';
import { browser } from 'protractor';
@@ -37,6 +45,7 @@ describe('CardView Component - properties', () => {
const viewerPage = new ViewerPage();
const metadataViewPage = new MetadataViewPage();
const contentServicesPage = new ContentServicesPage();
const togglePage = new TogglePage();
let acsUser: UserModel;
@@ -145,7 +154,11 @@ describe('CardView Component - properties', () => {
await viewerPage.checkInfoSideBarIsDisplayed();
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 () => {

View File

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

View File

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

View File

@@ -1,12 +1,46 @@
#!/bin/bash
#set -x
BROWSER_TYPE=mac-x64
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ ! -z "$1" ]; then BROWSER_TYPE=$1 ; fi
echo "Getting currently installed Chrome Version"
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
if [ "$CI" = "true" ]; then
chromeVersion=$(google-chrome --version )
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
rm -rf $PATH_TO_SELENIUM/selenium-server-*
@@ -14,16 +48,23 @@ rm -rf $PATH_TO_SELENIUM/chromedriver-*
rm -f $PATH_TO_SELENIUM/chromedriver_*
# Replace browser type in file and create new file
sed "s/mac-x64/$BROWSER_TYPE/" chrome_xml_schema.js > chrome_xml.js
sed "s/mac-x64/$BROWSER_TYPE/" update_schema.js > update.js
echo 'Replacing new webdriver files'
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
# Replace webdriver files
cp -f update.js $PATH_TO_COMMANDS/update.js
cp -f chrome_xml.js $PATH_TO_BINARIES/chrome_xml.js
echo "cp -f $DIR/update.js $PATH_TO_COMMANDS/update.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 chrome_xml.js
rm -f $DIR/update.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
node ./node_modules/webdriver-manager/bin/webdriver-manager update --gecko=false --versions.chrome=$chromeVersion