grafana/e2e/plugin-e2e/mysql/mocks/mysql.mocks.ts
Zoltán Bedi a4fe7f39ea
E2E: Rewrite mysql tests to playwright (#83424)
* E2E: Rewrite mysql tests to playwright

* Fix lint

* Add more selectors and address comments

* Scope locators when locating text

* Don't run it 20 times

* Update new-datasource-variable to assert mysql
2024-03-19 23:07:48 +01:00

73 lines
2.1 KiB
TypeScript

export const normalTableName = 'normalTable';
export const tableNameWithSpecialCharacter = 'table-name';
export const tablesResponse = {
results: {
tables: {
status: 200,
frames: [
{
schema: {
refId: 'tables',
meta: {
executedQueryString:
"SELECT table_name FROM information_schema.tables WHERE table_schema = 'DataMaker' ORDER BY table_name",
},
fields: [{ name: 'TABLE_NAME', type: 'string', typeInfo: { frame: 'string', nullable: true } }],
},
data: { values: [[normalTableName, tableNameWithSpecialCharacter]] },
},
],
},
},
};
export const fieldsResponse = {
results: {
fields: {
status: 200,
frames: [
{
schema: {
refId: 'fields',
meta: {
executedQueryString:
"SELECT column_name, data_type FROM information_schema.columns WHERE table_schema = 'DataMaker' AND table_name = 'RandomIntsWithTimes' ORDER BY column_name",
},
fields: [
{ name: 'COLUMN_NAME', type: 'string', typeInfo: { frame: 'string', nullable: true } },
{ name: 'DATA_TYPE', type: 'string', typeInfo: { frame: 'string', nullable: true } },
],
},
data: {
values: [
['createdAt', 'id', 'time', 'updatedAt', 'bigint'],
['datetime', 'int', 'datetime', 'datetime', 'int'],
],
},
},
],
},
},
};
export const datasetResponse = {
results: {
datasets: {
status: 200,
frames: [
{
schema: {
refId: 'datasets',
meta: {
executedQueryString:
"SELECT DISTINCT TABLE_SCHEMA from information_schema.TABLES where TABLE_TYPE != 'SYSTEM VIEW' ORDER BY TABLE_SCHEMA",
},
fields: [{ name: 'TABLE_SCHEMA', type: 'string', typeInfo: { frame: 'string', nullable: true } }],
},
data: { values: [['DataMaker', 'mysql', 'performance_schema', 'sys']] },
},
],
},
},
};