Skip to content

Commit

Permalink
Build(deps): Bump @cypress/request and cypress in /tests/frontend (#961)
Browse files Browse the repository at this point in the history
* Build(deps): Bump @cypress/request and cypress in /tests/frontend

Bumps [@cypress/request](https://github.com/cypress-io/request) to 3.0.1 and updates ancestor dependency [cypress](https://github.com/cypress-io/cypress). These dependencies need to be updated together.


Updates `@cypress/request` from 2.88.5 to 3.0.1
- [Release notes](https://github.com/cypress-io/request/releases)
- [Changelog](https://github.com/cypress-io/request/blob/master/CHANGELOG.md)
- [Commits](cypress-io/request@v2.88.5...v3.0.1)

Updates `cypress` from 4.12.1 to 13.13.0
- [Release notes](https://github.com/cypress-io/cypress/releases)
- [Changelog](https://github.com/cypress-io/cypress/blob/develop/CHANGELOG.md)
- [Commits](cypress-io/cypress@v4.12.1...v13.13.0)

---
updated-dependencies:
- dependency-name: "@cypress/request"
  dependency-type: indirect
- dependency-name: cypress
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

* Migrate configurations

* Update base image

* Ok, that one shouldn't be renamed

* Further migrations

* I guess that one is no longer needed

* Parse JSON response

* Oh cypress...

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: psrok1 <pawel.srokosz@cert.pl>
  • Loading branch information
dependabot[bot] and psrok1 authored Jul 15, 2024
1 parent db068aa commit eee848f
Show file tree
Hide file tree
Showing 12 changed files with 1,548 additions and 1,244 deletions.
2 changes: 1 addition & 1 deletion tests/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM cypress/base:12
FROM cypress/base:18.20.3

WORKDIR /app
COPY package.json /app/package.json
Expand Down
12 changes: 12 additions & 0 deletions tests/frontend/cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { defineConfig } = require('cypress')

module.exports = defineConfig({
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
},
baseUrl: 'http://mwdb-web',
},
})
3 changes: 0 additions & 3 deletions tests/frontend/cypress.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ describe("Blob view test - mwdb-core", function () {

cy.get("@blobId").then((blobId) => {
cy.get('.d-none a[href*="' + blobId + '"] > div').click({ force: true });
cy.server()
.route("GET", "/api/blob/" + blobId)
cy.intercept("GET", "/api/blob/" + blobId)
.as("dataGetFirst");
});

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,28 @@ describe("Sample view test - mwdb-core", function () {
it("Sample view test - existent and non-existent md5 and sha256 hashes", function () {
requestLogin(Cypress.env("user"), Cypress.env("password"));

const fileName = "TEST";
const method = "POST";
const apiUrl = "/api/file";

const fileType = "text/plain";

const addedFile = new Cypress.Promise((resolve) => {
const fileName = "TEST";
const method = "POST";
const apiUrl = "/api/file";

const fileType = "text/plain";

cy.get("@token").then((token) => {
cy.fixture(fileName).then((bin) => {
return Cypress.Blob.binaryStringToBlob(bin, fileType).then((blob) => {
const formData = new FormData();
formData.set("file", blob, fileName);

cy.formRequest(method, apiUrl, formData, token).then((response) => {
expect(response.status).to.eq(200);
resolve(response.response.body);
});
const blob = Cypress.Blob.binaryStringToBlob(bin, fileType);
const formData = new FormData();
formData.set("file", blob, fileName);
cy.request({
url: apiUrl,
method,
headers: {"Authorization": "Bearer " + token},
body: formData,
}).then((response) => {
expect(response.status).to.eq(200);
const bodyString = Cypress.Blob.arrayBufferToBinaryString(response.body);
resolve(JSON.parse(bodyString));
});
});
});
Expand Down
File renamed without changes.
15 changes: 0 additions & 15 deletions tests/frontend/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,3 @@
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })

Cypress.Commands.add("formRequest", (method, url, formData, token) => {
return cy
.server()
.route(method, url)
.as("formRequest")
.window()
.then((win) => {
let xhr = new win.XMLHttpRequest();
xhr.open(method, url);
xhr.setRequestHeader("Authorization", "Bearer " + token);
xhr.send(formData);
})
.wait("@formRequest");
});
File renamed without changes.
Loading

0 comments on commit eee848f

Please sign in to comment.