[Snapshot and Restore] Logsdb snapshot functional tests (#206318)

Part of https://github.com/elastic/kibana/issues/203716

## Summary
This PR creates the tests for Logsdb in the Snapshot and Restore plugin

* Verify that users can create snapshots from an LogsDB index
- Explanation: It should be possible to create a snapshot of a Index
with LogsDb mode from a regular repository. This test creates a
repository and a index with LogsDb mode, creates a policy, runs the
policy and verifies that the state of the snapshot is `Complete` and it
contains the LogsDb index.

* Verify that users can restore a LogsDB snapshot.
- Explanation: It should be possible to restore a snapshot of a Index
with LogsDb mode from a regular repository. This test takes the snapshot
created in the previous test and restore it. It verifies that it has
been restored and the status is `Complete`.
    
* Verify that users can NOT create a source-only snapshot from a LogsDB
index [Snapshot result would be "Partial"].
- Explanation: ES doesn't allow to create a snapshot in a source-only
repository for index with a synthetic source. Under the hood LogsDb uses
synthetic source (there is no `_source`). So, is expected that, when
creating a snapshot that includes a LogsDb index the result would be
partial since it won't be able to create the snapshot of the LogsDb
index. To test that, the test creates a source-only repository and a
index with LogsDb mode, creates a policy, runs the policy and verifies
that the state of the snapshot is `Partial`.

* Verify that users can NOT restore a source-only snapshot from a LogsDB
index.
- Explanation: Since the running the policy in the previous test hasn't
create the snapshot for the LogsDb index, the snapshot for that index
couldn't be restored. To verify that, the test tries to restore the
snapshot from the previous step and wait to have the following error
`index [sourceonly-logsdb-index] wasn't fully snapshotted - cannot
restore`

---------

Co-authored-by: Matthew Kime <matt@mattki.me>
This commit is contained in:
Sonia Sanz Vivas 2025-01-21 08:02:52 +01:00 committed by GitHub
parent b50669bdfe
commit d6522194b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 424 additions and 41 deletions

View file

@ -56,7 +56,10 @@ export const CollapsibleIndicesList: React.FunctionComponent<Props> = ({ indices
values={{ count: hiddenItemsCount }}
/>
)}{' '}
<EuiIcon type={isShowingFullList ? 'arrowUp' : 'arrowDown'} />
<EuiIcon
type={isShowingFullList ? 'arrowUp' : 'arrowDown'}
data-test-subj="collapsibleIndicesArrow"
/>
</EuiLink>
</>
) : null}

View file

@ -211,6 +211,7 @@ export const IndicesAndDataStreamsField: FunctionComponent<Props> = ({
setSelectIndicesMode('custom');
onUpdate({ indices: indexPatterns.join(',') });
}}
data-test-subj="useIndexPatternsButton"
>
<FormattedMessage
id="xpack.snapshotRestore.policyForm.stepSettings.indicesToggleCustomLink"

View file

@ -260,6 +260,7 @@ export const RestoreSnapshotStepLogistics: React.FunctionComponent<StepProps> =
});
}
}}
data-test-subj="allDsAndIndicesToggle"
/>
{isAllIndicesAndDataStreams ? null : (
<Fragment>
@ -281,6 +282,7 @@ export const RestoreSnapshotStepLogistics: React.FunctionComponent<StepProps> =
setSelectIndicesMode('custom');
updateRestoreSettings({ indices: restoreIndexPatterns.join(',') });
}}
data-test-subj="restoreIndexPatternsButton"
>
<FormattedMessage
id="xpack.snapshotRestore.restoreForm.stepLogistics.indicesToggleCustomLink"
@ -476,6 +478,7 @@ export const RestoreSnapshotStepLogistics: React.FunctionComponent<StepProps> =
});
}
}}
data-test-subj="restoreRenameToggle"
/>
{!isRenamingIndices ? null : (
<Fragment>
@ -510,6 +513,7 @@ export const RestoreSnapshotStepLogistics: React.FunctionComponent<StepProps> =
renamePattern: e.target.value,
});
}}
data-test-subj="capturePattern"
/>
</EuiFormRow>
</EuiFlexItem>
@ -536,6 +540,7 @@ export const RestoreSnapshotStepLogistics: React.FunctionComponent<StepProps> =
renameReplacement: e.target.value,
});
}}
data-test-subj="replacementPattern"
/>
</EuiFormRow>
</EuiFlexItem>

View file

