mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Ensure that API keys are rendered before performing bulk delete in functional tests. (#148013)
This commit is contained in:
parent
5b53a8e9d9
commit
3a5f5626b2
4 changed files with 23 additions and 5 deletions
|
@ -116,7 +116,7 @@ describe('APIKeysGridPage', () => {
|
|||
const secondKey = getByText(/second-api-key/).closest('td');
|
||||
const secondKeyEuiLink = secondKey!.querySelector('button');
|
||||
expect(secondKeyEuiLink).not.toBeNull();
|
||||
expect(secondKeyEuiLink!.getAttribute('data-test-subj')).toBe('roleRowName-second-api-key');
|
||||
expect(secondKeyEuiLink!.getAttribute('data-test-subj')).toBe('apiKeyRowName-second-api-key');
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
|
|
|
@ -518,7 +518,7 @@ export class APIKeysGridPage extends Component<Props, State> {
|
|||
return (
|
||||
<EuiText color="subdued" size="s">
|
||||
<EuiLink
|
||||
data-test-subj={`roleRowName-${recordAP.name}`}
|
||||
data-test-subj={`apiKeyRowName-${recordAP.name}`}
|
||||
onClick={() => {
|
||||
this.setState({ selectedApiKey: recordAP, isUpdateFlyoutVisible: true });
|
||||
}}
|
||||
|
|
|
@ -17,6 +17,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
|
|||
const testSubjects = getService('testSubjects');
|
||||
const find = getService('find');
|
||||
const browser = getService('browser');
|
||||
const retry = getService('retry');
|
||||
|
||||
const testRoles: Record<string, any> = {
|
||||
viewer: {
|
||||
|
@ -37,8 +38,17 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
|
|||
},
|
||||
};
|
||||
|
||||
// Failing: See https://github.com/elastic/kibana/issues/141868
|
||||
describe.skip('Home page', function () {
|
||||
async function ensureApiKeysExist(apiKeysNames: string[]) {
|
||||
await retry.try(async () => {
|
||||
for (const apiKeyName of apiKeysNames) {
|
||||
log.debug(`Checking if API key ("${apiKeyName}") exists.`);
|
||||
await pageObjects.apiKeys.ensureApiKeyExists(apiKeyName);
|
||||
log.debug(`API key ("${apiKeyName}") exists.`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
describe('Home page', function () {
|
||||
before(async () => {
|
||||
await clearAllApiKeys(es, log);
|
||||
await security.testUser.setRoles(['kibana_admin']);
|
||||
|
@ -392,6 +402,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
|
|||
await pageObjects.apiKeys.clickOnPromptCreateApiKey();
|
||||
await pageObjects.apiKeys.setApiKeyName('api key 1');
|
||||
await pageObjects.apiKeys.clickSubmitButtonOnApiKeyFlyout();
|
||||
await ensureApiKeysExist(['api key 1']);
|
||||
});
|
||||
|
||||
it('one by one', async () => {
|
||||
|
@ -406,6 +417,9 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
|
|||
await pageObjects.apiKeys.setApiKeyName('api key 2');
|
||||
await pageObjects.apiKeys.clickSubmitButtonOnApiKeyFlyout();
|
||||
|
||||
// Make sure all API keys we want to delete are created and rendered.
|
||||
await ensureApiKeysExist(['api key 1', 'api key 2']);
|
||||
|
||||
await pageObjects.apiKeys.bulkDeleteApiKeys();
|
||||
expect(await pageObjects.apiKeys.getApiKeysFirstPromptTitle()).to.be(
|
||||
'Create your first API key'
|
||||
|
|
|
@ -103,7 +103,11 @@ export function ApiKeysPageProvider({ getService }: FtrProviderContext) {
|
|||
},
|
||||
|
||||
async clickExistingApiKeyToOpenFlyout(apiKeyName: string) {
|
||||
await testSubjects.click(`roleRowName-${apiKeyName}`);
|
||||
await testSubjects.click(`apiKeyRowName-${apiKeyName}`);
|
||||
},
|
||||
|
||||
async ensureApiKeyExists(apiKeyName: string) {
|
||||
await testSubjects.existOrFail(`apiKeyRowName-${apiKeyName}`);
|
||||
},
|
||||
|
||||
async getMetadataSwitch() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue