mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
save screenshot files only if they are present
This commit is contained in:
@@ -335,13 +335,37 @@ exports.waitUntilUrlIsShowed = function (urlToWait, timeout) {
|
||||
exports.waitUntilElementIsVisible = function (elementToCheck, timeout) {
|
||||
var waitTimeout = timeout || DEFAULT_TIMEOUT;
|
||||
|
||||
return browser.wait(until.visibilityOf(elementToCheck), waitTimeout, 'Element is not visible ' + elementToCheck.locator());
|
||||
this.waitUntilElementIsPresent(elementToCheck, timeout);
|
||||
|
||||
var isDisplayed = false;
|
||||
return browser.wait(() => {
|
||||
elementToCheck.isDisplayed().then(
|
||||
() => {
|
||||
isDisplayed = true;
|
||||
},
|
||||
(err) => {
|
||||
isDisplayed = false;
|
||||
}
|
||||
);
|
||||
return isDisplayed;
|
||||
}, waitTimeout, 'Element is not visible ' + elementToCheck.locator());
|
||||
};
|
||||
|
||||
exports.waitUntilElementIsPresent = function (elementToCheck, timeout) {
|
||||
var waitTimeout = timeout || DEFAULT_TIMEOUT;
|
||||
|
||||
return browser.wait(until.presenceOf(elementToCheck), waitTimeout, 'Element is not present ' + elementToCheck.locator());
|
||||
var isPresent = false;
|
||||
return browser.wait(() => {
|
||||
elementToCheck.isPresent().then(
|
||||
() => {
|
||||
isPresent = true;
|
||||
},
|
||||
(err) => {
|
||||
isPresent = false;
|
||||
}
|
||||
);
|
||||
return isPresent;
|
||||
}, waitTimeout, 'Element is not present ' + elementToCheck.locator());
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -40,6 +40,9 @@ describe('Save screenshot at the end', () => {
|
||||
hostEcm: TestConfig.adf.url
|
||||
});
|
||||
|
||||
let files = fs.readdirSync(path.join(__dirname, '../e2e-output/screenshots'));
|
||||
|
||||
if (files && files.length > 0) {
|
||||
alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
|
||||
|
||||
let folder = await alfrescoJsApi.nodes.addNode('-my-', {
|
||||
@@ -47,8 +50,6 @@ describe('Save screenshot at the end', () => {
|
||||
'nodeType': 'cm:folder'
|
||||
}, {}, {});
|
||||
|
||||
let files = fs.readdirSync(path.join(__dirname, '../e2e-output/screenshots'));
|
||||
|
||||
for (const fileName of files) {
|
||||
|
||||
let pathFile = path.join(__dirname, '../e2e-output/screenshots', fileName);
|
||||
@@ -64,7 +65,7 @@ describe('Save screenshot at the end', () => {
|
||||
'nodeType': 'cm:content'
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user