Skip to content

Commit

Permalink
Fix integration tests ([#78](#78))
Browse files Browse the repository at this point in the history
  • Loading branch information
pfeuffer committed Jul 21, 2023
1 parent 31c5e78 commit 83e316b
Show file tree
Hide file tree
Showing 14 changed files with 1,019 additions and 3,199 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
### Fixed
- [#78] Integration tests after upgrading CAS

## [2.44.2-2]
### Added
- [#72] Configuration options for resource requirements
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ node('vagrant') {
}

stage('e2e Tests') {
ecoSystem.runCypressIntegrationTests([cypressImage: "cypress/included:8.6.0", enableVideo: true, enableScreenshots: true])
ecoSystem.runCypressIntegrationTests([cypressImage: "cypress/included:12.17.1", enableVideo: true, enableScreenshots: true])
}

stage('Push changes to remote repository') {
Expand Down
3 changes: 3 additions & 0 deletions integrationTests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
cypress/videos
cypress/screenshots
37 changes: 37 additions & 0 deletions integrationTests/cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const doguTestLibrary = require('@cloudogu/dogu-integration-test-library');
const { defineConfig } = require('cypress');
const createBundler = require("@bahmutov/cypress-esbuild-preprocessor");
const preprocessor = require("@badeball/cypress-cucumber-preprocessor");
const createEsbuildPlugin = require("@badeball/cypress-cucumber-preprocessor/esbuild");

async function setupNodeEvents(on, config) {
// This is required for the preprocessor to be able to generate JSON reports after each run, and more,
await preprocessor.addCucumberPreprocessorPlugin(on, config);

on(
"file:preprocessor",
createBundler({
plugins: [createEsbuildPlugin.default(config)],
})
);

config = doguTestLibrary.configure(config);

return config;
}

module.exports = defineConfig({
e2e: {
baseUrl: 'https://192.168.56.2',
env: {
"DoguName": "scm",
"MaxLoginRetries": 3,
"AdminUsername": "ces-admin",
"AdminPassword": "ecosystem2016",
"AdminGroup": "CesAdministrators"
},
videoCompression: false,
specPattern: ["cypress/e2e/**/*.feature"],
setupNodeEvents,
},
});
13 changes: 0 additions & 13 deletions integrationTests/cypress.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,28 @@ Feature: Browser-based CAS login and logout functionality
Scenario: logged out user can log in to the dogu
Given the user is logged out of the CES
When the user opens the dogu start page
And the user types in correct login credentials
And the user clicks the login button
And the test user logs in with correct credentials
And the user waits until the page is fully loaded
Then the user is logged in to the dogu

@requires_testuser
Scenario: logged out user can not log in to the dogu with wrong credentials
Given the user is logged out of the CES
When the user opens the dogu start page
And the user types in wrong login credentials
And the user clicks the login button
And the user logs in with wrong credentials
Then the login page informs the user about invalid credentials

@requires_testuser
Scenario: logged in user can log out via logout button (front-channel)
Given the user is logged into the CES
When the user opens the dogu start page
And the user waits until the page is fully loaded
And the user clicks the dogu logout button
Then the user is logged out of the dogu

@requires_testuser
Scenario: logged in user can log out via cas logout page (back-channel)
Given the user is logged into the CES
When the user logs out by visiting the cas logout page
When the user waits until the page is fully loaded
And the user logs out by visiting the cas logout page
Then the user is logged out of the dogu
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,35 @@ Feature: Automatic grant of privileges when logging into a dogu
Scenario: ces user with default privileges has default privileges in the dogu
Given the user is not member of the admin user group
When the user logs into the CES
And the user waits until the page is fully loaded
Then the user has no administrator privileges in the dogu

@requires_testuser
Scenario: ces user with admin privileges has admin privileges in the dogu
Given the user is member of the admin user group
When the user logs into the CES
And the user waits until the page is fully loaded
Then the user has administrator privileges in the dogu

@requires_testuser
Scenario: ces user without admin privileges has no admin privileges in the dogu
Given the user is not member of the admin user group
When the user logs into the CES
And the user waits until the page is fully loaded
Then the user has no administrator privileges in the dogu

@requires_testuser
Scenario: internal dogu admin account is demoted after login of non admin
Given the user has an internal default dogu account
And the user is not member of the admin user group
When the user logs into the CES
And the user waits until the page is fully loaded
Then the user has no administrator privileges in the dogu

@requires_testuser
Scenario: internal dogu default account is promoted after login of admin
Given the user has an internal default dogu account
And the user is member of the admin user group
When the user logs into the CES
And the user waits until the page is fully loaded
Then the user has administrator privileges in the dogu
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ Feature: SCM Browser
Scenario: ces admin user can access index
Given the user is member of the admin user group
When the user logs into the CES
And the user waits until the page is fully loaded
Then the user can access the index
11 changes: 0 additions & 11 deletions integrationTests/cypress/plugins/index.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ doguTestLibrary.registerCommands()

// local commands
import './commands/scm_api'
import './commands/scm_ui'
import './commands/scm_ui'
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
const {
When, Then
} = require("@badeball/cypress-cucumber-preprocessor");

// Loads all steps from the dogu integration library into this project
const doguTestLibrary = require('@cloudogu/dogu-integration-test-library')
doguTestLibrary.registerSteps()
Expand All @@ -16,6 +20,10 @@ When("the user clicks the dogu logout button", () => {
cy.get('h2[class=banner-heading]').should('be.visible');
});

When("the user waits until the page is fully loaded", () => {
cy.get('img[src="/scm/images/loading.svg"]').should('not.exist')
});

Then("the user has administrator privileges in the dogu", () => {
Cypress.on('uncaught:exception', () => {
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { Then } = require("cypress-cucumber-preprocessor/steps");
const { Then } = require("@badeball/cypress-cucumber-preprocessor");

Then("the user can access the index", () => {
cy.getIndex().then((response) => {
Expand Down
10 changes: 6 additions & 4 deletions integrationTests/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"license": "MIT",
"dependencies": {
"cypress": "8.6.0",
"cypress-cucumber-preprocessor": "4.1.0",
"@cloudogu/dogu-integration-test-library": "1.0.0"
"@badeball/cypress-cucumber-preprocessor": "^16.0.0",
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.0",
"@cloudogu/dogu-integration-test-library": "6.0.1",
"cypress": "^12.9.0",
"@bahmutov/cy-api": "^2.2.4"
},
"scripts": {
"updateTests": "mkdir -p cypress/integration/dogu_integration_test_lib && cp -r node_modules/@cloudogu/dogu-integration-test-library/lib/integration/* cypress/integration/dogu_integration_test_lib"
"updateTests": "mkdir -p cypress/e2e/dogu_integration_test_lib && cp -r node_modules/@cloudogu/dogu-integration-test-library/lib/integration/* cypress/e2e/dogu_integration_test_lib"
}
}
Loading

0 comments on commit 83e316b

Please sign in to comment.