stacktrace raw + e2e amends
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Carlos Jimenez Ruiz 2020-11-09 18:25:02 +01:00
parent 282adfa7b6
commit 82c739eab2
4 changed files with 40 additions and 22 deletions

View File

@ -247,7 +247,7 @@ let actions = {
write: async function(selector, text) {
let builtSelector = await this.selectorFormater(selector);
await this.waitForSelector(selector, {});
await this.waitForSelector(selector);
await this.type(builtSelector, text);
await this.waitForTextInField(selector, text);
},
@ -340,6 +340,31 @@ let actions = {
});
},
waitForTextInField: async function(selector, text) {
let builtSelector = await this.selectorFormater(selector);
await this.waitForSelector(builtSelector);
const expectedText = text.toLowerCase();
return new Promise((resolve, reject) => {
let attempts = 0;
const interval = setInterval(async() => {
const currentText = await this.evaluate(selector => {
return document.querySelector(selector).value.toLowerCase();
}, builtSelector);
if (currentText === expectedText || attempts === 40) {
clearInterval(interval);
resolve(currentText);
}
attempts += 1;
}, 100);
}).then(result => {
if (result === '')
return expect(result).toEqual(expectedText);
return expect(result).toContain(expectedText);
});
},
selectorFormater: function(selector) {
if (selector.includes('vn-textarea'))
return `${selector} textarea`;
@ -350,14 +375,6 @@ let actions = {
return `${selector} input`;
},
waitForTextInField: async function(selector, text) {
let builtSelector = await this.selectorFormater(selector);
await this.waitForSelector(builtSelector);
return await this.waitForFunction((selector, text) => {
return document.querySelector(selector).value.toLowerCase().includes(text.toLowerCase());
}, {}, builtSelector, text);
},
waitForInnerText: async function(selector) {
await this.waitForSelector(selector, {});
await this.waitForFunction(selector => {

View File

@ -1,7 +1,7 @@
import selectors from '../../../helpers/selectors.js';
import getBrowser from '../../../helpers/puppeteer';
fdescribe('Ticket List sale path', () => {
describe('Ticket List sale path', () => {
let browser;
let page;

View File

@ -62,6 +62,7 @@ describe('Supplier contact path', () => {
});
it(`should check the new contact note was saved correctly`, async() => {
await page.waitForTextInField(selectors.supplierContact.thirdContactNotes, 'the end to end integration tester');
const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactNotes, 'value');
expect(result).toContain('the end to end integration tester');

View File

@ -187,7 +187,7 @@ function e2eSingleRun() {
displaySpecDuration: true,
},
summary: {
displayStacktrace: 'pretty',
displayStacktrace: 'raw',
displayPending: false
},
colors: {
@ -195,17 +195,17 @@ function e2eSingleRun() {
successful: 'brightGreen',
failed: 'brightRed'
},
stacktrace: {
filter: stacktrace => {
const lines = stacktrace.split('\n');
const filtered = [];
for (let i = 1; i < lines.length; i++) {
if (/e2e\/paths/.test(lines[i]))
filtered.push(lines[i]);
}
return filtered.join('\n');
}
}
// stacktrace: {
// filter: stacktrace => {
// const lines = stacktrace.split('\n');
// const filtered = [];
// for (let i = 1; i < lines.length; i++) {
// if (/e2e\/paths/.test(lines[i]))
// filtered.push(lines[i]);
// }
// return filtered.join('\n');
// }
// }
})
]
}));