mirror of
https://github.com/umami-software/umami.git
synced 2026-02-19 20:15:41 +01:00
Rebrand to Syncfuse
This commit is contained in:
parent
0a09df5470
commit
92025c9dba
144 changed files with 1796 additions and 1977 deletions
|
|
@ -1,123 +1,123 @@
|
|||
/// <reference types="cypress" />
|
||||
import { uuid } from '../../src/lib/crypto';
|
||||
import { uuid } from "../../src/lib/crypto";
|
||||
|
||||
Cypress.Commands.add('getDataTest', (value: string) => {
|
||||
Cypress.Commands.add("getDataTest", (value: string) => {
|
||||
return cy.get(`[data-test=${value}]`);
|
||||
});
|
||||
|
||||
Cypress.Commands.add('logout', () => {
|
||||
cy.getDataTest('button-profile').click();
|
||||
cy.getDataTest('item-logout').click();
|
||||
cy.url().should('eq', Cypress.config().baseUrl + '/login');
|
||||
Cypress.Commands.add("logout", () => {
|
||||
cy.getDataTest("button-profile").click();
|
||||
cy.getDataTest("item-logout").click();
|
||||
cy.url().should("eq", Cypress.config().baseUrl + "/login");
|
||||
});
|
||||
|
||||
Cypress.Commands.add('login', (username: string, password: string) => {
|
||||
Cypress.Commands.add("login", (username: string, password: string) => {
|
||||
cy.session([username, password], () => {
|
||||
cy.request({
|
||||
method: 'POST',
|
||||
url: '/api/auth/login',
|
||||
method: "POST",
|
||||
url: "/api/auth/login",
|
||||
body: {
|
||||
username,
|
||||
password,
|
||||
},
|
||||
})
|
||||
.then(response => {
|
||||
Cypress.env('authorization', `bearer ${response.body.token}`);
|
||||
window.localStorage.setItem('umami.auth', JSON.stringify(response.body.token));
|
||||
.then((response) => {
|
||||
Cypress.env("authorization", `bearer ${response.body.token}`);
|
||||
window.localStorage.setItem("syncfuse.auth", JSON.stringify(response.body.token));
|
||||
})
|
||||
.its('status')
|
||||
.should('eq', 200);
|
||||
.its("status")
|
||||
.should("eq", 200);
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('addWebsite', (name: string, domain: string) => {
|
||||
Cypress.Commands.add("addWebsite", (name: string, domain: string) => {
|
||||
cy.request({
|
||||
method: 'POST',
|
||||
url: '/api/websites',
|
||||
method: "POST",
|
||||
url: "/api/websites",
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: Cypress.env('authorization'),
|
||||
"Content-Type": "application/json",
|
||||
Authorization: Cypress.env("authorization"),
|
||||
},
|
||||
body: {
|
||||
id: uuid(),
|
||||
createdBy: '41e2b680-648e-4b09-bcd7-3e2b10c06264',
|
||||
createdBy: "41e2b680-648e-4b09-bcd7-3e2b10c06264",
|
||||
name: name,
|
||||
domain: domain,
|
||||
},
|
||||
}).then(response => {
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('deleteWebsite', (websiteId: string) => {
|
||||
Cypress.Commands.add("deleteWebsite", (websiteId: string) => {
|
||||
cy.request({
|
||||
method: 'DELETE',
|
||||
method: "DELETE",
|
||||
url: `/api/websites/${websiteId}`,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: Cypress.env('authorization'),
|
||||
"Content-Type": "application/json",
|
||||
Authorization: Cypress.env("authorization"),
|
||||
},
|
||||
}).then(response => {
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('addUser', (username: string, password: string, role: string) => {
|
||||
Cypress.Commands.add("addUser", (username: string, password: string, role: string) => {
|
||||
cy.request({
|
||||
method: 'POST',
|
||||
url: '/api/users',
|
||||
method: "POST",
|
||||
url: "/api/users",
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: Cypress.env('authorization'),
|
||||
"Content-Type": "application/json",
|
||||
Authorization: Cypress.env("authorization"),
|
||||
},
|
||||
body: {
|
||||
username: username,
|
||||
password: password,
|
||||
role: role,
|
||||
},
|
||||
}).then(response => {
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('deleteUser', (userId: string) => {
|
||||
Cypress.Commands.add("deleteUser", (userId: string) => {
|
||||
cy.request({
|
||||
method: 'DELETE',
|
||||
method: "DELETE",
|
||||
url: `/api/users/${userId}`,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: Cypress.env('authorization'),
|
||||
"Content-Type": "application/json",
|
||||
Authorization: Cypress.env("authorization"),
|
||||
},
|
||||
}).then(response => {
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('addTeam', (name: string) => {
|
||||
Cypress.Commands.add("addTeam", (name: string) => {
|
||||
cy.request({
|
||||
method: 'POST',
|
||||
url: '/api/teams',
|
||||
method: "POST",
|
||||
url: "/api/teams",
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: Cypress.env('authorization'),
|
||||
"Content-Type": "application/json",
|
||||
Authorization: Cypress.env("authorization"),
|
||||
},
|
||||
body: {
|
||||
name: name,
|
||||
},
|
||||
}).then(response => {
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('deleteTeam', (teamId: string) => {
|
||||
Cypress.Commands.add("deleteTeam", (teamId: string) => {
|
||||
cy.request({
|
||||
method: 'DELETE',
|
||||
method: "DELETE",
|
||||
url: `/api/teams/${teamId}`,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: Cypress.env('authorization'),
|
||||
"Content-Type": "application/json",
|
||||
Authorization: Cypress.env("authorization"),
|
||||
},
|
||||
}).then(response => {
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue