Prettier: Upgrade to 2 (#30387)
* Updated package json but not updated source files * Update eslint plugin * updated files
This commit is contained in:
@@ -70,9 +70,7 @@ export const addDashboard = (config?: Partial<AddDashboardConfig>) => {
|
||||
setDashboardTimeRange(timeRange);
|
||||
|
||||
e2e.pages.Dashboard.Toolbar.toolbarItems('Save dashboard').click();
|
||||
e2e.pages.SaveDashboardAsModal.newName()
|
||||
.clear()
|
||||
.type(title);
|
||||
e2e.pages.SaveDashboardAsModal.newName().clear().type(title);
|
||||
e2e.pages.SaveDashboardAsModal.save().click();
|
||||
e2e.flows.assertSuccessNotification();
|
||||
|
||||
@@ -105,33 +103,23 @@ const addAnnotation = (config: AddAnnotationConfig, isFirst: boolean) => {
|
||||
e2e.pages.Dashboard.Settings.Annotations.List.addAnnotationCTA().click();
|
||||
} else {
|
||||
// @todo add to e2e-selectors and `aria-label`
|
||||
e2e()
|
||||
.contains('.btn', 'New')
|
||||
.click();
|
||||
e2e().contains('.btn', 'New').click();
|
||||
}
|
||||
|
||||
const { dataSource, dataSourceForm, name } = config;
|
||||
|
||||
// @todo add to e2e-selectors and `aria-label`
|
||||
e2e()
|
||||
.contains('.gf-form', 'Data source')
|
||||
.find('select')
|
||||
.select(dataSource);
|
||||
e2e().contains('.gf-form', 'Data source').find('select').select(dataSource);
|
||||
|
||||
// @todo add to e2e-selectors and `aria-label`
|
||||
e2e()
|
||||
.contains('.gf-form', 'Name')
|
||||
.find('input')
|
||||
.type(name);
|
||||
e2e().contains('.gf-form', 'Name').find('input').type(name);
|
||||
|
||||
if (dataSourceForm) {
|
||||
dataSourceForm();
|
||||
}
|
||||
|
||||
// @todo add to e2e-selectors and `aria-label`
|
||||
e2e()
|
||||
.contains('.btn', 'Add')
|
||||
.click();
|
||||
e2e().contains('.btn', 'Add').click();
|
||||
};
|
||||
|
||||
const addAnnotations = (configs: AddAnnotationConfig[]) => {
|
||||
@@ -204,9 +192,7 @@ const addVariable = (config: PartialAddVariableConfig, isFirst: boolean): AddVar
|
||||
}
|
||||
|
||||
// Avoid flakiness
|
||||
e2e()
|
||||
.focused()
|
||||
.blur();
|
||||
e2e().focused().blur();
|
||||
e2e()
|
||||
.contains('.gf-form-group', 'Preview of values')
|
||||
.within(() => {
|
||||
|
||||
@@ -53,41 +53,29 @@ export const addDataSource = (config?: Partial<AddDataSourceConfig>) => {
|
||||
e2e.pages.DataSource.name().type(name);
|
||||
|
||||
if (basicAuth) {
|
||||
e2e()
|
||||
.contains('label', 'Basic auth')
|
||||
.scrollIntoView()
|
||||
.click();
|
||||
e2e().contains('label', 'Basic auth').scrollIntoView().click();
|
||||
e2e()
|
||||
.contains('.gf-form-group', 'Basic Auth Details')
|
||||
.should('be.visible')
|
||||
.scrollIntoView()
|
||||
.within(() => {
|
||||
if (basicAuthUser) {
|
||||
e2e()
|
||||
.get('[placeholder=user]')
|
||||
.type(basicAuthUser);
|
||||
e2e().get('[placeholder=user]').type(basicAuthUser);
|
||||
}
|
||||
if (basicAuthPassword) {
|
||||
e2e()
|
||||
.get('[placeholder=Password]')
|
||||
.type(basicAuthPassword);
|
||||
e2e().get('[placeholder=Password]').type(basicAuthPassword);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (skipTlsVerify) {
|
||||
e2e()
|
||||
.contains('label', 'Skip TLS Verify')
|
||||
.scrollIntoView()
|
||||
.click();
|
||||
e2e().contains('label', 'Skip TLS Verify').scrollIntoView().click();
|
||||
}
|
||||
|
||||
form();
|
||||
|
||||
e2e.pages.DataSource.saveAndTest().click();
|
||||
e2e.pages.DataSource.alert()
|
||||
.should('exist')
|
||||
.contains(expectedAlertMessage); // assertion
|
||||
e2e.pages.DataSource.alert().should('exist').contains(expectedAlertMessage); // assertion
|
||||
|
||||
e2e().logToConsole('Added data source with name:', name);
|
||||
|
||||
@@ -105,11 +93,7 @@ export const addDataSource = (config?: Partial<AddDataSourceConfig>) => {
|
||||
if (checkHealth) {
|
||||
const healthUrl = fromBaseUrl(`/api/datasources/${id}/health`);
|
||||
e2e().logToConsole(`Fetching ${healthUrl}`);
|
||||
e2e()
|
||||
.request(healthUrl)
|
||||
.its('body')
|
||||
.should('have.property', 'status')
|
||||
.and('eq', 'OK');
|
||||
e2e().request(healthUrl).its('body').should('have.property', 'status').and('eq', 'OK');
|
||||
}
|
||||
|
||||
// @todo remove `wrap` when possible
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { e2e } from '../index';
|
||||
|
||||
export const assertSuccessNotification = () => {
|
||||
e2e()
|
||||
.get('[aria-label^="Alert success"]')
|
||||
.should('exist');
|
||||
e2e().get('[aria-label^="Alert success"]').should('exist');
|
||||
};
|
||||
|
||||
@@ -116,9 +116,7 @@ export const configurePanel = (config: PartialAddPanelConfig | PartialEditPanelC
|
||||
|
||||
// @todo alias '/**/*.js*' as '@pluginModule' when possible: https://github.com/cypress-io/cypress/issues/1296
|
||||
|
||||
e2e()
|
||||
.route(chartData.method, chartData.route)
|
||||
.as('chartData');
|
||||
e2e().route(chartData.method, chartData.route).as('chartData');
|
||||
|
||||
if (dataSourceName) {
|
||||
selectOption({
|
||||
@@ -153,9 +151,7 @@ export const configurePanel = (config: PartialAddPanelConfig | PartialEditPanelC
|
||||
|
||||
if (visualizationName) {
|
||||
openOptionsGroup('type');
|
||||
e2e.components.PluginVisualization.item(visualizationName)
|
||||
.scrollIntoView()
|
||||
.click();
|
||||
e2e.components.PluginVisualization.item(visualizationName).scrollIntoView().click();
|
||||
|
||||
// @todo wait for '@pluginModule' if not a core visualization and not already loaded
|
||||
e2e().wait(2000);
|
||||
@@ -188,19 +184,12 @@ export const configurePanel = (config: PartialAddPanelConfig | PartialEditPanelC
|
||||
//e2e().wait('@chartData');
|
||||
|
||||
if (!isExplore) {
|
||||
e2e()
|
||||
.get('button[title="Apply changes and go back to dashboard"]')
|
||||
.click();
|
||||
e2e()
|
||||
.url()
|
||||
.should('include', `/d/${dashboardUid}`);
|
||||
e2e().get('button[title="Apply changes and go back to dashboard"]').click();
|
||||
e2e().url().should('include', `/d/${dashboardUid}`);
|
||||
}
|
||||
|
||||
// Avoid annotations flakiness
|
||||
e2e()
|
||||
.get('.refresh-picker-buttons .btn')
|
||||
.first()
|
||||
.click();
|
||||
e2e().get('.refresh-picker-buttons .btn').first().click();
|
||||
|
||||
e2e().wait('@chartData');
|
||||
|
||||
@@ -244,17 +233,13 @@ const closeRequestErrors = () => {
|
||||
e2e().wait(1000); // emulate `cy.get()` for nested errors
|
||||
e2e()
|
||||
.get('app-notifications-list')
|
||||
.then($elm => {
|
||||
.then(($elm) => {
|
||||
// Avoid failing when none are found
|
||||
const selector = '[aria-label="Alert error"]:contains("Failed to call resource")';
|
||||
const numErrors = $elm.find(selector).length;
|
||||
|
||||
for (let i = 0; i < numErrors; i++) {
|
||||
e2e()
|
||||
.get(selector)
|
||||
.first()
|
||||
.find('button')
|
||||
.click();
|
||||
e2e().get(selector).first().find('button').click();
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -296,10 +281,7 @@ const openOptionsGroup = (name: string): any =>
|
||||
}
|
||||
});
|
||||
|
||||
const toggleOptionsGroup = (name: string) =>
|
||||
getOptionsGroup(name)
|
||||
.find('.editor-options-group-toggle')
|
||||
.click();
|
||||
const toggleOptionsGroup = (name: string) => getOptionsGroup(name).find('.editor-options-group-toggle').click();
|
||||
|
||||
export const VISUALIZATION_ALERT_LIST = 'Alert list';
|
||||
export const VISUALIZATION_BAR_GAUGE = 'Bar gauge';
|
||||
|
||||
@@ -43,9 +43,5 @@ const uiDelete = (uid: string, title: string) => {
|
||||
// @todo replace `e2e.pages.Dashboards.dashboards` with this when argument is empty
|
||||
e2e()
|
||||
.get('[aria-label^="Dashboard search item "]')
|
||||
.each(item =>
|
||||
e2e()
|
||||
.wrap(item)
|
||||
.should('not.contain', title)
|
||||
);
|
||||
.each((item) => e2e().wrap(item).should('not.contain', title));
|
||||
};
|
||||
|
||||
@@ -42,9 +42,5 @@ const uiDelete = (name: string) => {
|
||||
// @todo replace `e2e.pages.DataSources.dataSources` with this when argument is empty
|
||||
e2e()
|
||||
.get('[aria-label^="Data source list item "]')
|
||||
.each(item =>
|
||||
e2e()
|
||||
.wrap(item)
|
||||
.should('not.contain', name)
|
||||
);
|
||||
.each((item) => e2e().wrap(item).should('not.contain', name));
|
||||
};
|
||||
|
||||
@@ -14,13 +14,9 @@ export const login = (username = DEFAULT_USERNAME, password = DEFAULT_PASSWORD)
|
||||
|
||||
// Local tests will have insecure credentials
|
||||
if (password === DEFAULT_PASSWORD) {
|
||||
e2e.pages.Login.skip()
|
||||
.should('be.visible')
|
||||
.click();
|
||||
e2e.pages.Login.skip().should('be.visible').click();
|
||||
}
|
||||
|
||||
e2e()
|
||||
.get('.login-page')
|
||||
.should('not.exist');
|
||||
e2e().get('.login-page').should('not.exist');
|
||||
e2e().logToConsole('Logged in with username:', username);
|
||||
};
|
||||
|
||||
@@ -6,11 +6,7 @@ export enum PanelMenuItems {
|
||||
}
|
||||
|
||||
export const openPanelMenuItem = (menu: PanelMenuItems, panelTitle = 'Panel Title') => {
|
||||
e2e.components.Panels.Panel.title(panelTitle)
|
||||
.should('be.visible')
|
||||
.click();
|
||||
e2e.components.Panels.Panel.title(panelTitle).should('be.visible').click();
|
||||
|
||||
e2e.components.Panels.Panel.headerItems(menu)
|
||||
.should('be.visible')
|
||||
.click();
|
||||
e2e.components.Panels.Panel.headerItems(menu).should('be.visible').click();
|
||||
};
|
||||
|
||||
@@ -19,9 +19,7 @@ export const selectOption = (config: SelectOptionConfig): any => {
|
||||
|
||||
return container.within(() => {
|
||||
if (clickToOpen) {
|
||||
e2e()
|
||||
.get('[class$="-input-suffix"]')
|
||||
.click();
|
||||
e2e().get('[class$="-input-suffix"]').click();
|
||||
}
|
||||
|
||||
e2e.components.Select.option()
|
||||
@@ -36,8 +34,6 @@ export const selectOption = (config: SelectOptionConfig): any => {
|
||||
})
|
||||
.scrollIntoView()
|
||||
.click({ force: forceClickOption });
|
||||
e2e()
|
||||
.root()
|
||||
.scrollIntoView();
|
||||
e2e().root().scrollIntoView();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -8,14 +8,10 @@ export interface TimeRangeConfig {
|
||||
}
|
||||
|
||||
export const setTimeRange = ({ from, to, zone }: TimeRangeConfig) => {
|
||||
e2e()
|
||||
.get('[aria-label="TimePicker Open Button"]')
|
||||
.click();
|
||||
e2e().get('[aria-label="TimePicker Open Button"]').click();
|
||||
|
||||
if (zone) {
|
||||
e2e()
|
||||
.contains('button', 'Change time zone')
|
||||
.click();
|
||||
e2e().contains('button', 'Change time zone').click();
|
||||
|
||||
selectOption({
|
||||
clickToOpen: false,
|
||||
@@ -25,19 +21,9 @@ export const setTimeRange = ({ from, to, zone }: TimeRangeConfig) => {
|
||||
}
|
||||
|
||||
// For smaller screens
|
||||
e2e()
|
||||
.get('[aria-label="TimePicker absolute time range"]')
|
||||
.click();
|
||||
e2e().get('[aria-label="TimePicker absolute time range"]').click();
|
||||
|
||||
e2e()
|
||||
.get('[aria-label="TimePicker from field"]')
|
||||
.clear()
|
||||
.type(from);
|
||||
e2e()
|
||||
.get('[aria-label="TimePicker to field"]')
|
||||
.clear()
|
||||
.type(to);
|
||||
e2e()
|
||||
.get('[aria-label="TimePicker submit button"]')
|
||||
.click();
|
||||
e2e().get('[aria-label="TimePicker from field"]').clear().type(from);
|
||||
e2e().get('[aria-label="TimePicker to field"]').clear().type(to);
|
||||
e2e().get('[aria-label="TimePicker submit button"]').click();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user