mirror of
https://github.com/bitnami/charts.git
synced 2026-08-10 14:15:55 +08:00
[bitnami/*] Remove extra asserts for Helm Chart tests (#9641)
* Remove extra assertions for Airflow Signed-off-by: alukic <alukic@vmware.com> * Remove extra assertions for Grafana Signed-off-by: alukic <alukic@vmware.com> * Removed extra assertions for Kibana Signed-off-by: alukic <alukic@vmware.com> * Removed extra assertions for MiniO Signed-off-by: alukic <alukic@vmware.com> * Removed redundant asserts for MiniO commands Signed-off-by: alukic <alukic@vmware.com> * Removed extra assertions for Wordpress Signed-off-by: alukic <alukic@vmware.com> * Formatting using Prettier, changes in MiniO and PHPMyAdmin tests Signed-off-by: alukic <alukic@vmware.com> * Reverted name change Signed-off-by: alukic <alukic@vmware.com> * Increased page load times for Grafana, PhpMyAdmin Signed-off-by: alukic <alukic@vmware.com> * Last tweak to Airflow Signed-off-by: alukic <alukic@vmware.com> * Changed one remaining extra assertion for Grafana logout test Signed-off-by: alukic <alukic@vmware.com> * Removed old comment Signed-off-by: alukic <alukic@vmware.com> * Removed a mistakenly add commit Signed-off-by: alukic <alukic@vmware.com> * Added a comment to clarify some asserts Signed-off-by: alukic <alukic@vmware.com> * Removed extra assertion Signed-off-by: alukic <alukic@vmware.com> * Removed assertion Signed-off-by: alukic <alukic@vmware.com> * Remove additional shoulds as per PR Signed-off-by: alukic <alukic@vmware.com>
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
{
|
||||
"baseUrl": "http://localhost",
|
||||
"defaultCommandTimeout": 6000,
|
||||
"pageLoadTimeout": 240000,
|
||||
"defaultCommandTimeout":80000,
|
||||
|
||||
"env": {
|
||||
"username": "user",
|
||||
"password": "ComplicatedPassword123!4"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,67 +1,61 @@
|
||||
/// <reference types="cypress" />
|
||||
import { random } from "./utils";
|
||||
import { random } from './utils';
|
||||
|
||||
it("allows triggering execution of a sample DAG", () => {
|
||||
it('allows triggering execution of a sample DAG', () => {
|
||||
cy.login();
|
||||
cy.fixture("DAGs").then((dags) => {
|
||||
cy.fixture('DAGs').then((dags) => {
|
||||
const TRIGGERED_OK_MESSAGE = `Triggered ${dags.triggered.id}, it should start`;
|
||||
|
||||
cy.get("#dag_query").clear().type(`${dags.triggered.id}{enter}`);
|
||||
cy.get(`a[href="/tree?dag_id=${dags.triggered.id}"]`)
|
||||
.should("be.visible")
|
||||
.click();
|
||||
cy.get('#dag_query').clear().type(`${dags.triggered.id}{enter}`);
|
||||
cy.get(`a[href="/tree?dag_id=${dags.triggered.id}"]`).click();
|
||||
cy.get('a[aria-label="Trigger DAG"]').click();
|
||||
cy.contains("button", "Trigger DAG").click(); // A dropdown appears and clicking again is needed
|
||||
cy.get(".alert-message").should("contain.text", TRIGGERED_OK_MESSAGE);
|
||||
cy.contains('button', 'Trigger DAG').click(); // A dropdown appears and clicking again is needed
|
||||
cy.get('.alert-message').should('contain.text', TRIGGERED_OK_MESSAGE);
|
||||
});
|
||||
|
||||
// Verify the DAG appears in the list of active jobs
|
||||
cy.visit("home?status=active");
|
||||
cy.get('span[class="switch"]').should("have.length", 1);
|
||||
cy.visit('home?status=active');
|
||||
cy.get('span[class="switch"]').should('have.length', 1);
|
||||
});
|
||||
|
||||
it("checks configuration is not exposed", () => {
|
||||
it('checks configuration is not exposed', () => {
|
||||
const SEC_NOTICE =
|
||||
"Your Airflow administrator chose not to expose the configuration, most likely for security reasons";
|
||||
'Your Airflow administrator chose not to expose the configuration, most likely for security reasons';
|
||||
|
||||
cy.login();
|
||||
cy.visit("configuration");
|
||||
cy.contains(SEC_NOTICE).should("be.visible");
|
||||
cy.visit('configuration');
|
||||
cy.contains(SEC_NOTICE);
|
||||
});
|
||||
|
||||
it("allows to create a user", () => {
|
||||
it('allows to create a user', () => {
|
||||
cy.login();
|
||||
cy.visit("users/add");
|
||||
cy.fixture("users").then((users) => {
|
||||
cy.get("input#first_name").type(users.newUser.firstName);
|
||||
cy.get("input#last_name").type(users.newUser.lastName);
|
||||
cy.get("input#username").type(`${users.newUser.username}.${random}`);
|
||||
cy.get("input#email").type(`${users.newUser.username}.${random}@email.com`);
|
||||
cy.get("#s2id_autogen1").type(`${users.newUser.role}{enter}`);
|
||||
cy.get("input#password").type(users.newUser.password);
|
||||
cy.get("input#conf_password").type(users.newUser.password);
|
||||
cy.contains("Save").click();
|
||||
cy.visit('users/add');
|
||||
cy.fixture('users').then((users) => {
|
||||
cy.get('input#first_name').type(users.newUser.firstName);
|
||||
cy.get('input#last_name').type(users.newUser.lastName);
|
||||
cy.get('input#username').type(`${users.newUser.username}.${random}`);
|
||||
cy.get('input#email').type(`${users.newUser.username}.${random}@email.com`);
|
||||
cy.get('#s2id_autogen1').type(`${users.newUser.role}{enter}`);
|
||||
cy.get('input#password').type(users.newUser.password);
|
||||
cy.get('input#conf_password').type(users.newUser.password);
|
||||
cy.contains('Save').click();
|
||||
// Verify the user was created successfully
|
||||
cy.get(".alert-success").should("contain.text", "Added Row");
|
||||
cy.get('.alert-success').should('contain.text', 'Added Row');
|
||||
});
|
||||
});
|
||||
|
||||
it("checks job list contains Scheduler and it is running", () => {
|
||||
it('checks job list contains Scheduler and it is running', () => {
|
||||
cy.login();
|
||||
cy.visit("job/list/");
|
||||
cy.get("tr").contains("SchedulerJob").parent().contains("running");
|
||||
cy.visit('job/list/');
|
||||
cy.get('tr').contains('SchedulerJob').parent().contains('running');
|
||||
});
|
||||
|
||||
it("allows importing variables", () => {
|
||||
it('allows importing variables', () => {
|
||||
cy.login();
|
||||
cy.visit("variable/list/");
|
||||
cy.get('form[action*="varimport"]')
|
||||
.should("be.visible")
|
||||
.within(($form) => {
|
||||
cy.get('input[type="file"]').selectFile(
|
||||
"cypress/fixtures/variables.json"
|
||||
);
|
||||
cy.get('button[type="submit"]').click();
|
||||
});
|
||||
cy.contains("div", "variable", "successfully updated").should("be.visible");
|
||||
cy.visit('variable/list/');
|
||||
cy.get('form[action*="varimport"]').within(($form) => {
|
||||
cy.get('input[type="file"]').selectFile('cypress/fixtures/variables.json');
|
||||
cy.get('button[type="submit"]').click();
|
||||
});
|
||||
cy.contains('div', 'variable', 'successfully updated');
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const COMMAND_DELAY = 500;
|
||||
const COMMAND_DELAY = 800;
|
||||
|
||||
for (const command of ["click"]) {
|
||||
for (const command of ['click']) {
|
||||
Cypress.Commands.overwrite(command, (originalFn, ...args) => {
|
||||
const origVal = originalFn(...args);
|
||||
|
||||
@@ -13,13 +13,13 @@ for (const command of ["click"]) {
|
||||
}
|
||||
|
||||
Cypress.Commands.add(
|
||||
"login",
|
||||
(username = Cypress.env("username"), password = Cypress.env("password")) => {
|
||||
'login',
|
||||
(username = Cypress.env('username'), password = Cypress.env('password')) => {
|
||||
cy.clearCookies();
|
||||
cy.visit("/login");
|
||||
cy.get('form[name="login"]').should("exist");
|
||||
cy.get("input#username").type(username);
|
||||
cy.get("input#password").type(password);
|
||||
cy.visit('/login');
|
||||
cy.get('form[name="login"]').should('exist').and('be.visible'); //This should is needed to ensure stability of the test
|
||||
cy.get('input#username').type(username);
|
||||
cy.get('input#password').type(password);
|
||||
cy.get('input[type="submit"]').click();
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
{
|
||||
"baseUrl": "http://localhost/",
|
||||
"pageLoadTimeout": 120000,
|
||||
"defaultCommandTimeout":40000,
|
||||
"env": {
|
||||
"username": "test_admin",
|
||||
"password": "ComplicatedPassword123!4"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
/// <reference types="cypress" />
|
||||
import {
|
||||
random,
|
||||
verifySuccesOfAction
|
||||
} from './utils'
|
||||
import { random, verifySuccesOfAction } from './utils';
|
||||
|
||||
it('allows user to log in and log out', () => {
|
||||
cy.login();
|
||||
cy.contains('div', 'Invalid username').should('not.exist');
|
||||
cy.visit('/logout');
|
||||
cy.get('.login-content-box').should('be.visible');
|
||||
})
|
||||
cy.contains('.login-content-box', 'Welcome to Grafana');
|
||||
});
|
||||
|
||||
it('allows creating a dashboard with a panel', () => {
|
||||
const PANEL_TITLE = 'Test panel title';
|
||||
@@ -18,39 +15,39 @@ it('allows creating a dashboard with a panel', () => {
|
||||
|
||||
cy.login();
|
||||
cy.visit('dashboard/new');
|
||||
cy.contains('button', 'Add a new panel')
|
||||
.should('be.visible').click();
|
||||
cy.contains('button', 'Add a new panel').click();
|
||||
cy.get('[value*="Panel Title"]').clear().type(`${PANEL_TITLE}.${random}`);
|
||||
cy.get('textarea#description-text-area')
|
||||
.should('exist').type(`${PANEL_DESCRIPTION}.${random}`);
|
||||
cy.get('textarea#description-text-area').type(
|
||||
`${PANEL_DESCRIPTION}.${random}`
|
||||
);
|
||||
|
||||
cy.contains('button','Apply')
|
||||
.should('be.visible').click();
|
||||
cy.contains('button', 'Apply').click();
|
||||
|
||||
cy.contains('.panel-title', PANEL_TITLE).should('be.visible');
|
||||
cy.contains('.panel-title', PANEL_TITLE);
|
||||
cy.get('[aria-label*="Save dashboard"]').click();
|
||||
cy.get('button[aria-label*="Close dialogue"]')
|
||||
.should('be.visible');
|
||||
cy.get('button[aria-label*="Close dialogue"]');
|
||||
cy.get('[name*="title"]').clear().type(`${DASHBOARD_TITLE}.${random}`);
|
||||
cy.get('[type*="submit"]')
|
||||
.should('be.visible').click();
|
||||
cy.get('[type*="submit"]').click();
|
||||
verifySuccesOfAction();
|
||||
})
|
||||
});
|
||||
|
||||
it('checks if it is possible to upload a dashboard as JSON file', () => {
|
||||
const DASHBOARD_TITLE = 'New Test dashboard';
|
||||
|
||||
cy.login();
|
||||
cy.visit('dashboard/import');
|
||||
cy.contains('label','Upload JSON').click();
|
||||
cy.get('input[type=file]').selectFile('cypress/fixtures/test-dashboard.json',
|
||||
{force:true});
|
||||
cy.get('[data-testid*="data-testid-import-dashboard-title"]').clear().type(`${DASHBOARD_TITLE}.${random}`);
|
||||
cy.contains('label', 'Upload JSON').click();
|
||||
cy.get('input[type=file]').selectFile(
|
||||
'cypress/fixtures/test-dashboard.json',
|
||||
{ force: true }
|
||||
);
|
||||
cy.get('[data-testid*="data-testid-import-dashboard-title"]')
|
||||
.clear()
|
||||
.type(`${DASHBOARD_TITLE}.${random}`);
|
||||
cy.get('[data-testid*="data-testid-import-dashboard-submit"]').click();
|
||||
cy.visit("dashboards");
|
||||
cy.contains('div', DASHBOARD_TITLE)
|
||||
.should('exist').click();
|
||||
})
|
||||
cy.visit('dashboards');
|
||||
cy.contains('div', DASHBOARD_TITLE);
|
||||
});
|
||||
|
||||
it('allows inviting a user', () => {
|
||||
const TEST_EMAIL_ADDRESS = 'test@email.com';
|
||||
@@ -58,12 +55,14 @@ it('allows inviting a user', () => {
|
||||
|
||||
cy.login();
|
||||
cy.visit('/org/users/invite');
|
||||
cy.get('[name*="loginOrEmail"]').clear().type(`${TEST_EMAIL_ADDRESS}.${random}`);
|
||||
cy.get('[name*="loginOrEmail"]')
|
||||
.clear()
|
||||
.type(`${TEST_EMAIL_ADDRESS}.${random}`);
|
||||
cy.get('[name*="name"]').clear().type(`${INVITE_USER_NAME}.${random}`);
|
||||
cy.get('[name*="sendEmail"]').click({force: true});
|
||||
cy.get('[name*="sendEmail"]').click({ force: true });
|
||||
cy.get('[type*="submit"]').click();
|
||||
verifySuccesOfAction();
|
||||
})
|
||||
});
|
||||
|
||||
it('checks if smtp is configured', () => {
|
||||
const SMTP_ADDRESS = 'test@smtp.com';
|
||||
@@ -72,84 +71,83 @@ it('checks if smtp is configured', () => {
|
||||
|
||||
cy.login();
|
||||
cy.visit('admin/settings');
|
||||
cy.contains('td', SMTP_ADDRESS)
|
||||
.should('exist');
|
||||
cy.contains('td', SMTP_NAME)
|
||||
.should('exist');
|
||||
cy.contains('td', SMTP_USER)
|
||||
.should('exist');
|
||||
})
|
||||
cy.contains('td', SMTP_ADDRESS);
|
||||
cy.contains('td', SMTP_NAME);
|
||||
cy.contains('td', SMTP_USER);
|
||||
});
|
||||
|
||||
it('checks if plugin page is showing plugins', () => {
|
||||
cy.login();
|
||||
cy.visit('/plugins?filterByType=datasource');
|
||||
cy.get('[data-testid*="plugin-list"]')
|
||||
.should('exist');
|
||||
})
|
||||
cy.get('[data-testid*="plugin-list"]');
|
||||
});
|
||||
|
||||
it('checks if it is possible to create and delete a data source', () => {
|
||||
const DATASOURCE = 'Prometheus';
|
||||
|
||||
cy.login();
|
||||
cy.visit('/datasources/new');
|
||||
cy.get('input[placeholder*="Filter by name or type"]')
|
||||
.type(DATASOURCE);
|
||||
cy.get('input[placeholder*="Filter by name or type"]').type(DATASOURCE);
|
||||
cy.get(`button[aria-label*="Add data source ${DATASOURCE}"]`).click();
|
||||
cy.contains('div', 'Datasource added')
|
||||
.should('be.visible');
|
||||
cy.visit("/datasources");
|
||||
cy.contains('a', DATASOURCE).click({force:true});
|
||||
cy.contains('button', 'Delete').click();
|
||||
cy.contains('div', 'Are you sure you want to delete')
|
||||
.should('be.visible');
|
||||
cy.get('button[aria-label*="Confirm Modal Danger Button"]').should('be.visible').click();
|
||||
verifySuccesOfAction();
|
||||
})
|
||||
cy.contains('div', 'Datasource added');
|
||||
cy.visit('/datasources');
|
||||
cy.contains('a', DATASOURCE).click({ force: true });
|
||||
cy.contains('button', 'Delete').click();
|
||||
cy.contains('div', 'Are you sure you want to delete');
|
||||
cy.get('button[aria-label*="Confirm Modal Danger Button"]').click();
|
||||
verifySuccesOfAction();
|
||||
});
|
||||
|
||||
it('checks if an API key can be added and deleted', () => {
|
||||
const API_KEY_NAME = 'test_api_key';
|
||||
|
||||
cy.login();
|
||||
cy.visit('org/apikeys');
|
||||
cy.get('[data-testid*="data-testid Call to action button New API key"]').click();
|
||||
cy.get('input[placeholder*="Name"]')
|
||||
.should('be.visible').type(`${API_KEY_NAME}.${random}`)
|
||||
cy.contains('button', 'Add').click({force:true});
|
||||
cy.contains('h2', 'API Key Created')
|
||||
.should('be.visible');
|
||||
cy.get(
|
||||
'[data-testid*="data-testid Call to action button New API key"]'
|
||||
).click();
|
||||
cy.get('input[placeholder*="Name"]').type(`${API_KEY_NAME}.${random}`);
|
||||
cy.contains('button', 'Add').click({ force: true });
|
||||
cy.contains('h2', 'API Key Created');
|
||||
cy.get('button[aria-label*="Close dialogue"]').click();
|
||||
cy.get('button[aria-label*="Delete API key"]').click();
|
||||
cy.contains('span', 'Delete').click();
|
||||
})
|
||||
});
|
||||
|
||||
it('checks admin settings endpoint',() => {
|
||||
it('checks admin settings endpoint', () => {
|
||||
cy.request({
|
||||
method: 'GET',
|
||||
url: '/api/admin/settings',
|
||||
form: true,
|
||||
auth: {
|
||||
username: Cypress.env("username"),
|
||||
password: Cypress.env("password")
|
||||
}
|
||||
username: Cypress.env('username'),
|
||||
password: Cypress.env('password'),
|
||||
},
|
||||
}).as('adminSettings');
|
||||
cy.get('@adminSettings').should((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
expect(response.body).to.include.all.keys('DEFAULT','alerting', 'analytics','security','smtp');
|
||||
})
|
||||
})
|
||||
expect(response.body).to.include.all.keys(
|
||||
'DEFAULT',
|
||||
'alerting',
|
||||
'analytics',
|
||||
'security',
|
||||
'smtp'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('checks the usage preview endpoint',() => {
|
||||
cy.request({
|
||||
it('checks the usage preview endpoint', () => {
|
||||
cy.request({
|
||||
method: 'GET',
|
||||
url: 'api/admin/usage-report-preview',
|
||||
form: true,
|
||||
auth: {
|
||||
username: Cypress.env("username"),
|
||||
password: Cypress.env("password")
|
||||
}
|
||||
username: Cypress.env('username'),
|
||||
password: Cypress.env('password'),
|
||||
},
|
||||
}).as('usagePreview');
|
||||
cy.get('@usagePreview').should((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
expect(response.body).to.include.all.keys('metrics','version');
|
||||
})
|
||||
})
|
||||
expect(response.body).to.include.all.keys('metrics', 'version');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,24 +1,34 @@
|
||||
const COMMAND_DELAY = 500;
|
||||
const CLICK_DELAY = 1300;
|
||||
|
||||
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);
|
||||
}, CLICK_DELAY);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Cypress.Commands.add("login", (
|
||||
username = Cypress.env("username"),
|
||||
password = Cypress.env("password")
|
||||
) => {
|
||||
Cypress.Commands.add(
|
||||
'login',
|
||||
(username = Cypress.env('username'), password = Cypress.env('password')) => {
|
||||
cy.clearCookies();
|
||||
cy.visit('/login')
|
||||
cy.get('input[aria-label="Username input field"]').should('be.visible').type(username);
|
||||
cy.get('input#current-password').should('be.visible').type(password);
|
||||
cy.visit('/login');
|
||||
cy.get('input[aria-label="Username input field"]').type(username);
|
||||
cy.get('input#current-password').type(password);
|
||||
cy.get('[aria-label*="Login button"]').click();
|
||||
}
|
||||
);
|
||||
|
||||
Cypress.on('uncaught:exception', (err, runnable) => {
|
||||
// we expect a 3rd party library error with message 'list not defined'
|
||||
// and don't want to fail the test so we return false
|
||||
if (err.message.includes('unhandled promise rejection')) {
|
||||
return false;
|
||||
}
|
||||
// we still want to ensure there are no other unexpected
|
||||
// errors, so we let them fail the test
|
||||
});
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
"target_platform": {
|
||||
"target_platform_id": "{TARGET_PLATFORM}",
|
||||
"size": {
|
||||
"name": "S4"
|
||||
"name": "L4"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -11,14 +11,13 @@ before(() => {
|
||||
})
|
||||
|
||||
it('allows uploading a file', () => {
|
||||
cy.get('a[data-test-subj="uploadFile"]').should('be.visible').click()
|
||||
cy.get('a[data-test-subj="uploadFile"]').click()
|
||||
cy.get(
|
||||
'input#filePicker',
|
||||
).selectFile('cypress/fixtures/test-data-to-import.ndjson', {
|
||||
force: true
|
||||
});
|
||||
cy.get('[data-test-subj="dataVisualizerFileOpenImportPageButton"]')
|
||||
.should('be.visible')
|
||||
.click();
|
||||
cy.fixture('testdata').then((td) => {
|
||||
cy.get('[data-test-subj="dataVisualizerFileIndexNameInput"]').type(
|
||||
@@ -26,7 +25,6 @@ it('allows uploading a file', () => {
|
||||
)
|
||||
})
|
||||
cy.get('[data-test-subj="dataVisualizerFileImportButton"]')
|
||||
.should('be.visible')
|
||||
.click();
|
||||
cy.get('[title*="Index created is complete"]')
|
||||
.scrollIntoView()
|
||||
@@ -45,13 +43,12 @@ it('allows uploading a file', () => {
|
||||
it('allows creating a dashboard', () => {
|
||||
cy.visit('app/dashboards/create/')
|
||||
closeThePopups();
|
||||
cy.contains('button', 'Create').should('be.visible').forceClick();
|
||||
cy.contains('button', 'Create').forceClick();
|
||||
cy.get('[data-test-subj="dashboardSaveMenuItem"]')
|
||||
.should('have.text', 'Save')
|
||||
.forceClick();
|
||||
cy.fixture('testdata').then((td) => {
|
||||
cy.get('[data-test-subj="savedObjectTitle"]')
|
||||
.should('be.visible')
|
||||
.type(`${td.dashboardTitle}.${random}`);
|
||||
cy.get('[data-test-subj="dashboardDescription"]').type(
|
||||
`${td.dashboardDescription}.${random}`,
|
||||
@@ -70,24 +67,21 @@ it('allows creating a dashboard', () => {
|
||||
it('allows creating a visualisation', () => {
|
||||
cy.visit('app/visualize/');
|
||||
closeThePopups();
|
||||
cy.contains('button', 'Create').should('be.visible').click();
|
||||
cy.contains('button', 'Create').click();
|
||||
cy.get('[data-test-subj="visType-vega"]')
|
||||
.should('contain.text', 'Custom visualization')
|
||||
.forceClick();
|
||||
cy.contains('[data-test-subj="visualizeSaveButton"]', 'Save')
|
||||
.should('exist')
|
||||
.forceClick();
|
||||
cy.fixture('testdata').then((td) => {
|
||||
cy.get('[data-test-subj="savedObjectTitle"]')
|
||||
.should('exist')
|
||||
.type(`${td.visualizationTitle}.${random}`)
|
||||
});
|
||||
cy.get('[id="new-dashboard-option"]').should('exist').forceClick();
|
||||
cy.contains('Save and go').should('exist').forceClick();
|
||||
cy.contains('Save').should('exist').click();
|
||||
cy.get('[id="new-dashboard-option"]').forceClick();
|
||||
cy.contains('Save and go').forceClick();
|
||||
cy.contains('Save').click();
|
||||
cy.fixture('testdata').then((td) => {
|
||||
cy.get('[data-test-subj="savedObjectTitle"]')
|
||||
.should('be.visible')
|
||||
.type(`${td.visualizationTitle}.${random}`);
|
||||
cy.get('[data-test-subj="dashboardDescription"]').type(
|
||||
`${td.dashboardDescription}.${random}`,
|
||||
@@ -106,18 +100,15 @@ it('allows creating a visualisation', () => {
|
||||
it('allows adding a remote cluster', () => {
|
||||
cy.visit('app/management/data/remote_clusters');
|
||||
closeThePopups();
|
||||
cy.contains('span', 'Add').should('be.visible').forceClick();
|
||||
cy.contains('span', 'Add').forceClick();
|
||||
cy.fixture('testdata').then((td) => {
|
||||
cy.get('[data-test-subj="remoteClusterFormNameInput"]')
|
||||
.should('be.visible')
|
||||
.type(`${td.remoteClusterName}${random}`, {
|
||||
force: true
|
||||
});
|
||||
cy.get('[data-test-subj="comboBoxInput"]')
|
||||
.should('be.visible')
|
||||
.type(td.remoteCluster);
|
||||
cy.get('[data-test-subj="remoteClusterFormSaveButton"]')
|
||||
.should('be.visible')
|
||||
.forceClick();
|
||||
cy.get('[data-test-subj="remoteClusterDetailFlyout"]').contains(
|
||||
td.remoteClusterName,
|
||||
@@ -134,14 +125,12 @@ it('allows adding of a canvas', () => {
|
||||
cy.visit('app/canvas#/');
|
||||
closeThePopups();
|
||||
cy.get('[data-test-subj="create-workpad-button"]')
|
||||
.should('be.visible')
|
||||
.forceClick();
|
||||
cy.fixture('testdata').then((td) => {
|
||||
cy.get('input[value="My Canvas Workpad"]').clear().type(`${td.workpadName}${random}`);
|
||||
});
|
||||
|
||||
cy.get('[data-test-subj="add-element-button"]')
|
||||
.should('have.text', 'Add element')
|
||||
.forceClick();
|
||||
cy.contains('span', 'Text').forceClick();
|
||||
cy.visit('app/canvas#/');
|
||||
|
||||
@@ -7,14 +7,14 @@ export const skipTheWelcomeScreen = () => {
|
||||
closeThePopups();
|
||||
cy.get("body").then(($body) => {
|
||||
if ($body.text().includes('Explore on my own')) {
|
||||
cy.get('button[data-test-subj="skipWelcomeScreen"]').should('be.visible').click();
|
||||
cy.get('button[data-test-subj="skipWelcomeScreen"]').click();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const closeThePopups = () => {
|
||||
cy.get('[data-test-subj="kbnLoadingMessage"]').should('not.exist');
|
||||
cy.get('[data-test-subj="toastCloseButton"]').should('exist').click({
|
||||
cy.get('[data-test-subj="toastCloseButton"]').click({
|
||||
multiple: true
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
"env": {
|
||||
"username": "test_admin",
|
||||
"password": "ComplicatedPassword123!4"
|
||||
}
|
||||
},
|
||||
"defaultCommandTimeout": 35000
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/// <reference types="cypress" />
|
||||
|
||||
export let random = (Math.random() + 1).toString(36).substring(7);
|
||||
console.log("random", random);
|
||||
|
||||
@@ -1,24 +1,50 @@
|
||||
const COMMAND_DELAY = 500;
|
||||
const CLICK_DELAY = 1300;
|
||||
const TYPE_DELAY = 300;
|
||||
const FILE_UPLOAD_DELAY = 300;
|
||||
|
||||
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);
|
||||
}, CLICK_DELAY);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Cypress.Commands.add("login", (
|
||||
username = Cypress.env("username"),
|
||||
password = Cypress.env("password")
|
||||
) => {
|
||||
for (const command of ['type']) {
|
||||
Cypress.Commands.overwrite(command, (originalFn, ...args) => {
|
||||
const origVal = originalFn(...args);
|
||||
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve(origVal);
|
||||
}, TYPE_DELAY);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
for (const command of ['selectFile']) {
|
||||
Cypress.Commands.overwrite(command, (originalFn, ...args) => {
|
||||
const origVal = originalFn(...args);
|
||||
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve(origVal);
|
||||
}, FILE_UPLOAD_DELAY);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Cypress.Commands.add(
|
||||
'login',
|
||||
(username = Cypress.env('username'), password = Cypress.env('password')) => {
|
||||
cy.clearCookies();
|
||||
cy.visit('/login')
|
||||
cy.get('input#accessKey').should('be.visible').type(username);
|
||||
cy.get('input#secretKey').should('be.visible').type(password);
|
||||
cy.get('button[type="submit"]').should('be.visible').click();
|
||||
});
|
||||
cy.visit('/login');
|
||||
cy.get('input#accessKey').type(username);
|
||||
cy.get('input#secretKey').type(password);
|
||||
cy.get('button[type="submit"]').click();
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"baseUrl": "https://localhost/",
|
||||
"baseUrl": "http://localhost/",
|
||||
"env": {
|
||||
"username": "root",
|
||||
"password": "rootPassword"
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"url": "{SHA_ARCHIVE}",
|
||||
"path": "/bitnami/phpmyadmin"
|
||||
},
|
||||
"runtime_parameters": "ZGI6CiAgaG9zdDogbWFyaWFkYgogIGFsbG93QXJiaXRyYXJ5U2VydmVyOiB0cnVlCiAgcG9ydDogMzMwNgogIGJ1bmRsZVRlc3REQjogdHJ1ZQpzZXJ2aWNlOgogIHR5cGU6IExvYWRCYWxhbmNlcgogIHBvcnRzOgogICAgaHR0cHM6IDQ0MwptYXJpYWRiOgogIGF1dGg6CiAgICByb290UGFzc3dvcmQ6IHJvb3RQYXNzd29yZAo=",
|
||||
"runtime_parameters": "ZGI6CiAgaG9zdDogbWFyaWFkYgogIGFsbG93QXJiaXRyYXJ5U2VydmVyOiB0cnVlCiAgcG9ydDogMzMwNgogIGJ1bmRsZVRlc3REQjogdHJ1ZQpzZXJ2aWNlOgogIHR5cGU6IExvYWRCYWxhbmNlcgogIHBvcnRzOgogICAgaHR0cDogODAKbWFyaWFkYjoKICBhdXRoOgogICAgcm9vdFBhc3N3b3JkOiByb290UGFzc3dvcmQ=",
|
||||
"target_platform": {
|
||||
"target_platform_id": "{TARGET_PLATFORM}",
|
||||
"size": {
|
||||
@@ -52,7 +52,7 @@
|
||||
"resources": {
|
||||
"path": "/.vib/phpmyadmin/cypress"
|
||||
},
|
||||
"endpoint": "lb-phpmyadmin-https",
|
||||
"endpoint": "lb-phpmyadmin-http",
|
||||
"app_protocol": "HTTP",
|
||||
"env": {
|
||||
"username": "root",
|
||||
|
||||
@@ -10,5 +10,6 @@
|
||||
"smtpUser": "test_mail_user",
|
||||
"wordpressFirstName": "TestName",
|
||||
"wordpressLastName":"TestLastName"
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultCommandTimeout":30000
|
||||
}
|
||||
|
||||
@@ -2,4 +2,3 @@
|
||||
/// <reference types="cypress" />
|
||||
|
||||
export let random = (Math.random() + 1).toString(36).substring(7);
|
||||
console.log("random", random);
|
||||
|
||||
@@ -1,118 +1,148 @@
|
||||
/// <reference types="cypress" />
|
||||
|
||||
import {
|
||||
random,
|
||||
} from './utils'
|
||||
import { random } from './utils';
|
||||
|
||||
it('contains the sample blogpost and a comment', () => {
|
||||
cy.visit('/');
|
||||
cy.get('.wp-block-query').should('exist');
|
||||
cy.get('.wp-block-query');
|
||||
cy.get('.wp-block-post-title a').click();
|
||||
cy.fixture('helloworld').then((hw) => {
|
||||
cy.contains('.wp-block-post-title', hw.title);
|
||||
cy.contains('.wp-block-post-content',hw.content);
|
||||
})
|
||||
cy.contains('.wp-block-post-content', hw.content);
|
||||
});
|
||||
|
||||
cy.get('.wp-block-post-title').click();
|
||||
cy.get('.commentlist').should('have.length', 1);
|
||||
cy.fixture('helloworld').then((hw) => {
|
||||
cy.get('.comment-author').should('contain.text', hw.commenter)
|
||||
cy.get('.comment-author').should('contain.text', hw.commenter);
|
||||
|
||||
cy.fixture('helloworld').then((hw) => {
|
||||
cy.get('#comment').type(hw.comment).should('have.value', hw.comment);
|
||||
})
|
||||
});
|
||||
|
||||
cy.fixture('user').then((user) => {
|
||||
cy.get('#author').type(user.username).should('have.value', user.username);
|
||||
cy.get('#email').type(user.email).should('have.value', user.email);
|
||||
})
|
||||
});
|
||||
|
||||
cy.get('#submit').click();
|
||||
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
it('disallows login to an invalid user', () => {
|
||||
cy.clearCookies();
|
||||
cy.visit('/wp-login.php')
|
||||
cy.visit('/wp-login.php');
|
||||
cy.fixture('user').then((user) => {
|
||||
cy.get('#user_login').should('not.be.disabled').type(user.username).should('have.value', user.username);
|
||||
cy.get('#user_pass').should('not.be.disabled').type(user.password).should('have.value', user.password);
|
||||
})
|
||||
cy.get('#user_login')
|
||||
.type(user.username)
|
||||
.should('have.value', user.username); // Since login can be flaky, leaving additional asserts
|
||||
cy.get('#user_pass')
|
||||
.type(user.password)
|
||||
.should('have.value', user.password);
|
||||
});
|
||||
cy.get('#wp-submit').click();
|
||||
cy.fixture('user').then((user) => {
|
||||
cy.get('#login_error').should('contain.text', `The username ${user.username} is not registered on this site.`);
|
||||
})
|
||||
|
||||
})
|
||||
cy.get('#login_error').should(
|
||||
'contain.text',
|
||||
`The username ${user.username} is not registered on this site.`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('disallows login to a valid user with wrong password', () => {
|
||||
cy.clearCookies();
|
||||
cy.visit('/wp-login.php')
|
||||
|
||||
cy.get('#user_login').type(Cypress.env('username')).should('have.value', Cypress.env('username'));
|
||||
cy.visit('/wp-login.php');
|
||||
cy.get('#user_login')
|
||||
.type(Cypress.env('username'))
|
||||
.should('have.value', Cypress.env('username'));
|
||||
cy.fixture('user').then((user) => {
|
||||
cy.get('#user_pass').type(user.password).should('have.value', user.password);
|
||||
})
|
||||
cy.get('#user_pass')
|
||||
.type(user.password)
|
||||
.should('have.value', user.password);
|
||||
});
|
||||
cy.get('#wp-submit').click();
|
||||
cy.get('#login_error').should('contain.text', `Error: The password you entered for the username ${Cypress.env('username')} is incorrect. Lost your password?`);
|
||||
})
|
||||
cy.get('#login_error').should(
|
||||
'contain.text',
|
||||
`Error: The password you entered for the username ${Cypress.env(
|
||||
'username'
|
||||
)} is incorrect. Lost your password?`
|
||||
);
|
||||
});
|
||||
|
||||
it('checks the blog name and user email configuration', () => {
|
||||
cy.login();
|
||||
cy.visit('/wp-admin/options-general.php')
|
||||
cy.get('#new_admin_email').should('have.value', Cypress.env('wordpressEmail'));
|
||||
cy.visit('/wp-admin/options-general.php');
|
||||
cy.get('#new_admin_email').should(
|
||||
'have.value',
|
||||
Cypress.env('wordpressEmail')
|
||||
);
|
||||
cy.get('#blogname').should('have.value', Cypress.env('wordpressBlogname'));
|
||||
})
|
||||
});
|
||||
|
||||
it('checks if admin can edit a site', () => {
|
||||
cy.login();
|
||||
cy.visit('/wp-admin/index.php')
|
||||
cy.contains('Open site editor').click()
|
||||
cy.visit('/wp-admin/index.php');
|
||||
cy.contains('Open site editor').click();
|
||||
cy.url().should('include', '/wp-admin/site-editor.php');
|
||||
})
|
||||
});
|
||||
|
||||
it('checks if admin can create a post', () => {
|
||||
cy.login();
|
||||
cy.visit('/wp-admin/post-new.php');
|
||||
cy.get('.components-modal__header > .components-button').click();
|
||||
cy.get('#editor').should('be.visible');
|
||||
cy.contains('button[type="button"]',"Publish").click();
|
||||
cy.get('h1[aria-label="Add title"]').should('be.visible').clear().type(`Test Hello World!${random}`);
|
||||
cy.get('.editor-post-save-draft').should('be.visible').click();
|
||||
cy.get('.editor-post-saved-state').should('be.visible').and('have.text','Saved');
|
||||
|
||||
})
|
||||
cy.contains('button[type="button"]', 'Publish').click();
|
||||
cy.get('h1[aria-label="Add title"]')
|
||||
.clear()
|
||||
.type(`Test Hello World!${random}`);
|
||||
cy.get('.editor-post-save-draft').click();
|
||||
cy.get('.editor-post-saved-state').and('have.text', 'Saved');
|
||||
});
|
||||
|
||||
it('checks the SMTP configuration', () => {
|
||||
cy.login();
|
||||
cy.visit('/wp-admin/admin.php?page=wp-mail-smtp');
|
||||
cy.get('div').contains('WP Mail SMTP').should('be.visible');
|
||||
cy.get('#wp-mail-smtp-setting-smtp-host').should('have.value', Cypress.env('smtpMailServer'));
|
||||
cy.get('#wp-mail-smtp-setting-smtp-port').should('have.value', Cypress.env('smtpPort'));
|
||||
cy.get('#wp-mail-smtp-setting-smtp-user').should('have.value', Cypress.env('smtpUser'));
|
||||
cy.get('#wp-mail-smtp-setting-from_name').should('have.value', `${Cypress.env('wordpressFirstName')} ${Cypress.env('wordpressLastName')}`);
|
||||
})
|
||||
cy.contains('div', 'WP Mail SMTP');
|
||||
cy.get('#wp-mail-smtp-setting-smtp-host').should(
|
||||
'have.value',
|
||||
Cypress.env('smtpMailServer')
|
||||
);
|
||||
cy.get('#wp-mail-smtp-setting-smtp-port').should(
|
||||
'have.value',
|
||||
Cypress.env('smtpPort')
|
||||
);
|
||||
cy.get('#wp-mail-smtp-setting-smtp-user').should(
|
||||
'have.value',
|
||||
Cypress.env('smtpUser')
|
||||
);
|
||||
cy.get('#wp-mail-smtp-setting-from_name').should(
|
||||
'have.value',
|
||||
`${Cypress.env('wordpressFirstName')} ${Cypress.env('wordpressLastName')}`
|
||||
);
|
||||
});
|
||||
|
||||
it('checks the value of auto update status', () => {
|
||||
cy.login();
|
||||
cy.visit("/wp-admin/update-core.php");
|
||||
cy.get('.auto-update-status').should('contain.text', 'This site is automatically kept up to date with maintenance and security releases of WordPress only.');
|
||||
})
|
||||
cy.visit('/wp-admin/update-core.php');
|
||||
cy.get('.auto-update-status').should(
|
||||
'contain.text',
|
||||
'This site is automatically kept up to date with maintenance and security releases of WordPress only.'
|
||||
);
|
||||
});
|
||||
|
||||
it('allows the upload of a file',() => {
|
||||
it('allows the upload of a file', () => {
|
||||
cy.login();
|
||||
cy.visit("wp-admin/upload.php");
|
||||
cy.contains("[role='button']",'Add New').should('be.visible').click();
|
||||
cy.contains("[aria-labelledby]",'Select Files').should('be.visible');
|
||||
cy.get('input[type=file]').selectFile('cypress/fixtures/images/test_image.jpeg',
|
||||
{force:true});
|
||||
cy.get('.attachment').should('be.visible');
|
||||
})
|
||||
cy.visit('wp-admin/upload.php');
|
||||
cy.contains("[role='button']", 'Add New').click();
|
||||
cy.contains('[aria-labelledby]', 'Select Files');
|
||||
cy.get('input[type=file]').selectFile(
|
||||
'cypress/fixtures/images/test_image.jpeg',
|
||||
{ force: true }
|
||||
);
|
||||
cy.get('.attachment');
|
||||
});
|
||||
|
||||
it('allows to log out', () => {
|
||||
cy.login();
|
||||
cy.visit('wp-login.php?loggedout=true&wp_lang=en_US');
|
||||
cy.contains('.message','logged out');
|
||||
})
|
||||
|
||||
cy.contains('.message', 'logged out');
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Added to slow down Cypress test execution without using hardcoded waits. If removed, there will be false positives.
|
||||
// Added to slow down Cypress test execution without using hardcoded waits. If removed, there will be false positives.
|
||||
|
||||
const COMMAND_DELAY = 200;
|
||||
const COMMAND_DELAY = 1000;
|
||||
|
||||
for (const command of ['click']) {
|
||||
Cypress.Commands.overwrite(command, (originalFn, ...args) => {
|
||||
@@ -14,13 +14,13 @@ for (const command of ['click']) {
|
||||
});
|
||||
}
|
||||
|
||||
Cypress.Commands.add("login", (
|
||||
username = Cypress.env("username"),
|
||||
password = Cypress.env("password")
|
||||
) => {
|
||||
cy.clearCookies();
|
||||
cy.visit('/wp-login.php')
|
||||
cy.get('#user_login').should('not.be.disabled').type(username); //assertion is here to combat flakiness, do not remove
|
||||
cy.get('#user_pass').should('not.be.disabled').type(password);
|
||||
cy.get('#wp-submit').should('be.visible').click();
|
||||
});
|
||||
Cypress.Commands.add(
|
||||
'login',
|
||||
(username = Cypress.env('username'), password = Cypress.env('password')) => {
|
||||
cy.clearCookies();
|
||||
cy.visit('/wp-login.php');
|
||||
cy.get('#user_login').type(username);
|
||||
cy.get('#user_pass').type(password);
|
||||
cy.get('#wp-submit').click();
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user