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

Fix API Keys functional test in cloud #74075

Merged
merged 2 commits into from
Aug 3, 2020
Merged
Show file tree
Hide file tree
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
15 changes: 11 additions & 4 deletions x-pack/test/functional/apps/api_keys/home_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
const pageObjects = getPageObjects(['common', 'apiKeys']);
const log = getService('log');
const security = getService('security');
const testSubjects = getService('testSubjects');

describe('Home page', function () {
before(async () => {
Expand All @@ -32,10 +33,16 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
it('Loads the app', async () => {
await security.testUser.setRoles(['test_api_keys']);
log.debug('Checking for section header');
const headerText = await pageObjects.apiKeys.noAPIKeysHeading();
expect(headerText).to.be('No API keys');
const goToConsoleButton = await pageObjects.apiKeys.getGoToConsoleButton();
expect(await goToConsoleButton.isDisplayed()).to.be(true);
const headers = await testSubjects.findAll('noApiKeysHeader');
if (headers.length > 0) {
expect(await headers[0].getVisibleText()).to.be('No API keys');
const goToConsoleButton = await pageObjects.apiKeys.getGoToConsoleButton();
expect(await goToConsoleButton.isDisplayed()).to.be(true);
} else {
// page may already contain EiTable with data, then check API Key Admin text
const description = await pageObjects.apiKeys.getApiKeyAdminDesc();
expect(description).to.be('You are an API Key administrator.');
}
});
});
};
4 changes: 4 additions & 0 deletions x-pack/test/functional/page_objects/api_keys_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export function ApiKeysPageProvider({ getService }: FtrProviderContext) {
return await testSubjects.getVisibleText('noApiKeysHeader');
},

async getApiKeyAdminDesc() {
return await testSubjects.getVisibleText('apiKeyAdminDescriptionCallOut');
},

async getGoToConsoleButton() {
return await testSubjects.find('goToConsoleButton');
},
Expand Down