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', () => { describe('Test adapter', () => {
beforeEach(()=>{ beforeEach(()=>{
cy.visit("http://localhost:7001");
cy.login(); cy.login();
}) })
const selector = { const selector = {
add: ".ant-table-title > div > .ant-btn" add: ".ant-table-title > div > .ant-btn"
}; };
it("test adapter", () => { it("test adapter", () => {
cy.visit("http://localhost:7001");
cy.visit("http://localhost:7001/adapters"); cy.visit("http://localhost:7001/adapters");
cy.url().should("eq", "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/") cy.url().should("include","http://localhost:7001/adapters/built-in/")
}); });
}) })

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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