mirror of
https://github.com/portainer/portainer.git
synced 2025-08-04 21:35:23 +02:00
feat(project): refactor e2e testing (#4341)
* feat(project): refactor e2e testing * feat(project): remove example text * feat(project): add missing newlines Co-authored-by: owner <owner@pop-os.localdomain>
This commit is contained in:
parent
466bd24648
commit
d4c4c4e895
18 changed files with 1442 additions and 130 deletions
19
test/e2e/cypress/integration/ci_basic_tests/init.spec.js
Normal file
19
test/e2e/cypress/integration/ci_basic_tests/init.spec.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
context('Init admin user test', () => {
|
||||
beforeEach(() => {
|
||||
cy.restoreLocalStorage();
|
||||
});
|
||||
describe('Initialise admin user and endpoint', function () {
|
||||
it('Create admin user and verify success', function () {
|
||||
cy.initAdmin('admin', 'portainer');
|
||||
cy.url().should('include', 'init/endpoint');
|
||||
cy.saveLocalStorage();
|
||||
});
|
||||
it('Select local docker endpoint and init', function () {
|
||||
cy.initEndpoint();
|
||||
cy.url().should('include', 'home');
|
||||
});
|
||||
it('Add docker swarm endpoint', function () {
|
||||
cy.addNewEndpoint('swarm', 'Agent', 'e2e-portainer:9001');
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,31 @@
|
|||
context('Resting of minimum viable functionality against docker standalone', () => {
|
||||
before(() => {
|
||||
cy.visit('/');
|
||||
});
|
||||
|
||||
after(() => {});
|
||||
|
||||
describe('Manipulating resources as admin', function () {
|
||||
beforeEach(() => {
|
||||
cy.visit('/');
|
||||
cy.auth('frontend', 'admin', 'portainer');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
// Clean Tokens
|
||||
cy.clearUserTokens();
|
||||
});
|
||||
|
||||
it('Login and create resources as admin', function () {
|
||||
cy.visit('/');
|
||||
cy.selectEndpoint('local');
|
||||
cy.modifyResources('frontend', 'create');
|
||||
});
|
||||
|
||||
it('Login and delete resources as admin', function () {
|
||||
cy.visit('/');
|
||||
cy.selectEndpoint('local');
|
||||
cy.modifyResources('frontend', 'delete');
|
||||
});
|
||||
});
|
||||
});
|
31
test/e2e/cypress/integration/ci_basic_tests/swarm.spec.js
Normal file
31
test/e2e/cypress/integration/ci_basic_tests/swarm.spec.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
context('Testing of minimum viable functionality against docker swarm', () => {
|
||||
before(() => {
|
||||
cy.visit('/');
|
||||
});
|
||||
|
||||
after(() => {});
|
||||
|
||||
describe('Manipulating resources as admin', function () {
|
||||
beforeEach(() => {
|
||||
cy.visit('/');
|
||||
cy.auth('frontend', 'admin', 'portainer');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
// Clean Tokens
|
||||
cy.clearUserTokens();
|
||||
});
|
||||
|
||||
it('Login and create resources as admin', function () {
|
||||
cy.visit('/');
|
||||
cy.selectEndpoint('swarm');
|
||||
cy.modifyResources('frontend', 'create');
|
||||
});
|
||||
|
||||
it('Login and delete resources as admin', function () {
|
||||
cy.visit('/');
|
||||
cy.selectEndpoint('swarm');
|
||||
cy.modifyResources('frontend', 'delete');
|
||||
});
|
||||
});
|
||||
});
|
16
test/e2e/cypress/integration/init.spec.js
Normal file
16
test/e2e/cypress/integration/init.spec.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
context('Init admin & local docker endpoint', () => {
|
||||
beforeEach(() => {
|
||||
cy.restoreLocalStorage();
|
||||
});
|
||||
describe('Initialise admin user and endpoint', function () {
|
||||
it('Create admin user and verify success', function () {
|
||||
cy.initAdmin('admin', 'portainer');
|
||||
cy.url().should('include', 'init/endpoint');
|
||||
cy.saveLocalStorage();
|
||||
});
|
||||
it('Select local docker endpoint and init', function () {
|
||||
cy.initEndpoint();
|
||||
cy.url().should('include', 'home');
|
||||
});
|
||||
});
|
||||
});
|
40
test/e2e/cypress/integration/rbac/docker-standalone.spec.js
Normal file
40
test/e2e/cypress/integration/rbac/docker-standalone.spec.js
Normal file
|
@ -0,0 +1,40 @@
|
|||
context('Standard RBAC tests against docker standalone', () => {
|
||||
before(() => {
|
||||
cy.visit('/');
|
||||
});
|
||||
|
||||
after(() => {});
|
||||
|
||||
describe('Validate endpoint admin functionality', function () {
|
||||
beforeEach(() => {
|
||||
cy.visit('/');
|
||||
cy.auth('frontend', 'admin', 'portainer');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
// Cleanup remaining users and teams
|
||||
cy.deleteUsers();
|
||||
cy.deleteTeams();
|
||||
// Clean Tokens
|
||||
cy.clearUserTokens();
|
||||
});
|
||||
|
||||
it('User assigned as endpoint-admin against an endpoint', function () {
|
||||
// Create and assign user as the administrator
|
||||
cy.createUser('frontend', 'adam', 'portainer');
|
||||
cy.assignAccess('local', 'adam', 'user');
|
||||
cy.clearBrowserToken();
|
||||
|
||||
// Login and create, read, update, delete resources as user
|
||||
cy.visit('/');
|
||||
cy.auth('frontend', 'adam', 'portainer');
|
||||
cy.selectEndpoint('local');
|
||||
|
||||
// create resources
|
||||
cy.modifyResources('frontend', 'create');
|
||||
// modify resources
|
||||
// delete resources
|
||||
cy.modifyResources('frontend', 'delete');
|
||||
});
|
||||
});
|
||||
});
|
40
test/e2e/cypress/integration/rbac/docker-swarm.spec.js
Normal file
40
test/e2e/cypress/integration/rbac/docker-swarm.spec.js
Normal file
|
@ -0,0 +1,40 @@
|
|||
context('Standard RBAC tests against docker swarm', () => {
|
||||
before(() => {
|
||||
cy.visit('/');
|
||||
});
|
||||
|
||||
after(() => {});
|
||||
|
||||
describe('Validate endpoint admin functionality', function () {
|
||||
beforeEach(() => {
|
||||
cy.visit('/');
|
||||
cy.auth('frontend', 'admin', 'portainer');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
// Cleanup remaining users and teams
|
||||
cy.deleteUsers();
|
||||
cy.deleteTeams();
|
||||
// Clean Tokens
|
||||
cy.clearUserTokens();
|
||||
});
|
||||
|
||||
it('User assigned as endpoint-admin against an endpoint', function () {
|
||||
// Create and assign user as the administrator
|
||||
cy.createUser('frontend', 'adam', 'portainer');
|
||||
cy.assignAccess('swarm', 'adam', 'user');
|
||||
cy.clearBrowserToken();
|
||||
|
||||
// Login and create, read, update, delete resources as user
|
||||
cy.visit('/');
|
||||
cy.auth('frontend', 'adam', 'portainer');
|
||||
cy.selectEndpoint('swarm');
|
||||
|
||||
// create resources
|
||||
cy.modifyResources('frontend', 'create');
|
||||
// modify resources
|
||||
// delete resources
|
||||
cy.modifyResources('frontend', 'delete');
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,16 +0,0 @@
|
|||
// Tests to run
|
||||
context('Tests to run', () => {
|
||||
//Browse to homepage before each test
|
||||
beforeEach(() => {
|
||||
cy.visit('/');
|
||||
});
|
||||
describe('Init admin', function () {
|
||||
it('Create user and verify success', function () {
|
||||
cy.get('#username').should('have.value', 'admin');
|
||||
cy.get('#password').type('portaineriscool').should('have.value', 'portaineriscool');
|
||||
cy.get('#confirm_password').type('portaineriscool').should('have.value', 'portaineriscool');
|
||||
cy.get('[type=submit]').click();
|
||||
cy.url().should('include', '/init/endpoint');
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue