mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-08 13:51:32 +08:00
Move Cypress directory and convert it to JavaScript (#2170)
This commit is contained in:
18
test/cypress/e2e/setup.cy.js
Normal file
18
test/cypress/e2e/setup.cy.js
Normal file
@@ -0,0 +1,18 @@
|
||||
const actor = require("../support/actors/actor");
|
||||
const userData = require("../support/const/user-data");
|
||||
const dashboardPage = require("../support/pages/dashboard-page");
|
||||
const setupPage = require("../support/pages/setup-page");
|
||||
|
||||
describe("user can create a new account on setup page", () => {
|
||||
before(() => {
|
||||
cy.visit("/setup");
|
||||
});
|
||||
it("user can create new account", () => {
|
||||
cy.url().should("be.equal", setupPage.SetupPage.url);
|
||||
actor.actor.setupTask.fillAndSubmitSetupForm(userData.DEFAULT_USER_DATA.username, userData.DEFAULT_USER_DATA.password, userData.DEFAULT_USER_DATA.password);
|
||||
cy.url().should("be.equal", dashboardPage.DashboardPage.url);
|
||||
cy.get('[role="alert"]')
|
||||
.should("be.visible")
|
||||
.and("contain.text", "Added Successfully.");
|
||||
});
|
||||
});
|
0
test/cypress/plugins/index.js
Normal file
0
test/cypress/plugins/index.js
Normal file
8
test/cypress/support/actors/actor.js
Normal file
8
test/cypress/support/actors/actor.js
Normal file
@@ -0,0 +1,8 @@
|
||||
const setupTask = require("../tasks/setup-task");
|
||||
class Actor {
|
||||
constructor() {
|
||||
this.setupTask = new setupTask.SetupTask();
|
||||
}
|
||||
}
|
||||
const actor = new Actor();
|
||||
exports.actor = actor;
|
0
test/cypress/support/commands.js
Normal file
0
test/cypress/support/commands.js
Normal file
4
test/cypress/support/const/user-data.js
Normal file
4
test/cypress/support/const/user-data.js
Normal file
@@ -0,0 +1,4 @@
|
||||
exports.DEFAULT_USER_DATA = {
|
||||
username: "testuser",
|
||||
password: "testuser123",
|
||||
};
|
1
test/cypress/support/e2e.js
Normal file
1
test/cypress/support/e2e.js
Normal file
@@ -0,0 +1 @@
|
||||
require("./commands");
|
3
test/cypress/support/pages/dashboard-page.js
Normal file
3
test/cypress/support/pages/dashboard-page.js
Normal file
@@ -0,0 +1,3 @@
|
||||
exports.DashboardPage = {
|
||||
url: Cypress.env("baseUrl") + "/dashboard",
|
||||
};
|
7
test/cypress/support/pages/setup-page.js
Normal file
7
test/cypress/support/pages/setup-page.js
Normal file
@@ -0,0 +1,7 @@
|
||||
exports.SetupPage = {
|
||||
url: Cypress.env("baseUrl") + "/setup",
|
||||
usernameInput: '[data-cy="username-input"]',
|
||||
passWordInput: '[data-cy="password-input"]',
|
||||
passwordRepeatInput: '[data-cy="password-repeat-input"]',
|
||||
submitSetupForm: '[data-cy="submit-setup-form"]',
|
||||
};
|
11
test/cypress/support/tasks/setup-task.js
Normal file
11
test/cypress/support/tasks/setup-task.js
Normal file
@@ -0,0 +1,11 @@
|
||||
const setupPage = require("../pages/setup-page");
|
||||
|
||||
class SetupTask {
|
||||
fillAndSubmitSetupForm(username, password, passwordRepeat) {
|
||||
cy.get(setupPage.SetupPage.usernameInput).type(username);
|
||||
cy.get(setupPage.SetupPage.passWordInput).type(password);
|
||||
cy.get(setupPage.SetupPage.passwordRepeatInput).type(passwordRepeat);
|
||||
cy.get(setupPage.SetupPage.submitSetupForm).click();
|
||||
}
|
||||
}
|
||||
exports.SetupTask = SetupTask;
|
Reference in New Issue
Block a user