forked from guildxyz/guild.xyz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cypress.config.ts
53 lines (52 loc) · 1.88 KB
/
cypress.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// eslint-disable-next-line import/no-extraneous-dependencies
import { defineConfig } from "cypress"
import fs from "fs"
export default defineConfig({
e2e: {
retries: 1,
experimentalMemoryManagement: true,
video: true,
baseUrl: "http://localhost:3000",
userAgent: "cypress",
specPattern: "./cypress/e2e/**/*.spec.ts",
defaultCommandTimeout: 15_000,
requestTimeout: 15_000,
env: {
guildApiV1Url: "https://api.guild.xyz/v1",
guildApiUrl: "https://api.guild.xyz/v2",
userAddress: "0x304Def656Babc745c53782639D3CaB00aCe8C843",
platformlessGuildName: "Platformless Cypress Gang",
platformlessGuildUrlName: "platformless-cypress-gang",
guildName: "Cypress Gang",
guildUrlName: "cypress-gang",
dcClientId: "868172385000509460",
dcServerId: "1096417797292171365", // We'll delete the created roles in this Discord server
tgId: "-1001653099938",
RUN_ID: "localhost",
TEST_GUILD_URL_NAME: "guild-e2e-cypress",
GUILD_CHECKOUT_TEST_GUILD_URL_NAME: "guild-checkout-e2e-cypress",
PINATA_PIN_FILE_API_URL: "https://api.pinata.cloud/pinning/pinFileToIPFS",
},
setupNodeEvents(on, config) {
on(
"after:spec",
(spec: Cypress.Spec, results: CypressCommandLine.RunResult) => {
if (results && results.video) {
// Do we have failures for any retry attempts?
const failures = results.tests.some((test) =>
test.attempts.some((attempt) => attempt.state === "failed")
)
if (!failures) {
// delete the video if the spec passed and no tests retried
try {
fs.unlinkSync(results.video)
} catch (unlinkSyncError) {
console.log("[WARNING] fs.unlinkSync error", unlinkSyncError)
}
}
}
}
)
},
},
})