-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RAC][Observability]: test cases for alerts pagination functional tes…
…ts (#112617) (#113474) * [RAC][Observability]: test cases for alerts pagination functional tests * page size selector tests * create OPEN_ALERTS_ROWS_COUNT in workdlow status tests * add tests to check if page selector is rendered or not * reorganize tests to visible and non visible pagination controls * default rows per page test * page size selector tests * more page selector tests * write tests for pagination controls * move pagination tests to a new file * remove unused variables * reorganize observability alerts service * undo configuration change * fix workflow status tests after refactoring * clean up * pr review comments * change variable name * rewording pagination tests Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: mgiota <[email protected]>
- Loading branch information
1 parent
56c3813
commit a1adc9c
Showing
7 changed files
with
313 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
x-pack/test/functional/services/observability/alerts/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { ObservabilityAlertsPaginationProvider } from './pagination'; | ||
import { ObservabilityAlertsCommonProvider } from './common'; | ||
|
||
import { FtrProviderContext } from '../../../ftr_provider_context'; | ||
|
||
export function ObservabilityAlertsProvider(context: FtrProviderContext) { | ||
const common = ObservabilityAlertsCommonProvider(context); | ||
const pagination = ObservabilityAlertsPaginationProvider(context); | ||
|
||
return { | ||
common, | ||
pagination, | ||
}; | ||
} |
109 changes: 109 additions & 0 deletions
109
x-pack/test/functional/services/observability/alerts/pagination.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { FtrProviderContext } from '../../../ftr_provider_context'; | ||
|
||
const ROWS_PER_PAGE_SELECTOR = 'tablePaginationPopoverButton'; | ||
const PREV_BUTTON_SELECTOR = 'pagination-button-previous'; | ||
const NEXT_BUTTON_SELECTOR = 'pagination-button-next'; | ||
const TEN_ROWS_SELECTOR = 'tablePagination-10-rows'; | ||
const TWENTY_FIVE_ROWS_SELECTOR = 'tablePagination-25-rows'; | ||
const FIFTY_ROWS_SELECTOR = 'tablePagination-50-rows'; | ||
const BUTTON_ONE_SELECTOR = 'pagination-button-0'; | ||
const BUTTON_TWO_SELECTOR = 'pagination-button-1'; | ||
|
||
export function ObservabilityAlertsPaginationProvider({ getService }: FtrProviderContext) { | ||
const testSubjects = getService('testSubjects'); | ||
|
||
const getPageSizeSelector = async () => { | ||
return await testSubjects.find(ROWS_PER_PAGE_SELECTOR); | ||
}; | ||
|
||
const getPageSizeSelectorOrFail = async () => { | ||
return await testSubjects.existOrFail(ROWS_PER_PAGE_SELECTOR); | ||
}; | ||
|
||
const missingPageSizeSelectorOrFail = async () => { | ||
return await testSubjects.missingOrFail(ROWS_PER_PAGE_SELECTOR); | ||
}; | ||
|
||
const getTenRowsPageSelector = async () => { | ||
return await testSubjects.find(TEN_ROWS_SELECTOR); | ||
}; | ||
|
||
const getTwentyFiveRowsPageSelector = async () => { | ||
return await testSubjects.find(TWENTY_FIVE_ROWS_SELECTOR); | ||
}; | ||
|
||
const getFiftyRowsPageSelector = async () => { | ||
return await testSubjects.find(FIFTY_ROWS_SELECTOR); | ||
}; | ||
|
||
const getPrevPageButton = async () => { | ||
return await testSubjects.find(PREV_BUTTON_SELECTOR); | ||
}; | ||
|
||
const getPrevPageButtonOrFail = async () => { | ||
return await testSubjects.existOrFail(PREV_BUTTON_SELECTOR); | ||
}; | ||
|
||
const missingPrevPageButtonOrFail = async () => { | ||
return await testSubjects.missingOrFail(PREV_BUTTON_SELECTOR); | ||
}; | ||
|
||
const getNextPageButton = async () => { | ||
return await testSubjects.find(NEXT_BUTTON_SELECTOR); | ||
}; | ||
|
||
const getNextPageButtonOrFail = async () => { | ||
return await testSubjects.existOrFail(NEXT_BUTTON_SELECTOR); | ||
}; | ||
|
||
const getPaginationButtonOne = async () => { | ||
return await testSubjects.find(BUTTON_ONE_SELECTOR); | ||
}; | ||
|
||
const getPaginationButtonTwo = async () => { | ||
return await testSubjects.find(BUTTON_TWO_SELECTOR); | ||
}; | ||
|
||
const goToNextPage = async () => { | ||
return await (await getNextPageButton()).click(); | ||
}; | ||
|
||
const goToPrevPage = async () => { | ||
return await (await getPrevPageButton()).click(); | ||
}; | ||
|
||
const goToFirstPage = async () => { | ||
await (await getPaginationButtonOne()).click(); | ||
}; | ||
|
||
const getPrevButtonDisabledValue = async () => { | ||
return await (await getPrevPageButton()).getAttribute('disabled'); | ||
}; | ||
|
||
return { | ||
getPageSizeSelector, | ||
getPageSizeSelectorOrFail, | ||
missingPageSizeSelectorOrFail, | ||
getTenRowsPageSelector, | ||
getTwentyFiveRowsPageSelector, | ||
getFiftyRowsPageSelector, | ||
getPrevPageButton, | ||
getPrevPageButtonOrFail, | ||
missingPrevPageButtonOrFail, | ||
getNextPageButton, | ||
getNextPageButtonOrFail, | ||
getPaginationButtonOne, | ||
getPaginationButtonTwo, | ||
goToNextPage, | ||
goToPrevPage, | ||
goToFirstPage, | ||
getPrevButtonDisabledValue, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.