[8.10] [Flaky #135251] Unskip test (#164718) (#164946)

# Backport

This will backport the following commits from `main` to `8.10`:
- [[Flaky #135251] Unskip test
(#164718)](https://github.com/elastic/kibana/pull/164718)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Alejandro Fernández
Haro","email":"alejandro.haro@elastic.co"},"sourceCommit":{"committedDate":"2023-08-28T07:55:29Z","message":"[Flaky
#135251] Unskip test (#164718)\n\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"ba61ac0366a5ee80e1c4e2ef91444d444b829af8","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","technical
debt","release_note:skip","test-failure-flaky","Team:SharedUX","backport:prev-minor","v8.11.0"],"number":164718,"url":"https://github.com/elastic/kibana/pull/164718","mergeCommit":{"message":"[Flaky
#135251] Unskip test (#164718)\n\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"ba61ac0366a5ee80e1c4e2ef91444d444b829af8"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/164718","number":164718,"mergeCommit":{"message":"[Flaky
#135251] Unskip test (#164718)\n\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"ba61ac0366a5ee80e1c4e2ef91444d444b829af8"}}]}]
BACKPORT-->

Co-authored-by: Alejandro Fernández Haro <alejandro.haro@elastic.co>
This commit is contained in:
Kibana Machine 2023-08-28 04:59:40 -04:00 committed by GitHub
parent bc1e56084b
commit c3839cf649
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 6 deletions

View file

@ -7,8 +7,9 @@
*/
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getService, getPageObjects }) {
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const browser = getService('browser');
const globalNav = getService('globalNav');
const testSubjects = getService('testSubjects');

View file

@ -13,8 +13,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const globalNav = getService('globalNav');
const PageObjects = getPageObjects(['newsfeed', 'common']);
// FLAKY: https://github.com/elastic/kibana/issues/135251
describe.skip('Newsfeed', () => {
describe('Newsfeed', () => {
before(async () => {
await PageObjects.newsfeed.resetPage();
});

View file

@ -6,7 +6,9 @@
* Side Public License, v 1.
*/
export default function ({ getService, loadTestFile }) {
import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getService, loadTestFile }: FtrProviderContext) {
const browser = getService('browser');
describe('home app', function () {

View file

@ -109,6 +109,18 @@ export class CommonPageObject extends FtrService {
? await this.loginIfPrompted(appUrl, insertTimestamp, disableWelcomePrompt)
: await this.browser.getCurrentUrl();
if (
currentUrl.includes('/app/home') &&
disableWelcomePrompt &&
(await this.isWelcomeScreen())
) {
await this.browser.setLocalStorageItem('home:welcome:show', 'false');
// Force a new navigation again
const msg = `Found the Welcome page in ${currentUrl}. Skipping it...`;
this.log.debug(msg);
throw new Error(msg);
}
if (ensureCurrentUrl && !currentUrl.includes(appUrl)) {
throw new Error(`expected ${currentUrl}.includes(${appUrl})`);
}
@ -274,7 +286,7 @@ export class CommonPageObject extends FtrService {
appName === 'home' &&
currentUrl.includes('app/home') &&
disableWelcomePrompt &&
(await this.isChromeHidden())
(await this.isWelcomeScreen())
) {
await this.browser.setLocalStorageItem('home:welcome:show', 'false');
const msg = `Failed to skip the Welcome page when navigating the app ${appName}`;
@ -505,6 +517,10 @@ export class CommonPageObject extends FtrService {
}
}
async isWelcomeScreen() {
return await this.testSubjects.exists('homeWelcomeInterstitial');
}
/**
* Get visible text of the Welcome Banner
*/

View file

@ -21,7 +21,7 @@ export class NewsfeedPageObject extends FtrService {
}
async resetPage() {
await this.common.navigateToUrl('home', undefined); // navigateToApp sets `disableWelcomePrompt` to true under the hood. `navigateToUrl` explicitly disables the welcome screen.
await this.common.navigateToApp('home');
}
async closeNewsfeedPanel() {