mirror of
https://github.com/bitnami/charts.git
synced 2026-03-16 06:47:30 +08:00
[bitnami/phpmyadmin] Use fixture properly for PHPMyAdmin Helm Chart Tests (#10021)
* Added antiflake pipeline Signed-off-by: alukic <alukic@vmware.com> * Diversified the pipeline Signed-off-by: alukic <alukic@vmware.com> * Make a change to trigger TKG Signed-off-by: alukic <alukic@vmware.com> * Replaced FIPS with normal AKS Signed-off-by: alukic <alukic@vmware.com> * Improvemets to the code Signed-off-by: alukic <alukic@vmware.com> * Remove antiflake pipeline Signed-off-by: alukic <alukic@vmware.com> * Linter, formatting Signed-off-by: alukic <alukic@vmware.com> * Added missing plugins file Signed-off-by: alukic <alukic@vmware.com>
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
{
|
||||
"baseUrl": "http://localhost/",
|
||||
"env": {
|
||||
"username": "root",
|
||||
"password": "rootPassword"
|
||||
},
|
||||
"defaultCommandTimeout":30000
|
||||
}
|
||||
"baseUrl": "http://localhost/",
|
||||
"env": {
|
||||
"username": "root",
|
||||
"password": "rootPassword"
|
||||
},
|
||||
"defaultCommandTimeout": 30000,
|
||||
"pageLoadTimeout": 240000
|
||||
}
|
||||
|
||||
6
.vib/phpmyadmin/cypress/cypress/fixtures/plugins.json
Normal file
6
.vib/phpmyadmin/cypress/cypress/fixtures/plugins.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"installedPlugins": {
|
||||
"SQL": "Native MySQL authentication",
|
||||
"MariaDB": "MariaDB"
|
||||
}
|
||||
}
|
||||
@@ -1,75 +1,75 @@
|
||||
/// <reference types="cypress" />
|
||||
import {
|
||||
random
|
||||
} from './utils'
|
||||
import { random } from './utils';
|
||||
|
||||
it('allows the user to log in and log out', () => {
|
||||
cy.login();
|
||||
cy.contains('[role="alert"]', 'Access denied').should('not.exist'); //checks if login was successful
|
||||
cy.get('a[title="Log out"]').click();
|
||||
cy.get('#login_form').should('be.visible');
|
||||
})
|
||||
cy.login();
|
||||
cy.contains('[role="alert"]', 'Access denied').should('not.exist'); //checks if login was successful
|
||||
cy.get('a[title="Log out"]').click();
|
||||
cy.contains('#login_form', 'Log in');
|
||||
});
|
||||
|
||||
it('allows creating a database and a table', () => {
|
||||
cy.login();
|
||||
cy.visit('index.php?route=/server/databases');
|
||||
cy.fixture('testdata').then((td) => {
|
||||
cy.get('#text_create_db').type(`${td.databaseName}.${random}`);
|
||||
cy.get('#buttonGo').click();
|
||||
cy.get('.lock-page [type="text"]').type(`${td.tableName}.${random}`);
|
||||
cy.get('.lock-page [type="number"]').clear().type(td.columnNumber);
|
||||
cy.contains('[type="submit"]', 'Go').click();
|
||||
cy.get('#field_0_1').type(`${td.columnName}.${random}`);
|
||||
cy.get('.btn-primary').click();
|
||||
cy.visit('index.php');
|
||||
cy.contains('a', `${td.databaseName}.${random}`).scrollIntoView().click({
|
||||
force: true
|
||||
});
|
||||
cy.contains('#pma_navigation_tree_content', `${td.tableName}.${random}`).click({
|
||||
force: true
|
||||
})
|
||||
cy.contains('.table-responsive-md', `${td.columnName}.${random}`).should('be.visible');
|
||||
cy.login();
|
||||
cy.visit('index.php?route=/server/databases');
|
||||
cy.fixture('testdata').then((td) => {
|
||||
cy.get('#text_create_db').type(`${td.databaseName}.${random}`);
|
||||
cy.get('#buttonGo').click();
|
||||
cy.get('.lock-page [type="text"]').type(`${td.tableName}.${random}`);
|
||||
cy.get('.lock-page [type="number"]').clear().type(td.columnNumber);
|
||||
cy.contains('[type="submit"]', 'Go').click();
|
||||
cy.get('#field_0_1').type(`${td.columnName}.${random}`);
|
||||
cy.get('.btn-primary').click();
|
||||
cy.visit('index.php');
|
||||
cy.contains('a', `${td.databaseName}.${random}`).scrollIntoView().click({
|
||||
force: true,
|
||||
});
|
||||
})
|
||||
cy.contains(
|
||||
'#pma_navigation_tree_content',
|
||||
`${td.tableName}.${random}`
|
||||
).click({
|
||||
force: true,
|
||||
});
|
||||
cy.contains('.table-responsive-md', `${td.columnName}.${random}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('allows importing a table and executing a query', () => {
|
||||
cy.login();
|
||||
cy.visit('index.php?route=/database/structure&server=1&db=mysql')
|
||||
cy.contains('Import').click();
|
||||
cy.get('#input_import_file').selectFile('cypress/fixtures/testdata.sql', {
|
||||
force: true
|
||||
});
|
||||
cy.get('#buttonGo').click();
|
||||
cy.contains('No database selected', '[role="alert"]').should('not.exist');
|
||||
cy.contains('Import has been successfully finished');
|
||||
cy.fixture('testdata').then((td) => {
|
||||
cy.contains('[title="Browse"]', td.importedDatabaseName).should('be.visible').click();
|
||||
})
|
||||
cy.contains('#topmenu', 'SQL');
|
||||
cy.visit('/index.php?route=/table/sql&db=mysql&table=authors');
|
||||
cy.get('#button_submit_query').scrollIntoView().click();
|
||||
cy.get('.result_query').contains('Showing rows');
|
||||
})
|
||||
cy.login();
|
||||
cy.visit('index.php?route=/database/structure&server=1&db=mysql');
|
||||
cy.contains('Import').click();
|
||||
cy.get('#input_import_file').selectFile('cypress/fixtures/testdata.sql', {
|
||||
force: true,
|
||||
});
|
||||
cy.get('#buttonGo').click();
|
||||
cy.contains('No database selected', '[role="alert"]').should('not.exist');
|
||||
cy.contains('Import has been successfully finished');
|
||||
cy.fixture('testdata').then((td) => {
|
||||
cy.contains('[title="Browse"]', td.importedDatabaseName).click();
|
||||
});
|
||||
cy.contains('#topmenu', 'SQL');
|
||||
cy.visit('/index.php?route=/table/sql&db=mysql&table=authors');
|
||||
cy.get('#button_submit_query').scrollIntoView().click();
|
||||
cy.contains('Showing rows');
|
||||
});
|
||||
|
||||
it('allows adding a user', () => {
|
||||
cy.login();
|
||||
cy.visit('index.php?route=/server/privileges&viewing_mode=server');
|
||||
cy.get('#add_user_anchor').click();
|
||||
cy.fixture('testdata').then((td) => {
|
||||
cy.get('#pma_username').type(`${td.username}.${random}`);
|
||||
cy.get('#text_pma_pw').type(td.password);
|
||||
cy.get('#text_pma_pw2').type(td.password);
|
||||
cy.get('#adduser_submit').click();
|
||||
})
|
||||
cy.get('.result_query').should('be.visible').contains('You have added a new user.');
|
||||
})
|
||||
cy.login();
|
||||
cy.visit('index.php?route=/server/privileges&viewing_mode=server');
|
||||
cy.get('#add_user_anchor').click();
|
||||
cy.fixture('testdata').then((td) => {
|
||||
cy.get('#pma_username').type(`${td.username}.${random}`);
|
||||
cy.get('#text_pma_pw').type(td.password);
|
||||
cy.get('#text_pma_pw2').type(td.password);
|
||||
cy.get('#adduser_submit').click();
|
||||
});
|
||||
cy.contains('You have added a new user.');
|
||||
});
|
||||
|
||||
it('shows the list of installed plugins', () => {
|
||||
const PLUGIN_1 = "Native MySQL authentication";
|
||||
const PLUGIN_2 = "MariaDB";
|
||||
|
||||
cy.login();
|
||||
cy.visit('index.php?route=/server/plugins');
|
||||
cy.get('#plugins-authentication').contains(PLUGIN_1);
|
||||
cy.get('#plugins-datatype').contains(PLUGIN_2);
|
||||
})
|
||||
cy.login();
|
||||
cy.visit('index.php?route=/server/plugins');
|
||||
cy.fixture('plugins').then((plugin) => {
|
||||
cy.get('#plugins-authentication').contains(plugin.installedPlugins.SQL);
|
||||
cy.get('#plugins-datatype').contains(plugin.installedPlugins.MariaDB);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/// <reference types="cypress" />
|
||||
|
||||
export let random = (Math.random() + 1).toString(36).substring(9);
|
||||
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
const COMMAND_DELAY = 1000;
|
||||
|
||||
for (const command of ['click']) {
|
||||
Cypress.Commands.overwrite(command, (originalFn, ...args) => {
|
||||
const origVal = originalFn(...args);
|
||||
Cypress.Commands.overwrite(command, (originalFn, ...args) => {
|
||||
const origVal = originalFn(...args);
|
||||
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve(origVal);
|
||||
}, COMMAND_DELAY);
|
||||
});
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve(origVal);
|
||||
}, COMMAND_DELAY);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Cypress.Commands.add("login", (
|
||||
username = Cypress.env("username"),
|
||||
password = Cypress.env("password")
|
||||
) => {
|
||||
cy.visit('');
|
||||
cy.get('#input_username').should('be.visible').type(username);
|
||||
cy.get('#input_password').should('be.visible').type(password);
|
||||
Cypress.Commands.add(
|
||||
'login',
|
||||
(username = Cypress.env('username'), password = Cypress.env('password')) => {
|
||||
cy.visit('/');
|
||||
cy.contains('#login_form', 'Log in');
|
||||
cy.get('#input_username').type(username);
|
||||
cy.get('#input_password').type(password);
|
||||
cy.get('#input_go').click();
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// ***********************************************************
|
||||
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands'
|
||||
import './commands';
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
||||
|
||||
Reference in New Issue
Block a user