mirror of
https://github.com/HangarMC/Hangar.git
synced 2024-11-21 01:21:54 +08:00
test(e2e): make sure they api requests actually complete
This commit is contained in:
parent
06c71a9d70
commit
6ef34b40ed
1
.github/workflows/e2e.yml
vendored
1
.github/workflows/e2e.yml
vendored
@ -64,4 +64,5 @@ jobs:
|
||||
BROWSERSTACK_DEBUG: ${{ github.event.inputs.debug || false }}
|
||||
E2E_PASSWORD: ${{ secrets.E2E_PASSWORD }}
|
||||
E2E_TOTP_SECRET: ${{ secrets.E2E_TOTP_SECRET }}
|
||||
E2E_API_KEY: ${{ secrets.E2E_API_KEY }}
|
||||
run: (cd e2e && pnpm run browserstack-multiple)
|
||||
|
1
e2e/.gitignore
vendored
1
e2e/.gitignore
vendored
@ -4,3 +4,4 @@ package-lock.json
|
||||
local.log
|
||||
.env
|
||||
output
|
||||
test.http
|
||||
|
@ -1,6 +1,7 @@
|
||||
const { I } = inject();
|
||||
const { TOTP } = require("totp-generator");
|
||||
const { jwtDecode } = require("jwt-decode");
|
||||
const { expect } = require("chai");
|
||||
|
||||
module.exports = new (class {
|
||||
url = process.env.BROWSERSTACK_LOCAL === "true" ? "http://localhost:3333" : "https://hangar.papermc.dev";
|
||||
@ -40,6 +41,11 @@ module.exports = new (class {
|
||||
method: "POST",
|
||||
});
|
||||
const json = await result.json();
|
||||
if (result.status != 200) {
|
||||
console.log(json);
|
||||
}
|
||||
expect(result.status, "JWT Authentication should return status 200").to.equal(200);
|
||||
expect(json.token, "JWT Authentication should return a jwt").to.be.ok;
|
||||
this.jwt = json.token;
|
||||
return this.jwt;
|
||||
}
|
||||
@ -61,6 +67,10 @@ module.exports = new (class {
|
||||
headers: { Authorization: "Bearer " + (await this.getJwt()), "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ content: "E2E" }),
|
||||
});
|
||||
if (result.status != 204) {
|
||||
console.log(await result.text());
|
||||
}
|
||||
expect(result.status, "project deletion to return 200").to.equal(204);
|
||||
}
|
||||
|
||||
public async deleteOrg(name: string) {
|
||||
@ -69,6 +79,9 @@ module.exports = new (class {
|
||||
headers: { Authorization: "Bearer " + (await this.getJwt()), "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ content: "E2E" }),
|
||||
});
|
||||
console.log(await result.text());
|
||||
if (result.status != 200) {
|
||||
console.log(await result.text());
|
||||
}
|
||||
expect(result.status, "org deletion to return 200").to.equal(200);
|
||||
}
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user