mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[Search] [Onboarding] unskip FTR tests (#202818)
## Summary Updates the API Key specific tests to retry by deleting the api keys and reloading and perform test again. ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
2994b0001c
commit
486bdbf3fe
3 changed files with 46 additions and 5 deletions
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import { SecurityApiKey } from '@elastic/elasticsearch/lib/api/types';
|
||||
import { FtrProviderContext } from '../ftr_provider_context';
|
||||
|
||||
const APIKEY_MASK = '•'.repeat(60);
|
||||
|
@ -27,6 +28,10 @@ export function SvlApiKeysProvider({ getService, getPageObjects }: FtrProviderCo
|
|||
await browser.clearSessionStorage();
|
||||
},
|
||||
|
||||
async expectAPIKeyExists() {
|
||||
await testSubjects.existOrFail('apiKeyFormAPIKey', { timeout: 1000 });
|
||||
},
|
||||
|
||||
async expectAPIKeyAvailable() {
|
||||
await testSubjects.existOrFail('apiKeyFormAPIKey');
|
||||
await retry.try(async () => {
|
||||
|
@ -88,8 +93,19 @@ export function SvlApiKeysProvider({ getService, getPageObjects }: FtrProviderCo
|
|||
},
|
||||
|
||||
async deleteAPIKeys() {
|
||||
const filterInvalid = (key: SecurityApiKey) => !key.invalidated;
|
||||
|
||||
const { api_keys: apiKeys } = await es.security.getApiKey();
|
||||
await es.security.invalidateApiKey({ ids: apiKeys.map((key) => key.id) });
|
||||
|
||||
const validKeys = apiKeys.filter(filterInvalid);
|
||||
|
||||
if (validKeys.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
await es.security.invalidateApiKey({
|
||||
ids: validKeys.map((key) => key.id),
|
||||
});
|
||||
},
|
||||
|
||||
async expectCreateApiKeyAction() {
|
||||
|
|
|
@ -21,13 +21,13 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
const esDeleteAllIndices = getService('esDeleteAllIndices');
|
||||
const es = getService('es');
|
||||
const browser = getService('browser');
|
||||
const retry = getService('retry');
|
||||
|
||||
const deleteAllTestIndices = async () => {
|
||||
await esDeleteAllIndices(['search-*', 'test-*']);
|
||||
};
|
||||
|
||||
// Failing: See https://github.com/elastic/kibana/issues/200020
|
||||
describe.skip('Elasticsearch Start [Onboarding Empty State]', function () {
|
||||
describe('Elasticsearch Start [Onboarding Empty State]', function () {
|
||||
describe('developer', function () {
|
||||
before(async () => {
|
||||
await pageObjects.svlCommonPage.loginWithRole('developer');
|
||||
|
@ -96,7 +96,20 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
it('should show the api key in code view', async () => {
|
||||
await pageObjects.svlSearchElasticsearchStartPage.expectToBeOnStartPage();
|
||||
await pageObjects.svlSearchElasticsearchStartPage.clickCodeViewButton();
|
||||
// sometimes the API key exists in the cluster and its lost in sessionStorage
|
||||
// if fails we retry to delete the API key and refresh the browser
|
||||
await retry.try(
|
||||
async () => {
|
||||
await pageObjects.svlApiKeys.expectAPIKeyExists();
|
||||
},
|
||||
async () => {
|
||||
await pageObjects.svlApiKeys.deleteAPIKeys();
|
||||
await browser.refresh();
|
||||
await pageObjects.svlSearchElasticsearchStartPage.clickCodeViewButton();
|
||||
}
|
||||
);
|
||||
await pageObjects.svlApiKeys.expectAPIKeyAvailable();
|
||||
|
||||
const apiKeyUI = await pageObjects.svlApiKeys.getAPIKeyFromUI();
|
||||
const apiKeySession = await pageObjects.svlApiKeys.getAPIKeyFromSessionStorage();
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
const svlSearchNavigation = getService('svlSearchNavigation');
|
||||
const es = getService('es');
|
||||
const security = getService('security');
|
||||
const browser = getService('browser');
|
||||
const retry = getService('retry');
|
||||
|
||||
const esDeleteAllIndices = getService('esDeleteAllIndices');
|
||||
const indexName = 'test-my-index';
|
||||
|
@ -81,11 +83,21 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
});
|
||||
});
|
||||
|
||||
describe.skip('API key details', () => {
|
||||
// Flaky test related with deleting API keys
|
||||
describe('API key details', () => {
|
||||
it('should show api key', async () => {
|
||||
await pageObjects.svlApiKeys.deleteAPIKeys();
|
||||
await svlSearchNavigation.navigateToIndexDetailPage(indexName);
|
||||
// sometimes the API key exists in the cluster and its lost in sessionStorage
|
||||
// if fails we retry to delete the API key and refresh the browser
|
||||
await retry.try(
|
||||
async () => {
|
||||
await pageObjects.svlApiKeys.expectAPIKeyExists();
|
||||
},
|
||||
async () => {
|
||||
await pageObjects.svlApiKeys.deleteAPIKeys();
|
||||
await browser.refresh();
|
||||
}
|
||||
);
|
||||
await pageObjects.svlApiKeys.expectAPIKeyAvailable();
|
||||
const apiKey = await pageObjects.svlApiKeys.getAPIKeyFromUI();
|
||||
await pageObjects.svlSearchIndexDetailPage.expectAPIKeyToBeVisibleInCodeBlock(apiKey);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue