💚 Further cypress adjustments
This commit is contained in:
1 parent
19c9b4eadd
commit
4613cab9bb
3 files changed
+25
-13
No files matched your search
@@ -6,5 +6,6 @@
|
||||
"pluginsFile": "plugins/index.js",
|
||||
"supportFile": "support/index.js",
|
||||
"screenshotsFolder": "screenshots",
|
||||
"videosFolder": "videos"
|
||||
"videosFolder": "videos",
|
||||
"modifyObstructiveCode": false
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
import {prepare_server, login, await_coreui} from "../util/util";
|
||||
import {prepare_server, login, ensure_file_unknown, await_coreui} from "../util/util";
|
||||
|
||||
context("Upload tests", () => {
|
||||
const username = "admin";
|
||||
const password = "test";
|
||||
const upload = "e2e-test.gcode";
|
||||
|
||||
beforeEach(() => {
|
||||
prepare_server();
|
||||
@@ -10,13 +11,16 @@ context("Upload tests", () => {
|
||||
// login
|
||||
login(username, password);
|
||||
|
||||
// clean up file if needed
|
||||
ensure_file_unknown("local", upload);
|
||||
|
||||
cy.visit("/");
|
||||
await_coreui();
|
||||
});
|
||||
|
||||
it("uploads file to local via button", () => {
|
||||
cy.get("[data-test-id=upload-local]").attachFile("e2e-test.gcode");
|
||||
cy.get("[data-test-id=upload-local]").attachFile(upload);
|
||||
cy.wait("@files");
|
||||
cy.get("[data-test-id=files-list]").contains("e2e-test.gcode");
|
||||
cy.get("[data-test-id=files-list]").contains(upload);
|
||||
});
|
||||
});
|
||||
@@ -1,13 +1,12 @@
|
||||
export const prepare_server = () => {
|
||||
cy.server();
|
||||
cy.route("POST", "/api/login").as("login");
|
||||
cy.route("POST", "/api/logout").as("logout");
|
||||
cy.route("GET", "/api/settings").as("settings");
|
||||
cy.route("GET", "/api/files?recursive=true").as("files");
|
||||
cy.route("GET", "/plugin/softwareupdate/check").as("softwareupdate");
|
||||
cy.route("GET", "/plugin/pluginmanager/plugins").as("pluginmanager");
|
||||
cy.route("POST", "/api/connection").as("connectionCommand");
|
||||
cy.route("GET", "/api/connection").as("connectionDetails");
|
||||
cy.intercept("POST", "/api/login").as("login");
|
||||
cy.intercept("POST", "/api/logout").as("logout");
|
||||
cy.intercept("GET", "/api/settings").as("settings");
|
||||
cy.intercept("GET", "/api/files?recursive=true").as("files");
|
||||
cy.intercept("GET", "/plugin/softwareupdate/check").as("softwareupdate");
|
||||
cy.intercept("GET", "/plugin/pluginmanager/plugins").as("pluginmanager");
|
||||
cy.intercept("POST", "/api/connection").as("connectionCommand");
|
||||
cy.intercept("GET", "/api/connection").as("connectionDetails");
|
||||
};
|
||||
|
||||
export const await_loginui = () => {
|
||||
@@ -63,3 +62,11 @@ export const disconnect = () => {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const ensure_file_unknown = (location, name) => {
|
||||
cy.request({
|
||||
method: "DELETE",
|
||||
url: `/api/files/${location}/${name}`,
|
||||
failOnStatusCode: false
|
||||
});
|
||||
};
|
||||
Reference in new issue
Block a user