mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
feat: Test whether the page can be accessed (#1517)
* feat: add new line * feat: Test whether the page can be accessed * feat: Change the e2e order * feat: add Test Retries * feat: change yarn.lock * feat: add new line
This commit is contained in:
parent
19e7d0b0bd
commit
fdccb8b22b
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -79,7 +79,7 @@ jobs:
|
||||
e2e:
|
||||
name: e2e-test
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ frontend, backend, linter ]
|
||||
needs: [ go-tests ]
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
|
@ -1,7 +1,10 @@
|
||||
module.exports = {
|
||||
const { defineConfig } = require("cypress");
|
||||
|
||||
module.exports = defineConfig({
|
||||
e2e: {
|
||||
setupNodeEvents(on, config) {
|
||||
// implement node event listeners here
|
||||
},
|
||||
"retries": {
|
||||
"runMode": 2,
|
||||
"openMode": 0
|
||||
}
|
||||
},
|
||||
};
|
||||
});
|
||||
|
16
web/cypress/e2e/adapter.cy.js
Normal file
16
web/cypress/e2e/adapter.cy.js
Normal file
@ -0,0 +1,16 @@
|
||||
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.url().should("include","http://localhost:7001/adapters/built-in/")
|
||||
});
|
||||
})
|
13
web/cypress/e2e/application.cy.js
Normal file
13
web/cypress/e2e/application.cy.js
Normal file
@ -0,0 +1,13 @@
|
||||
describe('Test aplication', () => {
|
||||
beforeEach(()=>{
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.login();
|
||||
})
|
||||
it("test aplication", () => {
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.visit("http://localhost:7001/applications");
|
||||
cy.url().should("eq", "http://localhost:7001/applications");
|
||||
cy.visit("http://localhost:7001/applications/built-in/app-built-in");
|
||||
cy.url().should("eq", "http://localhost:7001/applications/built-in/app-built-in");
|
||||
});
|
||||
})
|
13
web/cypress/e2e/certs.cy.js
Normal file
13
web/cypress/e2e/certs.cy.js
Normal file
@ -0,0 +1,13 @@
|
||||
describe('Test certs', () => {
|
||||
beforeEach(()=>{
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.login();
|
||||
})
|
||||
it("test certs", () => {
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.visit("http://localhost:7001/certs");
|
||||
cy.url().should("eq", "http://localhost:7001/certs");
|
||||
cy.visit("http://localhost:7001/certs/cert-built-in");
|
||||
cy.url().should("eq", "http://localhost:7001/certs/cert-built-in");
|
||||
});
|
||||
})
|
13
web/cypress/e2e/models.cy.js
Normal file
13
web/cypress/e2e/models.cy.js
Normal file
@ -0,0 +1,13 @@
|
||||
describe('Test models', () => {
|
||||
beforeEach(()=>{
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.login();
|
||||
})
|
||||
it("test org", () => {
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.visit("http://localhost:7001/models");
|
||||
cy.url().should("eq", "http://localhost:7001/models");
|
||||
cy.visit("http://localhost:7001/models/built-in/model-built-in");
|
||||
cy.url().should("eq", "http://localhost:7001/models/built-in/model-built-in");
|
||||
});
|
||||
})
|
15
web/cypress/e2e/orgnazition.cy.js
Normal file
15
web/cypress/e2e/orgnazition.cy.js
Normal file
@ -0,0 +1,15 @@
|
||||
describe('Test Orgnazition', () => {
|
||||
beforeEach(()=>{
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.login();
|
||||
})
|
||||
it("test org", () => {
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.visit("http://localhost:7001/organizations");
|
||||
cy.url().should("eq", "http://localhost:7001/organizations");
|
||||
cy.visit("http://localhost:7001/organizations/built-in");
|
||||
cy.url().should("eq", "http://localhost:7001/organizations/built-in");
|
||||
cy.visit("http://localhost:7001/organizations/built-in/users");
|
||||
cy.url().should("eq", "http://localhost:7001/organizations/built-in/users");
|
||||
});
|
||||
})
|
16
web/cypress/e2e/payments.cy.js
Normal file
16
web/cypress/e2e/payments.cy.js
Normal file
@ -0,0 +1,16 @@
|
||||
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.url().should("include","http://localhost:7001/payments/")
|
||||
});
|
||||
})
|
13
web/cypress/e2e/permissions.cy.js
Normal file
13
web/cypress/e2e/permissions.cy.js
Normal file
@ -0,0 +1,13 @@
|
||||
describe('Test permissions', () => {
|
||||
beforeEach(()=>{
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.login();
|
||||
})
|
||||
it("test permissions", () => {
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.visit("http://localhost:7001/permissions");
|
||||
cy.url().should("eq", "http://localhost:7001/permissions");
|
||||
cy.visit("http://localhost:7001/permissions/built-in/permission-built-in");
|
||||
cy.url().should("eq", "http://localhost:7001/permissions/built-in/permission-built-in");
|
||||
});
|
||||
})
|
16
web/cypress/e2e/products.cy.js
Normal file
16
web/cypress/e2e/products.cy.js
Normal file
@ -0,0 +1,16 @@
|
||||
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.url().should("include","http://localhost:7001/products/")
|
||||
});
|
||||
})
|
13
web/cypress/e2e/providers.cy.js
Normal file
13
web/cypress/e2e/providers.cy.js
Normal file
@ -0,0 +1,13 @@
|
||||
describe('Test providers', () => {
|
||||
beforeEach(()=>{
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.login();
|
||||
})
|
||||
it("test providers", () => {
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.visit("http://localhost:7001/providers");
|
||||
cy.url().should("eq", "http://localhost:7001/providers");
|
||||
cy.visit("http://localhost:7001/providers/admin/provider_captcha_default");
|
||||
cy.url().should("eq", "http://localhost:7001/providers/admin/provider_captcha_default");
|
||||
});
|
||||
})
|
11
web/cypress/e2e/records.cy.js
Normal file
11
web/cypress/e2e/records.cy.js
Normal file
@ -0,0 +1,11 @@
|
||||
describe('Test records', () => {
|
||||
beforeEach(()=>{
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.login();
|
||||
})
|
||||
it("test records", () => {
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.visit("http://localhost:7001/records");
|
||||
cy.url().should("eq", "http://localhost:7001/records");
|
||||
});
|
||||
})
|
11
web/cypress/e2e/resource.cy.js
Normal file
11
web/cypress/e2e/resource.cy.js
Normal file
@ -0,0 +1,11 @@
|
||||
describe('Test resource', () => {
|
||||
beforeEach(()=>{
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.login();
|
||||
})
|
||||
it("test resource", () => {
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.visit("http://localhost:7001/resources");
|
||||
cy.url().should("eq", "http://localhost:7001/resources");
|
||||
});
|
||||
})
|
11
web/cypress/e2e/role.cy.js
Normal file
11
web/cypress/e2e/role.cy.js
Normal file
@ -0,0 +1,11 @@
|
||||
describe('Test roles', () => {
|
||||
beforeEach(()=>{
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.login();
|
||||
})
|
||||
it("test role", () => {
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.visit("http://localhost:7001/roles");
|
||||
cy.url().should("eq", "http://localhost:7001/roles");
|
||||
});
|
||||
})
|
11
web/cypress/e2e/sessions.cy.js
Normal file
11
web/cypress/e2e/sessions.cy.js
Normal file
@ -0,0 +1,11 @@
|
||||
describe('Test sessions', () => {
|
||||
beforeEach(()=>{
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.login();
|
||||
})
|
||||
it("test sessions", () => {
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.visit("http://localhost:7001/sessions");
|
||||
cy.url().should("eq", "http://localhost:7001/sessions");
|
||||
});
|
||||
})
|
16
web/cypress/e2e/syncers.cy.js
Normal file
16
web/cypress/e2e/syncers.cy.js
Normal file
@ -0,0 +1,16 @@
|
||||
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.url().should("include","http://localhost:7001/syncers/")
|
||||
});
|
||||
})
|
11
web/cypress/e2e/sysinfo.cy.js
Normal file
11
web/cypress/e2e/sysinfo.cy.js
Normal file
@ -0,0 +1,11 @@
|
||||
describe('Test sysinfo', () => {
|
||||
beforeEach(()=>{
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.login();
|
||||
})
|
||||
it("test sysinfo", () => {
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.visit("http://localhost:7001/sysinfo");
|
||||
cy.url().should("eq", "http://localhost:7001/sysinfo");
|
||||
});
|
||||
})
|
16
web/cypress/e2e/tokens.cy.js
Normal file
16
web/cypress/e2e/tokens.cy.js
Normal file
@ -0,0 +1,16 @@
|
||||
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.url().should("include","http://localhost:7001/tokens/")
|
||||
});
|
||||
})
|
13
web/cypress/e2e/user.cy.js
Normal file
13
web/cypress/e2e/user.cy.js
Normal file
@ -0,0 +1,13 @@
|
||||
describe('Test User', () => {
|
||||
beforeEach(()=>{
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.login();
|
||||
})
|
||||
it("test user", () => {
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.visit("http://localhost:7001/users");
|
||||
cy.url().should("eq", "http://localhost:7001/users");
|
||||
cy.visit("http://localhost:7001/users/built-in/admin");
|
||||
cy.url().should("eq", "http://localhost:7001/users/built-in/admin");
|
||||
});
|
||||
})
|
16
web/cypress/e2e/webhooks.cy.js
Normal file
16
web/cypress/e2e/webhooks.cy.js
Normal file
@ -0,0 +1,16 @@
|
||||
describe('Test webhooks', () => {
|
||||
beforeEach(()=>{
|
||||
cy.visit("http://localhost:7001");
|
||||
cy.login();
|
||||
})
|
||||
const selector = {
|
||||
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/")
|
||||
});
|
||||
})
|
@ -23,3 +23,20 @@
|
||||
//
|
||||
// -- This will overwrite an existing command --
|
||||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
||||
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",
|
||||
"phonePrefix": "86",
|
||||
},
|
||||
}).then((Response) => {
|
||||
expect(Response).property("body").property("status").to.equal("ok");
|
||||
});
|
||||
})
|
||||
|
@ -69,6 +69,7 @@
|
||||
"@babel/eslint-parser": "^7.18.9",
|
||||
"@babel/preset-react": "^7.18.6",
|
||||
"cross-env": "^7.0.3",
|
||||
"cypress": "^12.5.1",
|
||||
"eslint": "8.22.0",
|
||||
"eslint-plugin-react": "^7.31.1",
|
||||
"husky": "^4.3.8",
|
||||
|
572
web/yarn.lock
572
web/yarn.lock
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user