Skip to content

Commit

Permalink
[Kibana Overview] Fix failing test (elastic#139112)
Browse files Browse the repository at this point in the history
* [Kibana Overview] Fix failing test

* Remove comment

* Fix regexp

* Add a comment

Co-authored-by: Kibana Machine <[email protected]>
(cherry picked from commit 1929395)
  • Loading branch information
Maja Grubic committed Sep 9, 2022
1 parent d4f5d7f commit 5460540
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions test/functional/apps/kibana_overview/_solutions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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();

Expand Down

0 comments on commit 5460540

Please sign in to comment.