@ -301,7 +301,7 @@ export const RestoreSnapshotStepReview: React.FunctionComponent<StepProps> = ({
return (
<Fragment>
<EuiTitle>
<EuiTitle data-test-subj="reviewSnapshotTitle">
<h2>
<FormattedMessage
id="xpack.snapshotRestore.restoreForm.stepReviewTitle"

View file

@ -76,7 +76,7 @@ export const RestoreSnapshotStepSettings: React.FunctionComponent<StepProps> = (
{/* Step title and doc link */}
<EuiFlexGroup justifyContent="spaceBetween">
<EuiFlexItem grow={false}>
<EuiTitle>
<EuiTitle data-test-subj="indexSettingsTitle">
<h2>
<FormattedMessage
id="xpack.snapshotRestore.restoreForm.stepSettingsTitle"

View file

@ -253,6 +253,7 @@ export const PolicyDetails: React.FunctionComponent<Props> = ({
);
},
disabled: Boolean(policyDetails.policy.inProgress),
'data-test-subj': 'policyActionMenuRunPolicy',
},
{
name: i18n.translate(

View file

@ -107,6 +107,7 @@ export const RestoreTable: React.FunctionComponent<Props> = React.memo(({ restor
}),
truncateText: true,
sortable: true,
'data-test-subj': 'restoreTableIndex',
},
{
field: 'isComplete',
@ -115,6 +116,7 @@ export const RestoreTable: React.FunctionComponent<Props> = React.memo(({ restor
}),
truncateText: true,
sortable: true,
'data-test-subj': 'restoreTableIsComplete',
render: (isComplete: SnapshotRestore['isComplete']) =>
isComplete ? (
<EuiHealth color="success">

View file

@ -99,6 +99,7 @@ export const SnapshotTable: React.FunctionComponent<Props> = (props: Props) => {
name: i18n.translate('xpack.snapshotRestore.snapshotList.table.stateColumnTitle', {
defaultMessage: 'State',
}),
'data-test-subj': 'snapshotState',
truncateText: false,
sortable: false,
render: (state: string) => <SnapshotState state={state} displayTooltipIcon={false} />,

View file

@ -233,6 +233,7 @@ export const SnapshotDetails: React.FunctionComponent<Props> = ({
snapshotDetails.state !== SNAPSHOT_STATE.SUCCESS &&
snapshotDetails.state !== SNAPSHOT_STATE.PARTIAL
}
data-test-subj="restoreSnapshotButton"
>
<FormattedMessage
id="xpack.snapshotRestore.snapshotDetails.restoreButtonLabel"

View file

@ -128,6 +128,7 @@ export const RestoreSnapshot: React.FunctionComponent<RouteComponentProps<MatchP
/>
}
error={saveError}
data-test-subj="restoreSnapshotError"
/>
) : null;
};

View file

@ -16,13 +16,14 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
const security = getService('security');
describe('Snapshot restore', function () {
const REPOSITORY = 'my-repository';
before(async () => {
await security.testUser.setRoles(['snapshot_restore_user'], { skipBrowserRefresh: true });
await pageObjects.common.navigateToApp('snapshotRestore');
// Create a repository
await es.snapshot.createRepository({
name: 'my-repository',
name: REPOSITORY,
verify: true,
repository: {
type: 'fs',
@ -32,50 +33,275 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
},
},
});
// Create a snapshot
await es.snapshot.create({
snapshot: 'my-snapshot',
repository: 'my-repository',
});
// Wait for snapshot to be ready
await pageObjects.common.sleep(2000);
// Refresh page so that the snapshot shows up in the snapshots table
await browser.refresh();
});
it('Renders the Snapshot restore form', async () => {
const snapshots = await pageObjects.snapshotRestore.getSnapshotList();
const snapshotRestoreButton = await snapshots[0].snapshotRestore;
// Open the Snapshot restore form
await snapshotRestoreButton.click();
describe('Snapshot', () => {
before(async () => {
// Create a snapshot
await es.snapshot.create({
snapshot: 'my-snapshot',
repository: REPOSITORY,
});
// Go to second step (Index settings)
await testSubjects.click('nextButton');
// Refresh page so that the snapshot shows up in the snapshots table
await browser.refresh();
});
// Verify that the Index Settings editor is rendered (uses CodeEditor)
await testSubjects.click('modifyIndexSettingsSwitch');
expect(await testSubjects.exists('indexSettingsEditor')).to.be(true);
after(async () => {
await es.snapshot.delete({
snapshot: 'my-snapshot',
repository: REPOSITORY,
});
});
// Close Index Settings editor
await testSubjects.click('modifyIndexSettingsSwitch');
it('Renders the Snapshot restore form', async () => {
await pageObjects.snapshotRestore.refreshWhileSnapshotIsInProgress();
await pageObjects.header.waitUntilLoadingHasFinished();
// Go to final step (Review)
await testSubjects.click('nextButton');
const snapshots = await pageObjects.snapshotRestore.getSnapshotList();
// Verify that Restore button exists
expect(await testSubjects.exists('restoreButton')).to.be(true);
const snapshotRestoreButton = await snapshots[0].snapshotRestore;
// Open the Snapshot restore form
await snapshotRestoreButton.click();
// Go to second step (Index settings)
await testSubjects.click('nextButton');
// Verify that the Index Settings editor is rendered (uses CodeEditor)
await testSubjects.click('modifyIndexSettingsSwitch');
expect(await testSubjects.exists('indexSettingsEditor')).to.be(true);
// Close Index Settings editor
await testSubjects.click('modifyIndexSettingsSwitch');
// Go to final step (Review)
await testSubjects.click('nextButton');
// Verify that Restore button exists
expect(await testSubjects.exists('restoreButton')).to.be(true);
});
});
describe('Allows to create and restore a snapshot from a Logsdb index', () => {
const logsDbIndex = 'logsdb-index';
const policyId = 'testPolicy';
const snapshotPrefx = 'logsdb-snap';
before(async () => {
await es.indices.create({
index: logsDbIndex,
settings: {
mode: 'logsdb',
},
});
await pageObjects.common.navigateToApp('snapshotRestore');
// Create a policy
await pageObjects.snapshotRestore.navToPolicies();
await pageObjects.snapshotRestore.fillCreateNewPolicyPageOne(
policyId,
`<${snapshotPrefx}-{now/d}>`
);
await pageObjects.snapshotRestore.fillCreateNewPolicyPageTwo();
await pageObjects.snapshotRestore.fillCreateNewPolicyPageThree();
await pageObjects.snapshotRestore.submitNewPolicy();
await pageObjects.snapshotRestore.closeFlyout();
});
after(async () => {
// Delete the logdb index
await es.indices.delete({
index: logsDbIndex,
});
// Delete policy
await es.slm.deleteLifecycle({
policy_id: policyId,
});
await es.snapshot.delete({
snapshot: `${snapshotPrefx}-*`,
repository: REPOSITORY,
});
await es.indices.delete({
index: `restored_${logsDbIndex}`,
});
});
it('create snapshot', async () => {
// Verify there are no snapshots
await pageObjects.snapshotRestore.navToSnapshots();
expect(await testSubjects.exists('emptyPrompt')).to.be(true);
// Run policy snapshot
await pageObjects.snapshotRestore.navToPolicies();
await pageObjects.snapshotRestore.clickPolicyNameLink(policyId);
await pageObjects.snapshotRestore.clickPolicyActionButton();
await pageObjects.snapshotRestore.clickRunPolicy();
await pageObjects.snapshotRestore.clickConfirmationModal();
await pageObjects.snapshotRestore.closeFlyout();
// Open snapshot info flyout
await pageObjects.snapshotRestore.navToSnapshots(false);
await pageObjects.header.waitUntilLoadingHasFinished();
expect(await testSubjects.exists('snapshotList')).to.be(true);
await pageObjects.snapshotRestore.refreshWhileSnapshotIsInProgress();
await pageObjects.header.waitUntilLoadingHasFinished();
// Verify that one snapshot has been created
const snapshots = await pageObjects.snapshotRestore.getSnapshotList();
expect(snapshots.length).to.be(1);
// Verify that snaphot has been created
const snapshotLink = snapshots[0].snapshotLink;
await snapshotLink.click();
// Verify snapshot exists, is complete and contains the logsdb index
expect(await testSubjects.exists('detailTitle')).to.be(true);
expect(await testSubjects.getVisibleText('detailTitle')).to.contain(snapshotPrefx);
expect(await testSubjects.exists('state')).to.be(true);
expect(await testSubjects.getVisibleText('state')).to.contain('Complete');
await pageObjects.snapshotRestore.clickShowCollapsedIndicesIfPresent();
expect(await testSubjects.getVisibleText('indices')).to.contain(logsDbIndex);
await pageObjects.snapshotRestore.closeSnaphsotFlyout();
});
it('restore snapshot', async () => {
// Verify there are not restore snapshots
await pageObjects.snapshotRestore.navToRestoreStatus();
await pageObjects.header.waitUntilLoadingHasFinished();
expect(await testSubjects.exists('noRestoredSnapshotsHeader')).to.be(true);
// restore snapshot
await pageObjects.snapshotRestore.navToSnapshots(false);
await pageObjects.header.waitUntilLoadingHasFinished();
const snapshots = await pageObjects.snapshotRestore.getSnapshotList();
const snapshotLink = snapshots[0].snapshotLink;
await snapshotLink.click();
await pageObjects.snapshotRestore.restoreSnapshot(logsDbIndex, true);
// Verify snapshot has been restored and is complete
await pageObjects.snapshotRestore.navToRestoreStatus(false);
const status = await pageObjects.snapshotRestore.getRestoreStatusList();
const statusIndex = status[0].index;
const statusIsComplete = status[0].isComplete;
expect(await statusIndex.getVisibleText()).to.be(`restored_${logsDbIndex}`);
expect(await statusIsComplete.getVisibleText()).to.contain('Complete');
});
});
describe('Does not allows to create and restore a source-only snapshot from a Logsdb index', () => {
const sourceOnlyLogsDbIndex = 'sourceonly-logsdb-index';
const sourceOnlyRepository = 'sourceOnlyRepository';
const policyId = 'source-only-testPolicy';
const snapshotPrefx = 'source-only-logsdb-snap';
before(async () => {
await es.indices.create({
index: sourceOnlyLogsDbIndex,
settings: {
mode: 'logsdb',
},
});
await pageObjects.common.navigateToApp('snapshotRestore');
// Create a policy
await pageObjects.snapshotRestore.navToPolicies();
await pageObjects.snapshotRestore.navToRepositories();
await pageObjects.snapshotRestore.createSourceOnlyRepositoryStepOne(sourceOnlyRepository);
await pageObjects.snapshotRestore.createSourceOnlyRepositoryStepTwo('/tmp/es-backups/');
await pageObjects.snapshotRestore.closeRepositoriesFlyout();
// Create a policy
await pageObjects.snapshotRestore.navToPolicies();
await pageObjects.snapshotRestore.fillCreateNewPolicyPageOne(
policyId,
`<${snapshotPrefx}-{now/d}>`,
sourceOnlyRepository
);
await pageObjects.snapshotRestore.fillCreateNewPolicyPageTwo(sourceOnlyLogsDbIndex);
await pageObjects.snapshotRestore.fillCreateNewPolicyPageThree();
await pageObjects.snapshotRestore.submitNewPolicy();
await pageObjects.snapshotRestore.closeFlyout();
});
after(async () => {
// Delete the logdb index
await es.indices.delete({
index: sourceOnlyLogsDbIndex,
});
// Delete policy
await es.slm.deleteLifecycle({
policy_id: policyId,
});
await es.snapshot.delete({
snapshot: `${snapshotPrefx}-*`,
repository: sourceOnlyRepository,
});
await es.snapshot.deleteRepository({
name: sourceOnlyRepository,
});
});
it('creating a snapshot results in a partial state', async () => {
// Verify there are no snapshots
await pageObjects.snapshotRestore.navToSnapshots();
expect(await testSubjects.exists('emptyPrompt')).to.be(true);
// Run policy snapshot
await pageObjects.snapshotRestore.navToPolicies();
await pageObjects.snapshotRestore.clickPolicyNameLink(policyId);
await pageObjects.snapshotRestore.clickPolicyActionButton();
await pageObjects.snapshotRestore.clickRunPolicy();
await pageObjects.snapshotRestore.clickConfirmationModal();
await pageObjects.snapshotRestore.closeFlyout();
// Open snapshot info flyout
await pageObjects.snapshotRestore.navToSnapshots(false);
await pageObjects.header.waitUntilLoadingHasFinished();
expect(await testSubjects.exists('snapshotList')).to.be(true);
await pageObjects.snapshotRestore.refreshWhileSnapshotIsInProgress();
await pageObjects.header.waitUntilLoadingHasFinished();
// Verify that one snapshot has been created
const snapshots = await pageObjects.snapshotRestore.getSnapshotList();
expect(snapshots.length).to.be(1);
// Verify that snaphot has been created
const snapshotLink = snapshots[0].snapshotLink;
await snapshotLink.click();
// Verify snapshot exists, is complete and contains the logsdb index
expect(await testSubjects.exists('detailTitle')).to.be(true);
expect(await testSubjects.getVisibleText('detailTitle')).to.contain(snapshotPrefx);
expect(await testSubjects.exists('state')).to.be(true);
expect(await testSubjects.getVisibleText('state')).to.contain('Partial');
await pageObjects.snapshotRestore.clickShowCollapsedIndicesIfPresent();
expect(await testSubjects.getVisibleText('indices')).to.contain(sourceOnlyLogsDbIndex);
await pageObjects.snapshotRestore.closeSnaphsotFlyout();
});
it('does not allow to restore snapshot', async () => {
// restore snapshot
await pageObjects.snapshotRestore.navToSnapshots(false);
await pageObjects.header.waitUntilLoadingHasFinished();
const snapshots = await pageObjects.snapshotRestore.getSnapshotList();
const snapshotLink = snapshots[0].snapshotLink;
await snapshotLink.click();
await pageObjects.snapshotRestore.restoreSnapshot(sourceOnlyLogsDbIndex, true);
// Verify it returns an error and doesn't allow to restore snapshot
expect(await testSubjects.exists('restoreSnapshotError')).to.be(true);
expect(await testSubjects.getVisibleText('restoreSnapshotError')).to.contain(
`index [${sourceOnlyLogsDbIndex}] wasn't fully snapshotted - cannot restore`
);
});
});
after(async () => {
await es.snapshot.delete({
snapshot: 'my-snapshot',
repository: 'my-repository',
});
await es.snapshot.deleteRepository({
name: 'my-repository',
name: REPOSITORY,
});
await security.testUser.restoreDefaults();
});

View file

@ -623,6 +623,13 @@ export default async function ({ readConfigFile }) {
'manage_slm',
'cluster:admin/snapshot',
'cluster:admin/repository',
'manage_index_templates',
],
indices: [
{
names: ['*'],
privileges: ['all'],
},
],
},
kibana: [

View file

@ -10,6 +10,7 @@ import { FtrProviderContext } from '../ftr_provider_context';
export function SnapshotRestorePageProvider({ getService }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
const retry = getService('retry');
const find = getService('find');
return {
async appTitleText() {
@ -44,28 +45,43 @@ export function SnapshotRestorePageProvider({ getService }: FtrProviderContext)
'Wait for register repository button to be on page',
10000,
async () => {
return await testSubjects.isDisplayed('noRestoredSnapshotsHeader');
return await testSubjects.isDisplayed(
emptyList ? 'noRestoredSnapshotsHeader' : 'restoreList'
);
}
);
},
async navToSnapshots(emptyList: boolean = true) {
await testSubjects.click('snapshots_tab');
await retry.waitForWithTimeout('Wait for snapshot list to be on page', 10000, async () => {
return await testSubjects.isDisplayed(emptyList ? 'snapshotListEmpty' : 'snapshotList');
return await testSubjects.isDisplayed(emptyList ? 'emptyPrompt' : 'snapshotList');
});
},
async fillCreateNewPolicyPageOne(policyName: string, snapshotName: string) {
async fillCreateNewPolicyPageOne(
policyName: string,
snapshotName: string,
repositoryName?: string
) {
await testSubjects.click('createPolicyButton');
await testSubjects.setValue('nameInput', policyName);
await testSubjects.setValue('snapshotNameInput', snapshotName);
if (repositoryName) {
await testSubjects.selectValue('repositorySelect', repositoryName);
}
await testSubjects.click('nextButton');
await retry.waitFor('all indices to be visible', async () => {
return await testSubjects.isDisplayed('allIndicesToggle');
});
},
async fillCreateNewPolicyPageTwo() {
async fillCreateNewPolicyPageTwo(singleIndexToSelect?: string) {
if (singleIndexToSelect) {
await testSubjects.click('allIndicesToggle');
await testSubjects.click('useIndexPatternsButton');
await testSubjects.setValue('comboBoxSearchInput', singleIndexToSelect);
await testSubjects.pressEnter('comboBoxSearchInput');
}
await testSubjects.click('nextButton');
await retry.waitFor('expire after value input to be visible', async () => {
return await testSubjects.isDisplayed('expireAfterValueInput');
@ -92,6 +108,18 @@ export function SnapshotRestorePageProvider({ getService }: FtrProviderContext)
return await testSubjects.isDisplayed('policyLink');
});
},
async closeSnaphsotFlyout() {
await testSubjects.click('euiFlyoutCloseButton');
await retry.waitFor('snapshot table to be visible', async () => {
return await testSubjects.isDisplayed('snapshotLink');
});
},
async closeRepositoriesFlyout() {
await testSubjects.click('srRepositoryDetailsFlyoutCloseButton');
await retry.waitFor('repositories table to be visible', async () => {
return await testSubjects.isDisplayed('repositoryLink');
});
},
async getSnapshotList() {
const table = await testSubjects.find('snapshotTable');
const rows = await table.findAllByTestSubject('row');
@ -120,6 +148,18 @@ export function SnapshotRestorePageProvider({ getService }: FtrProviderContext)
})
);
},
async getRestoreStatusList() {
const table = await testSubjects.find('restoreList');
const rows = await table.findAllByTestSubject('row');
return await Promise.all(
rows.map(async (row) => {
return {
index: await row.findByTestSubject('restoreTableIndex'),
isComplete: await row.findByTestSubject('restoreTableIsComplete'),
};
})
);
},
async viewRepositoryDetails(name: string) {
const repos = await this.getRepoList();
if (repos.length === 1) {
@ -137,5 +177,100 @@ export function SnapshotRestorePageProvider({ getService }: FtrProviderContext)
});
return await testSubjects.getVisibleText('cleanupCodeBlock');
},
async clickPolicyNameLink(name: string): Promise<void> {
await find.clickByLinkText(name);
},
async clickRestoredStatusNameLink(name: string): Promise<void> {
await find.clickByLinkText(name);
},
async clickPolicyActionButton() {
await testSubjects.click('policyActionMenuButton');
await retry.waitFor('run button to be visible', async () => {
return await testSubjects.isDisplayed('policyActionMenuRunPolicy');
});
},
async clickRunPolicy() {
await testSubjects.click('policyActionMenuRunPolicy');
await retry.waitFor('confirm modal to be visible', async () => {
return await testSubjects.isDisplayed('confirmModalConfirmButton');
});
},
async clickConfirmationModal() {
await testSubjects.click('confirmModalConfirmButton');
},
async clickShowCollapsedIndicesIfPresent() {
if (await testSubjects.exists('collapsibleIndicesArrow')) {
await testSubjects.click('collapsibleIndicesArrow');
}
},
async restoreSnapshot(indexName: string, rename: boolean = false) {
await testSubjects.click('restoreSnapshotButton');
await retry.waitFor('restore form to be visible', async () => {
return await testSubjects.isDisplayed('snapshotRestoreApp');
});
await testSubjects.click('allDsAndIndicesToggle');
await testSubjects.click('restoreIndexPatternsButton');
await testSubjects.setValue('comboBoxSearchInput', indexName);
await testSubjects.pressEnter('comboBoxSearchInput');
if (rename) {
await testSubjects.click('restoreRenameToggle');
await testSubjects.setValue('capturePattern', `${indexName}(.*)`);
await testSubjects.setValue('replacementPattern', `restored_${indexName}$1`);
}
await testSubjects.click('nextButton');
await retry.waitFor('index settings to be visible', async () => {
return await testSubjects.isDisplayed('indexSettingsTitle');
});
await testSubjects.click('nextButton');
await retry.waitFor('review step to be visible', async () => {
return await testSubjects.isDisplayed('reviewSnapshotTitle');
});
await testSubjects.click('restoreButton');
},
async createSourceOnlyRepositoryStepOne(repositoryName: string) {
await testSubjects.click('registerRepositoryButton');
await testSubjects.setValue('nameInput', `${repositoryName}`);
await testSubjects.click('fsRepositoryType');
await testSubjects.click('sourceOnlyToggle');
await testSubjects.click('nextButton');
await retry.waitFor('step two to be visible', async () => {
return await testSubjects.isDisplayed('stepTwo');
});
},
async createSourceOnlyRepositoryStepTwo(location: string) {
await testSubjects.setValue('locationInput', location);
await testSubjects.click('compressToggle');
await testSubjects.click('submitButton');
await retry.waitFor('repository list to be visible', async () => {
return await testSubjects.isDisplayed('repositoryList');
});
},
async refreshWhileSnapshotIsInProgress() {
let isInProgress = true;
while (isInProgress) {
const table = await testSubjects.find('snapshotTable');
const rows = await table.findAllByTestSubject('row');
const snapshotState = await (
await rows[0].findByTestSubject('snapshotState')
).getVisibleText();
if (snapshotState === 'In progress') {
await testSubjects.click('reloadButton');
} else {
isInProgress = false;
}
}
},
};
}