mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
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:
parent
cb542ae46a
commit
7df043fb15
@ -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/")
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
@ -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", () => {
|
||||||
|
@ -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", () => {
|
||||||
|
@ -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", () => {
|
||||||
|
@ -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", () => {
|
||||||
|
@ -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/")
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
@ -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", () => {
|
||||||
|
@ -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/")
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
@ -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", () => {
|
||||||
|
@ -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", () => {
|
||||||
|
@ -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", () => {
|
||||||
|
@ -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", () => {
|
||||||
|
@ -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", () => {
|
||||||
|
@ -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/")
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
@ -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", () => {
|
||||||
|
@ -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/")
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
@ -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", () => {
|
||||||
|
@ -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/");
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
@ -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");
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user