Dashboards: relabel add query button (#73607)

This commit is contained in:
Giordano Ricci 2023-08-22 14:47:45 +01:00 committed by GitHub
parent 35818fa9ab
commit 53867e3fcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 9 deletions

View File

@ -2859,8 +2859,7 @@ exports[`better eslint`] = {
], ],
"public/app/features/query/components/QueryGroup.tsx:5381": [ "public/app/features/query/components/QueryGroup.tsx:5381": [
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"], [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"],
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "1"], [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "1"]
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "2"]
], ],
"public/app/features/query/state/DashboardQueryRunner/AlertStatesWorker.test.ts:5381": [ "public/app/features/query/state/DashboardQueryRunner/AlertStatesWorker.test.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "0"],

View File

@ -184,7 +184,7 @@ export const Components = {
content: 'Query editor tab content', content: 'Query editor tab content',
queryInspectorButton: 'Query inspector button', queryInspectorButton: 'Query inspector button',
queryHistoryButton: 'data-testid query-history-button', queryHistoryButton: 'data-testid query-history-button',
addQuery: 'Query editor add query button', addQuery: 'data-testid query-tab-add-query',
}, },
QueryHistory: { QueryHistory: {
queryText: 'Query text', queryText: 'Query text',

View File

@ -61,7 +61,7 @@ describe('QueryGroup', () => {
it('Should add query on click', async () => { it('Should add query on click', async () => {
renderScenario({}); renderScenario({});
const addQueryButton = await screen.findByTestId('query-tab-add-query'); const addQueryButton = await screen.findByRole('button', { name: /Add query/i });
const queryRowsContainer = await screen.findByTestId('query-editor-rows'); const queryRowsContainer = await screen.findByTestId('query-editor-rows');
expect(queryRowsContainer.children.length).toBe(2); expect(queryRowsContainer.children.length).toBe(2);
@ -92,7 +92,7 @@ describe('QueryGroup', () => {
it('New query should be expanded', async () => { it('New query should be expanded', async () => {
renderScenario({}); renderScenario({});
const addQueryButton = await screen.findByTestId('query-tab-add-query'); const addQueryButton = await screen.findByRole('button', { name: /Add query/i });
const queryRowsContainer = await screen.findByTestId('query-editor-rows'); const queryRowsContainer = await screen.findByTestId('query-editor-rows');
await userEvent.click(addQueryButton); await userEvent.click(addQueryButton);
@ -119,7 +119,7 @@ describe('QueryGroup', () => {
it('Should not show add expression button when expressions are disabled', async () => { it('Should not show add expression button when expressions are disabled', async () => {
config.expressionsEnabled = false; config.expressionsEnabled = false;
renderScenario({}); renderScenario({});
await screen.findByTestId('query-tab-add-query'); await screen.findByRole('button', { name: /Add query/i });
const addExpressionButton = screen.queryByTestId('query-tab-add-expression'); const addExpressionButton = screen.queryByTestId('query-tab-add-expression');
expect(addExpressionButton).not.toBeInTheDocument(); expect(addExpressionButton).not.toBeInTheDocument();
}); });

View File

@ -371,10 +371,9 @@ export class QueryGroup extends PureComponent<Props, State> {
icon="plus" icon="plus"
onClick={this.onAddQueryClick} onClick={this.onAddQueryClick}
variant="secondary" variant="secondary"
aria-label={selectors.components.QueryTab.addQuery} data-testid={selectors.components.QueryTab.addQuery}
data-testid="query-tab-add-query"
> >
Query Add query
</Button> </Button>
)} )}
{config.expressionsEnabled && this.isExpressionsSupported(dsSettings) && ( {config.expressionsEnabled && this.isExpressionsSupported(dsSettings) && (