Skip to content

Commit 2d2ed9c

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/cypress-test-config' into cypress-test-config
2 parents 8818472 + 55bff8d commit 2d2ed9c

File tree

4 files changed

+64
-28
lines changed

4 files changed

+64
-28
lines changed

Diff for: cypress.config.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,21 @@ module.exports = defineConfig({
1414
// You may want to clean this up later by importing these.
1515
setupNodeEvents(on, config) {
1616
on("before:browser:launch", (browser, launchOptions) => {
17-
if (browser.name === "chrome" && browser.isHeadless) {
18-
launchOptions.args.push("--headless=old");
19-
}
17+
// if (browser.name === "chrome" && browser.isHeadless) {
18+
// launchOptions.args.push("--headless=old");
19+
// }
2020

2121
return launchOptions;
2222
});
2323

2424
return require("./cypress/plugins/index.js")(on, config);
2525
},
26+
browser: "electron",
2627
baseUrl: "http://8-f48cf3a682-7fthvk.manager.dev.zesty.io:8080/",
2728
specPattern: "cypress/e2e/**/*.{js,jsx,ts,tsx}",
2829
testIsolation: false,
2930
},
30-
defaultCommandTimeout: 30_000,
31-
responseTimeout: 60_000,
31+
defaultCommandTimeout: 50_000,
32+
responseTimeout: 90_000,
3233
retries: 1,
33-
experimentalMemoryManagement: true,
34-
chromeWebSecurity: false,
3534
});

Diff for: cypress/e2e/settings/workflows.spec.js

+19-19
Original file line numberDiff line numberDiff line change
@@ -492,25 +492,25 @@ Cypress.Commands.add("getStatusLabels", () => {
492492
});
493493
});
494494

495-
Cypress.Commands.add(
496-
"apiRequest",
497-
({ method = "GET", url = "", body = undefined }) => {
498-
return cy.getCookie(Cypress.env("COOKIE_NAME")).then((cookie) => {
499-
const token = cookie?.value;
500-
return cy
501-
.request({
502-
url,
503-
method,
504-
headers: { authorization: `Bearer ${token}` },
505-
...(body ? { body: body } : {}),
506-
})
507-
.then((response) => ({
508-
status: response?.isOkStatusCode ? "success" : "error",
509-
data: response?.body?.data,
510-
}));
511-
});
512-
}
513-
);
495+
// Cypress.Commands.add(
496+
// "apiRequest",
497+
// ({ method = "GET", url = "", body = undefined }) => {
498+
// return cy.getCookie(Cypress.env("COOKIE_NAME")).then((cookie) => {
499+
// const token = cookie?.value;
500+
// return cy
501+
// .request({
502+
// url,
503+
// method,
504+
// headers: { authorization: `Bearer ${token}` },
505+
// ...(body ? { body: body } : {}),
506+
// })
507+
// .then((response) => ({
508+
// status: response?.isOkStatusCode ? "success" : "error",
509+
// data: response?.body?.data,
510+
// }));
511+
// });
512+
// }
513+
// );
514514

515515
function parseStatusLabels(statusLabels) {
516516
const { active, deactivated } = statusLabels?.reduce(

Diff for: cypress/support/commands.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ Cypress.Commands.add("login", () => {
88
.request({
99
url: `${Cypress.env("API_AUTH")}/login`,
1010
method: "POST",
11-
credentials: "include",
1211
body: formBody,
1312
})
1413
.then(async (res) => {
1514
const response = await new Response(res.body).json();
1615
// We need the cookie value returned reset so it is unsecure and
1716
// accessible by javascript
1817
cy.setCookie(Cypress.env("COOKIE_NAME"), response.meta.token);
18+
})
19+
.then(() => {
20+
return cy.get("body"); // Return a Chainable<JQuery<HTMLElement>>
1921
});
2022
});
2123

@@ -30,7 +32,7 @@ Cypress.Commands.add("waitOn", (path, cb) => {
3032
cy.blockAnnouncements();
3133
cb();
3234
cy.wait("@waitingOn", {
33-
timeout: 30000,
35+
timeout: 80_000,
3436
});
3537
});
3638

Diff for: cypress/support/index.ts

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import "./commands";
2+
3+
declare global {
4+
namespace Cypress {
5+
interface Chainable {
6+
waitOn(path: string, cb: () => void): Chainable<JQuery<HTMLElement>>;
7+
login(): Chainable<JQuery<HTMLElement>>;
8+
getBySelector(
9+
selector: string,
10+
...args: any[]
11+
): Chainable<JQuery<HTMLElement>>;
12+
blockLock(): Chainable<JQuery<HTMLElement>>;
13+
assertClipboardValue(value: string): Chainable<JQuery<HTMLElement>>;
14+
blockAnnouncements(): Chainable<JQuery<HTMLElement>>;
15+
apiRequest(params: {
16+
url: string;
17+
method?: "GET" | "POST" | "PUT" | "DELETE";
18+
body?: any;
19+
}): Chainable<{
20+
status: "success" | "error";
21+
data: any;
22+
}>;
23+
goToWorkflowsPage(): Chainable<void>;
24+
cleanTestData(): Chainable<void>;
25+
moreActionEdit(label: string): Chainable<void>;
26+
moreActionDeactivate(label: string): Chainable<void>;
27+
createTestData(): Chainable<void>;
28+
getStatusLabels(): Chainable<any>;
29+
parseStatusLabels(statusLabels: any): {
30+
active: any[];
31+
deactivated: any[];
32+
};
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)