[arvados] created: 2.7.0-6214-gb69a7e67a9
git repository hosting
git at public.arvados.org
Tue Mar 19 14:08:21 UTC 2024
at b69a7e67a9b246586b581b458e46e179839d5208 (commit)
commit b69a7e67a9b246586b581b458e46e179839d5208
Author: Lucas Di Pentima <lucas.dipentima at curii.com>
Date: Tue Mar 19 11:04:26 2024 -0300
21600: Refactors banner cypress tests.
Only create banner collection once, saving precious run time.
Instead of checking for cryptic internal state, simulate mouseover/mouseenter
events and check for tooltip text existance.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>
diff --git a/services/workbench2/cypress/e2e/banner-tooltip.cy.js b/services/workbench2/cypress/e2e/banner-tooltip.cy.js
index 0a0ac75164..dfcdfe5cd0 100644
--- a/services/workbench2/cypress/e2e/banner-tooltip.cy.js
+++ b/services/workbench2/cypress/e2e/banner-tooltip.cy.js
@@ -20,23 +20,18 @@ describe('Banner / tooltip tests', function () {
.as('activeUser').then(function () {
activeUser = this.activeUser;
});
- });
- beforeEach(function () {
- cy.on('uncaught:exception', (err, runnable, promise) => {
- Cypress.log({ message: `Application Error: ${err}`});
- if (promise) {
- return false;
- }
+ cy.getAll('@adminUser').then(([adminUser]) => {
+ // This collection will not be deleted after each test, we'll
+ // clean it up manually.
+ cy.createCollection(adminUser.token, {
+ name: `BannerTooltipTest${Math.floor(Math.random() * 999999)}`,
+ owner_uuid: adminUser.user.uuid,
+ }, true).as('bannerCollection');
});
- cy.createCollection(adminUser.token, {
- name: `BannerTooltipTest${Math.floor(Math.random() * 999999)}`,
- owner_uuid: adminUser.user.uuid,
- }).as('bannerCollection');
-
cy.getAll('@bannerCollection').then(function ([bannerCollection]) {
- collectionUUID=bannerCollection.uuid;
+ collectionUUID = bannerCollection.uuid;
cy.loginAs(adminUser);
@@ -58,15 +53,28 @@ describe('Banner / tooltip tests', function () {
.should('contain', 'banner.html');
cy.get('[data-cy=collection-files-right-panel]')
.should('contain', 'tooltips.json');
+ });
+ });
- cy.intercept({ method: 'GET', url: '**/arvados/v1/config?nocache=*' }, (req) => {
- req.on('response', (res) => {
- res.body.Workbench.BannerUUID = collectionUUID;
- });
+ beforeEach(function () {
+ cy.on('uncaught:exception', (err, runnable, promise) => {
+ Cypress.log({ message: `Application Error: ${err}`});
+ if (promise) {
+ return false;
+ }
+ });
+ cy.intercept({ method: 'GET', url: '**/arvados/v1/config?nocache=*' }, (req) => {
+ req.on('response', (res) => {
+ res.body.Workbench.BannerUUID = collectionUUID;
});
});
});
+ after(function () {
+ // Delete banner collection after all test used it.
+ cy.deleteResource(adminUser.token, "collections", collectionUUID);
+ });
+
it('should re-show the banner', () => {
cy.loginAs(adminUser);
@@ -82,19 +90,19 @@ describe('Banner / tooltip tests', function () {
it('should show tooltips and remove tooltips as localStorage key is present', () => {
cy.loginAs(adminUser);
- cy.get('[data-cy=side-panel-tree]').then(($el) => {
- const el = $el.get(0) //native DOM element
- expect(el._tippy).to.exist;
- });
-
cy.get('[data-cy=confirmation-dialog-ok-btn]').click();
+ cy.contains('This allows you to navigate through the app').should('not.exist'); // This content comes from tooltips.txt
+ cy.get('[data-cy=side-panel-tree]').trigger('mouseover');
+ cy.get('[data-cy=side-panel-tree]').trigger('mouseenter');
+ cy.contains('This allows you to navigate through the app').should('be.visible');
+
cy.get('[title=Notifications]').click();
cy.get('li').contains('Disable tooltips').click();
- cy.get('[data-cy=side-panel-tree]').then(($el) => {
- const el = $el.get(0) //native DOM element
- expect(el._tippy).to.be.undefined;
- });
+ cy.contains('This allows you to navigate through the app').should('not.exist');
+ cy.get('[data-cy=side-panel-tree]').trigger('mouseover');
+ cy.get('[data-cy=side-panel-tree]').trigger('mouseenter');
+ cy.contains('This allows you to navigate through the app').should('not.exist');
});
});
diff --git a/services/workbench2/cypress/support/commands.js b/services/workbench2/cypress/support/commands.js
index da7300a430..a0ad2d6243 100644
--- a/services/workbench2/cypress/support/commands.js
+++ b/services/workbench2/cypress/support/commands.js
@@ -182,11 +182,11 @@ Cypress.Commands.add("createWorkflow", (token, data) => {
});
});
-Cypress.Commands.add("createCollection", (token, data) => {
+Cypress.Commands.add("createCollection", (token, data, keep = false) => {
return cy.createResource(token, "collections", {
collection: JSON.stringify(data),
ensure_unique_name: true,
- });
+ }, keep);
});
Cypress.Commands.add("getCollection", (token, uuid) => {
@@ -321,12 +321,14 @@ Cypress.Commands.add("getResource", (token, suffix, uuid) => {
});
});
-Cypress.Commands.add("createResource", (token, suffix, data) => {
+Cypress.Commands.add("createResource", (token, suffix, data, keep = false) => {
return cy
.doRequest("POST", "/arvados/v1/" + suffix, data, null, token, true)
.its("body")
.then(function (resource) {
- createdResources.push({ suffix, uuid: resource.uuid });
+ if (! keep) {
+ createdResources.push({ suffix, uuid: resource.uuid });
+ };
return resource;
});
});
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list