mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 07:25:44 +01:00
convert cucumber tests to standard cypress with typescript (#1962)
In light of the upcoming release of version 3 of the integration-test-runner, which does not use cucumber but standard cypress with typescript, all e2e tests have been converted to match the new format. Co-authored-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com>
This commit is contained in:
committed by
GitHub
parent
033238f173
commit
a1edf1ce8e
@@ -1,38 +0,0 @@
|
|||||||
#
|
|
||||||
# MIT License
|
|
||||||
#
|
|
||||||
# Copyright (c) 2020-present Cloudogu GmbH and Contributors
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in all
|
|
||||||
# copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
# SOFTWARE.
|
|
||||||
#
|
|
||||||
|
|
||||||
Feature: Anonymous Mode Disabled
|
|
||||||
|
|
||||||
Background:
|
|
||||||
Given Anonymous Mode is disabled
|
|
||||||
|
|
||||||
Scenario: There is no primary navigation
|
|
||||||
Given User is not authenticated
|
|
||||||
When User visits any page
|
|
||||||
Then There is no primary navigation
|
|
||||||
|
|
||||||
Scenario: Authenticated users have a footer navigation
|
|
||||||
Given User is authenticated
|
|
||||||
When User visits any page
|
|
||||||
Then There is a footer navigation
|
|
||||||
@@ -22,16 +22,32 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
When("User visits repository", function() {
|
import { hri } from "human-readable-ids";
|
||||||
cy.visit(`/repo/${this.repository.namespace}/${this.repository.name}/code/sources`);
|
|
||||||
});
|
|
||||||
|
|
||||||
When("User performs file search inside repository", function() {
|
describe("Anonymous Mode Disabled", () => {
|
||||||
cy.byTestId("file_search_button").click();
|
beforeEach(() => {
|
||||||
cy.url().should("include", `/repo/${this.repository.namespace}/${this.repository.name}/code/search/main?q=`);
|
cy.restSetAnonymousMode("OFF");
|
||||||
cy.get("[data-testid=file_search_filter_input]").type("README");
|
});
|
||||||
});
|
|
||||||
|
|
||||||
Then("The search results are found", function() {
|
it("should show login page when not authenticated", () => {
|
||||||
cy.get("[data-testid=file_search_single_result]").contains("README.md");
|
// Act
|
||||||
|
cy.visit("/repos/");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
cy.byTestId("login-button");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should show footer for authenticated user", () => {
|
||||||
|
// Arrange
|
||||||
|
const username = hri.random();
|
||||||
|
const password = hri.random();
|
||||||
|
cy.restCreateUser(username, password);
|
||||||
|
cy.restLogin(username, password);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
cy.visit("/home");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
cy.byTestId("footer-user-profile");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
#
|
|
||||||
# MIT License
|
|
||||||
#
|
|
||||||
# Copyright (c) 2020-present Cloudogu GmbH and Contributors
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in all
|
|
||||||
# copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
# SOFTWARE.
|
|
||||||
#
|
|
||||||
|
|
||||||
Feature: Anonymous Mode Full
|
|
||||||
|
|
||||||
Background:
|
|
||||||
Given Full Anonymous Mode is enabled
|
|
||||||
And User is not authenticated
|
|
||||||
|
|
||||||
Scenario: Show login button on anonymous route
|
|
||||||
Given Anonymous user has permission to read all repositories
|
|
||||||
When User visits the repository overview page
|
|
||||||
Then The repository overview page is shown
|
|
||||||
And There is a login button
|
|
||||||
|
|
||||||
Scenario: Show login page
|
|
||||||
When User visits login page
|
|
||||||
Then The login page is shown
|
|
||||||
|
|
||||||
Scenario: Navigate to login page
|
|
||||||
When Users clicks login button
|
|
||||||
Then The login page is shown
|
|
||||||
|
|
||||||
Scenario: Redirect to repositories overview after login
|
|
||||||
When User logs in
|
|
||||||
Then User should be authenticated
|
|
||||||
|
|
||||||
Scenario: Anonymous user cannot change password
|
|
||||||
When User visits their user settings
|
|
||||||
Then There is no option to change the password
|
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
/*
|
||||||
|
* MIT License
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020-present Cloudogu GmbH and Contributors
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { hri } from "human-readable-ids";
|
||||||
|
|
||||||
|
describe("Anonymous Mode Full", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.restSetAnonymousMode("FULL");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should show login button on anonymous route", () => {
|
||||||
|
// Arrange
|
||||||
|
cy.restSetUserPermissions("_anonymous", ["repository:read,pull:*"]);
|
||||||
|
// Act
|
||||||
|
cy.visit("/repos/");
|
||||||
|
// Assert
|
||||||
|
cy.byTestId("repository-overview-filter");
|
||||||
|
cy.byTestId("primary-navigation-login");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should show login page", () => {
|
||||||
|
// Act
|
||||||
|
cy.visit("/login/");
|
||||||
|
// Assert
|
||||||
|
cy.byTestId("login-button");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should navigate to login page", () => {
|
||||||
|
// Act
|
||||||
|
cy.byTestId("login-button").click();
|
||||||
|
// Assert
|
||||||
|
cy.byTestId("login-button");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should redirect to repositories overview after login", () => {
|
||||||
|
// Arrange
|
||||||
|
const username = hri.random();
|
||||||
|
const password = hri.random();
|
||||||
|
cy.restCreateUser(username, password);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
cy.login(username, password);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
cy.byTestId(username);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should not allow anonymous user to change password", () => {
|
||||||
|
// Act
|
||||||
|
cy.visit("/me/settings/");
|
||||||
|
// Assert
|
||||||
|
cy.containsNotByTestId("ul", "user-settings-link");
|
||||||
|
cy.get("section").not("Change password");
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
#
|
|
||||||
# MIT License
|
|
||||||
#
|
|
||||||
# Copyright (c) 2020-present Cloudogu GmbH and Contributors
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in all
|
|
||||||
# copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
# SOFTWARE.
|
|
||||||
#
|
|
||||||
|
|
||||||
Feature: Anonymous Mode with Protocol Only
|
|
||||||
Background:
|
|
||||||
Given Protocol Only Anonymous Mode is enabled
|
|
||||||
|
|
||||||
Scenario: There is no primary navigation
|
|
||||||
Given User is not authenticated
|
|
||||||
When User visits the repository overview page
|
|
||||||
Then The login page is shown
|
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* MIT License
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020-present Cloudogu GmbH and Contributors
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* MIT License
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020-present Cloudogu GmbH and Contributors
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
describe("Anonymous Mode with Protocol Only", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.restSetAnonymousMode("PROTOCOL_ONLY");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should show login page when not authenticated", () => {
|
||||||
|
// Act
|
||||||
|
cy.visit("/repos/");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
cy.byTestId("login-button");
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
#
|
|
||||||
# MIT License
|
|
||||||
#
|
|
||||||
# Copyright (c) 2020-present Cloudogu GmbH and Contributors
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in all
|
|
||||||
# copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
# SOFTWARE.
|
|
||||||
#
|
|
||||||
|
|
||||||
Feature: Repository File Search
|
|
||||||
|
|
||||||
Background:
|
|
||||||
Given User is authenticated
|
|
||||||
And A git repository exists
|
|
||||||
|
|
||||||
Scenario: Search file inside repository
|
|
||||||
Given User has permission to read and write repository
|
|
||||||
When User visits repository
|
|
||||||
And User performs file search inside repository
|
|
||||||
Then The search results are found
|
|
||||||
@@ -22,4 +22,38 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export * from "@scm-manager/integration-test-runner/steps";
|
import { hri } from "human-readable-ids";
|
||||||
|
|
||||||
|
describe("Repository File Search", () => {
|
||||||
|
let username: string;
|
||||||
|
let password: string;
|
||||||
|
let namespace: string;
|
||||||
|
let name: string;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
// Create user and login
|
||||||
|
username = hri.random();
|
||||||
|
password = hri.random();
|
||||||
|
cy.restCreateUser(username, password);
|
||||||
|
cy.restLogin(username, password);
|
||||||
|
|
||||||
|
// Create repo
|
||||||
|
namespace = hri.random();
|
||||||
|
name = hri.random();
|
||||||
|
cy.restCreateRepo("git", namespace, name, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should search file inside repository", () => {
|
||||||
|
// Arrange
|
||||||
|
cy.restSetUserRepositoryRole(username, namespace, name, "WRITE");
|
||||||
|
|
||||||
|
// Act
|
||||||
|
cy.visit(`/repo/${namespace}/${name}/code/sources`);
|
||||||
|
cy.byTestId("file_search_button").click();
|
||||||
|
cy.url().should("include", `/repo/${namespace}/${name}/code/search/main?q=`);
|
||||||
|
cy.byTestId("file_search_filter_input").type("README");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
cy.byTestId("file_search_single_result").contains("README.md");
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -22,4 +22,6 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = require("@scm-manager/integration-test-runner/plugins");
|
// This file was generated, please DO NOT EDIT THIS FILE!
|
||||||
|
import register from "@scm-manager/integration-test-runner/plugins";
|
||||||
|
export default register;
|
||||||
@@ -21,5 +21,7 @@
|
|||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// This file was generated, please DO NOT EDIT THIS FILE
|
||||||
import "@scm-manager/integration-test-runner/commands";
|
import "@scm-manager/integration-test-runner/commands";
|
||||||
import "./commands";
|
import "./commands";
|
||||||
9
scm-ui/e2e-tests/cypress/tsconfig.json
Normal file
9
scm-ui/e2e-tests/cypress/tsconfig.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"noEmit": true,
|
||||||
|
"target": "es5",
|
||||||
|
"lib": ["es5", "dom"],
|
||||||
|
"types": ["cypress"]
|
||||||
|
},
|
||||||
|
"include": ["**/*.ts"]
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ffmpeg-installer/ffmpeg": "^1.0.20",
|
"@ffmpeg-installer/ffmpeg": "^1.0.20",
|
||||||
"@scm-manager/integration-test-runner": "^1.3.7",
|
"@scm-manager/integration-test-runner": "^3.0.0",
|
||||||
"fluent-ffmpeg": "^2.1.2"
|
"fluent-ffmpeg": "^2.1.2"
|
||||||
},
|
},
|
||||||
"prettier": "@scm-manager/prettier-config",
|
"prettier": "@scm-manager/prettier-config",
|
||||||
|
|||||||
Reference in New Issue
Block a user