Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS] Automate observability case file screenshot #156775

Merged
merged 1 commit into from
May 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@

import { CommentType } from '@kbn/cases-plugin/common/api';
import { FtrProviderContext } from '../../../ftr_provider_context';
import { createAndUploadFile } from '../../../../cases_api_integration/common/lib/api';
import { OBSERVABILITY_FILE_KIND } from '../../../../cases_api_integration/common/lib/constants';

export default function ({ getService }: FtrProviderContext) {
export default function ({ getPageObject, getService }: FtrProviderContext) {
const common = getPageObject('common');
const cases = getService('cases');
const commonScreenshots = getService('commonScreenshots');

const screenshotDirectories = ['response_ops_docs', 'observability_cases'];
const supertest = getService('supertest');
const testSubjects = getService('testSubjects');
let caseIdMonitoring: string;
let caseOwnerMonitoring: string;

describe('list view', function () {
before(async () => {
Expand All @@ -39,17 +45,35 @@ export default function ({ getService }: FtrProviderContext) {
});
await cases.api.setStatus(caseIdLogs, caseVersionLogs, 'closed');

const { id: caseIdMonitoring } = await cases.api.createCase({
const caseMonitoring = await cases.api.createCase({
title: 'Monitor uptime',
tags: ['swimlane'],
description: 'Test.',
owner: 'observability',
});
caseIdMonitoring = caseMonitoring.id;
caseOwnerMonitoring = caseMonitoring.owner;

const { version: caseVersionMonitoring } = await cases.api.createAttachment({
caseId: caseIdMonitoring,
params: { comment: 'test comment', type: CommentType.user, owner: 'observability' },
});

await cases.api.setStatus(caseIdMonitoring, caseVersionMonitoring, 'in-progress');

await createAndUploadFile({
supertest,
createFileParams: {
name: 'testfile',
kind: OBSERVABILITY_FILE_KIND,
mimeType: 'image/png',
meta: {
caseIds: [caseIdMonitoring],
owner: [caseOwnerMonitoring],
},
},
data: 'abc',
});
});

after(async () => {
Expand All @@ -58,7 +82,19 @@ export default function ({ getService }: FtrProviderContext) {

it('cases list screenshot', async () => {
await cases.navigation.navigateToApp('observability/cases', 'cases-all-title');
await commonScreenshots.takeScreenshot('cases', screenshotDirectories, 1400, 1024);
await commonScreenshots.takeScreenshot('cases', screenshotDirectories, 1700, 1024);
});

it('case detail screenshot', async () => {
await common.navigateToUrlWithBrowserHistory('observability', `/cases/${caseIdMonitoring}`);
Copy link
Contributor Author

@lcawl lcawl May 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  await common.navigateToUrlWithBrowserHistory('observability', `/cases/${caseIdMonitoring}`);

Interestingly, I couldn't get navigateToSingleCase to work here, since observability/cases seemed to be deemed an invalid app.

const filesTab = await testSubjects.find('case-view-tab-title-files');
await filesTab.click();
await commonScreenshots.takeScreenshot(
'observabiity-case-files',
screenshotDirectories,
1400,
1024
);
});
});
}