fix: fix cypress error (#1817)

* fix: fix cypress error

* fix: fix cypress error

* fix: fix cypress error

* fix: fix cypress error

* fix: fix cypress error

* fix: fix cypress error

* fix: fix cypress error

* fix: fix cypress error

* fix: fix cypress error
This commit is contained in:
jakiuncle 2023-05-09 20:51:07 +08:00 committed by GitHub
parent cb542ae46a
commit 7df043fb15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 18 additions and 44 deletions

View File

@ -1,16 +1,14 @@
describe('Test adapter', () => {
beforeEach(()=>{
cy.visit("http://localhost:7001");
cy.login();
})
const selector = {
add: ".ant-table-title > div > .ant-btn"
};
it("test adapter", () => {
cy.visit("http://localhost:7001");
cy.visit("http://localhost:7001/adapters");
cy.url().should("eq", "http://localhost:7001/adapters");
cy.get(selector.add).click();
cy.get(selector.add,{timeout:10000}).click();
cy.url().should("include","http://localhost:7001/adapters/built-in/")
});
})

View File

@ -1,6 +1,5 @@
describe('Test aplication', () => {
beforeEach(()=>{
cy.visit("http://localhost:7001");
cy.login();
})
it("test aplication", () => {

View File

@ -1,6 +1,5 @@
describe('Test certs', () => {
beforeEach(()=>{
cy.visit("http://localhost:7001");
cy.login();
})
it("test certs", () => {

View File

@ -1,6 +1,5 @@
describe('Test models', () => {
beforeEach(()=>{
cy.visit("http://localhost:7001");
cy.login();
})
it("test org", () => {

View File

@ -1,6 +1,5 @@
describe('Test Orgnazition', () => {
beforeEach(()=>{
cy.visit("http://localhost:7001");
cy.login();
})
it("test org", () => {

View File

@ -1,16 +1,14 @@
describe('Test payments', () => {
beforeEach(()=>{
cy.visit("http://localhost:7001");
cy.login();
})
const selector = {
add: ".ant-table-title > div > .ant-btn"
};
it("test payments", () => {
cy.visit("http://localhost:7001");
cy.visit("http://localhost:7001/payments");
cy.url().should("eq", "http://localhost:7001/payments");
cy.get(selector.add).click();
cy.get(selector.add,{timeout:10000}).click();
cy.url().should("include","http://localhost:7001/payments/")
});
})

View File

@ -1,6 +1,5 @@
describe('Test permissions', () => {
beforeEach(()=>{
cy.visit("http://localhost:7001");
cy.login();
})
it("test permissions", () => {

View File

@ -1,16 +1,14 @@
describe('Test products', () => {
beforeEach(()=>{
cy.visit("http://localhost:7001");
cy.login();
})
const selector = {
add: ".ant-table-title > div > .ant-btn > span"
};
it("test products", () => {
cy.visit("http://localhost:7001");
cy.visit("http://localhost:7001/products");
cy.url().should("eq", "http://localhost:7001/products");
cy.get(selector.add).click();
cy.get(selector.add,{timeout:10000}).click();
cy.url().should("include","http://localhost:7001/products/")
});
})

View File

@ -1,6 +1,5 @@
describe('Test providers', () => {
beforeEach(()=>{
cy.visit("http://localhost:7001");
cy.login();
})
it("test providers", () => {

View File

@ -1,6 +1,5 @@
describe('Test records', () => {
beforeEach(()=>{
cy.visit("http://localhost:7001");
cy.login();
})
it("test records", () => {

View File

@ -1,6 +1,5 @@
describe('Test resource', () => {
beforeEach(()=>{
cy.visit("http://localhost:7001");
cy.login();
})
it("test resource", () => {

View File

@ -1,6 +1,5 @@
describe('Test roles', () => {
beforeEach(()=>{
cy.visit("http://localhost:7001");
cy.login();
})
it("test role", () => {

View File

@ -1,6 +1,5 @@
describe('Test sessions', () => {
beforeEach(()=>{
cy.visit("http://localhost:7001");
cy.login();
})
it("test sessions", () => {

View File

@ -1,16 +1,14 @@
describe('Test syncers', () => {
beforeEach(()=>{
cy.visit("http://localhost:7001");
cy.login();
})
const selector = {
add: ".ant-table-title > div > .ant-btn"
};
it("test syncers", () => {
cy.visit("http://localhost:7001");
cy.visit("http://localhost:7001/syncers");
cy.url().should("eq", "http://localhost:7001/syncers");
cy.get(selector.add).click();
cy.get(selector.add,{timeout:10000}).click();
cy.url().should("include","http://localhost:7001/syncers/")
});
})

View File

@ -1,6 +1,5 @@
describe('Test sysinfo', () => {
beforeEach(()=>{
cy.visit("http://localhost:7001");
cy.login();
})
it("test sysinfo", () => {

View File

@ -1,16 +1,14 @@
describe('Test tokens', () => {
beforeEach(()=>{
cy.visit("http://localhost:7001");
cy.login();
})
const selector = {
add: ".ant-table-title > div > .ant-btn"
};
it("test records", () => {
cy.visit("http://localhost:7001");
cy.visit("http://localhost:7001/tokens");
cy.url().should("eq", "http://localhost:7001/tokens");
cy.get(selector.add).click();
cy.get(selector.add,{timeout:10000}).click();
cy.url().should("include","http://localhost:7001/tokens/")
});
})

View File

@ -1,6 +1,5 @@
describe('Test User', () => {
beforeEach(()=>{
cy.visit("http://localhost:7001");
cy.login();
})
it("test user", () => {

View File

@ -7,10 +7,10 @@ describe('Test webhooks', () => {
add: ".ant-table-title > div > .ant-btn"
};
it("test webhooks", () => {
cy.visit("http://localhost:7001");
cy.visit("http://localhost:7001/webhooks");
cy.url().should("eq", "http://localhost:7001/webhooks");
cy.get(selector.add).click();
cy.url().should("include","http://localhost:7001/webhooks/")
cy.get(selector.add,{timeout:10000}).click();
cy.url().should("include","http://localhost:7001/webhooks/");
});
})

View File

@ -23,19 +23,15 @@
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
const selector = {
username: "#input",
password: "#normal_login_password",
loginButton: ".ant-btn",
};
Cypress.Commands.add('login', ()=>{
cy.request({
method: "POST",
url: "http://localhost:7001/api/login",
body: {
"application": "app-built-in",
"organization": "built-in",
"username": "admin",
"password": "123",
"autoSignin": true,
"type": "login",
},
}).then((Response) => {
expect(Response).property("body").property("status").to.equal("ok");
});
cy.visit("http://localhost:7001");
cy.get(selector.username).type("admin");
cy.get(selector.password).type("123");
cy.get(selector.loginButton).click();
cy.url().should("eq", "http://localhost:7001/");
})