[Kibana Overview] Fix failing test (#139112)

* [Kibana Overview] Fix failing test

* Remove comment

* Fix regexp

* Add a comment

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Maja Grubic 2022-09-08 10:38:26 +02:00 committed by GitHub
parent 206c8b4ebd
commit 19293950ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -33,20 +33,30 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
);
});
it('contains the appropriate solutions', async () => {
it('contains Security and Observability solutions', async () => {
const solutionCards = await find.allByCssSelector('.kbnOverviewMore__item');
expect(solutionCards.length).to.be(2);
expect(solutionCards.length >= 2).to.be(true);
const observabilityImage = await solutionCards[0].findByCssSelector('img');
const observabilityImageUrl = await observabilityImage.getAttribute('src');
expect(observabilityImageUrl.includes('/solutions_observability.svg')).to.be(true);
const securityImage = await solutionCards[1].findByCssSelector('img');
const securityImageUrl = await securityImage.getAttribute('src');
expect(securityImageUrl.includes('/solutions_security_solution.svg')).to.be(true);
const imageSrcs = [];
const re = /.*(\/solutions_(observability|security_solution)\.svg)/;
const myRegexp = new RegExp(re, 'g');
for (let i = 0; i < solutionCards.length; i++) {
const solutionCard = solutionCards[i];
const image = await solutionCard.findByCssSelector('img');
const imageSrc = await image.getAttribute('src');
const match = myRegexp.exec(imageSrc);
myRegexp.lastIndex = 0;
if (match && match.length > 1) {
imageSrcs.push(match[1]);
}
}
expect(imageSrcs.includes('/solutions_observability.svg')).to.be(true);
expect(imageSrcs.includes('/solutions_security_solution.svg')).to.be(true);
});
it('click on Observability card leads to Observability', async () => {
// skipped as on Cloud it's a different setup than locally
// https://github.com/elastic/kibana/issues/139270
xit('click on Observability card leads to Observability', async () => {
let solutionCards: string | any[] = [];
await retry.waitForWithTimeout('all solutions to be present', 5000, async () => {
solutionCards = await find.allByCssSelector('.kbnOverviewMore__item');
@ -56,7 +66,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.common.waitUntilUrlIncludes('app/observability');
});
it('click on Security card leads to Security', async () => {
// skipped as on Cloud it's a different setup than locally
// https://github.com/elastic/kibana/issues/139270
xit('click on Security card leads to Security', async () => {
await PageObjects.common.navigateToUrl('kibana_overview', '', { useActualUrl: true });
await PageObjects.header.waitUntilLoadingHasFinished();