Skip to content

Commit

Permalink
Moving topic editing into a dialog to improve topics display (#1986)
Browse files Browse the repository at this point in the history
  • Loading branch information
kathy-t authored Jul 10, 2024
1 parent 4a45133 commit be7981a
Show file tree
Hide file tree
Showing 27 changed files with 622 additions and 608 deletions.
64 changes: 42 additions & 22 deletions cypress/e2e/group2/myworkflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ describe('Dockstore my workflows', () => {
cy.contains('Close').click();
});
it('Should contain the extended properties and be able to edit the info tab', () => {
cy.intercept('PUT', 'api/workflows/*').as('updateWorkflow');
// The seemingly unnecessary visits are due to a detached-from-dom error even using cy.get().click();
cy.visit('/my-workflows/github.com/A/l');
cy.contains('github.com');
Expand All @@ -191,13 +192,15 @@ describe('Dockstore my workflows', () => {
const workflowPathInput = '[data-cy=workflowPathInput]';
cy.get(workflowPathInput).clear().type('/Dockstore2.cwl');
cy.contains('button', ' Save ').click();
cy.wait('@updateWorkflow');
cy.visit('/my-workflows/github.com/A/g');
cy.contains('/Dockstore2.cwl');
// Change the file path back
cy.contains('button', ' Edit ').click();
const dockstoreCwlPath = '/Dockstore.cwl';
cy.get(workflowPathInput).clear().type(dockstoreCwlPath);
cy.contains('button', ' Save ').click();
cy.wait('@updateWorkflow');
cy.visit('/my-workflows/github.com/A/g');
const workflowPathSpan = '[data-cy=workflowPathSpan]';
cy.get(workflowPathSpan).contains(dockstoreCwlPath);
Expand All @@ -215,25 +218,55 @@ describe('Dockstore my workflows', () => {
// Topic Editing
const privateEntryURI = '/my-workflows/github.com/A/l';
cy.visit(privateEntryURI);
// Add an AI topic for testing
invokeSql("update workflow set topicai = 'test AI topic sentence' where id = 11");
// Modify the manual topic, but don't save it
cy.get('[data-cy=topicEditButton]').click();
cy.get('[data-cy=topicInput]').clear().type('badTopic');
cy.get('[data-cy=topicInput]').clear(); // Unsafe to chain clear()
cy.get('[data-cy=topicInput]').type('badTopic');
cy.get('[data-cy=topicCancelButton]').click();
cy.contains('badTopic').should('not.exist');
cy.get('[data-cy=selected-topic]').should('not.contain.text', 'badTopic');
// Modify the manual topic and save it
cy.get('[data-cy=topicEditButton]').click();
cy.get('[data-cy=topicInput]').clear().type('goodTopic');
cy.get('[data-cy=topicInput]').clear(); // Unsafe to chain clear()
cy.get('[data-cy=topicInput]').type('goodTopic');
cy.get('[data-cy=topicSaveButton]').click();
cy.contains('goodTopic').should('exist');
cy.wait('@updateWorkflow');
// Check that the manual topic is saved
cy.get('[data-cy=topicEditButton]').click();
cy.get('[data-cy=topicInput]').should('have.value', 'goodTopic');
cy.get('[data-cy=topicCancelButton]').click();

// Check public view
cy.visit(privateEntryURI);
// Check public view. Manual topic should not be displayed because it's not the selected topic
cy.get('[data-cy=viewPublicWorkflowButton]').should('be.visible').click();
cy.contains('goodTopic').should('not.exist');
cy.get('[data-cy=selected-topic]').should('not.contain.text', 'goodTopic');

// Select the manual topic and verify that it's displayed publicly
cy.visit(privateEntryURI);
cy.contains('mat-radio-button', 'Manual').find('input').should('not.be.disabled').click({ force: true });
cy.get('[data-cy=topicEditButton]').click();
cy.get('.mat-radio-label').contains('Manual').click();
cy.get('[data-cy=topicSaveButton]').click();
cy.wait('@updateWorkflow');
cy.get('[data-cy=selected-topic]').should('contain.text', 'goodTopic');
// Topic selection bubble should be visible on private page
cy.get('[data-cy=topic-selection-bubble]').should('be.visible');
// Topic selection bubble should not exist on public page
cy.get('[data-cy=viewPublicWorkflowButton]').should('be.visible').click();
cy.get('[data-cy=selected-topic]').should('contain.text', 'goodTopic');
cy.get('[data-cy=topic-selection-bubble]').should('not.exist');

// Select the AI topic and verify that it's displayed publicly with an AI bubble
cy.visit(privateEntryURI);
cy.get('[data-cy=topicEditButton]').click();
cy.get('.mat-radio-label').contains('AI').click();
cy.get('[data-cy=topicSaveButton]').click();
cy.wait('@updateWorkflow');
cy.get('[data-cy=selected-topic]').should('contain.text', 'test AI topic sentence');
cy.get('[data-cy=ai-bubble]').should('be.visible');
// AI bubble should be displayed on public page too
cy.get('[data-cy=viewPublicWorkflowButton]').should('be.visible').click();
cy.contains('goodTopic').should('exist');
cy.get('[data-cy=selected-topic]').should('contain.text', 'test AI topic sentence');
cy.get('[data-cy=ai-bubble]').should('be.visible');
});
it('should have mode tooltip', () => {
cy.visit('/my-workflows/github.com/A/g');
Expand Down Expand Up @@ -639,19 +672,6 @@ describe('Version Dropdown should have search capabilities', () => {
cy.get('mat-option').should('not.contain', 'master');
cy.get('mat-option').should('contain', 'test').should('be.visible');
});
it('Test AI topic sentences', () => {
cy.fixture('workflowWithTopicAI.json').then((json) => {
cy.intercept('GET', '/api/workflows/11*', {
body: json,
statusCode: 200,
}).as('request');
});

cy.visit('/my-workflows');
cy.get('[data-cy=topic-ai-selection-button]').should('be.visible');
cy.get('[data-cy=topicAI-text]').should('contain.text', 'test AI topic sentence');
cy.get('[data-cy=ai-bubble]').should('be.visible');
});
});
describe('Should handle no workflows correctly', () => {
resetDB();
Expand Down
3 changes: 2 additions & 1 deletion cypress/e2e/group2/sharedWorkflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
resetDB,
setTokenUserViewPort,
} from '../../support/commands';

import { workflowEntryTypeMetadata } from '../../../src/app/test/mocked-objects';
import { BioWorkflow } from '../../../src/app/shared/openapi/model/bioWorkflow';
describe('Shared with me workflow test from my-workflows', () => {
resetDB();
Expand Down Expand Up @@ -82,6 +82,7 @@ describe('Shared with me workflow test from my-workflows', () => {
description: undefined,
descriptorType: 'WDL',
email: undefined,
entryTypeMetadata: workflowEntryTypeMetadata,
full_workflow_path: 'dockstore.org/user_B/' + name,
gitUrl: '',
has_checker: false,
Expand Down
32 changes: 22 additions & 10 deletions cypress/e2e/group3/mytools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ describe('Dockstore my tools', () => {
it('visit another page then come back', () => {
// The seemingly unnecessary visits are due to a detached-from-dom error even using cy.get().click();
cy.intercept('api/containers/*?include=validations').as('getTool');
cy.intercept('PUT', 'api/containers/*').as('updateTool');
cy.visit('/my-tools');
cy.wait('@getTool');
selectUnpublishedTab('A2');
Expand All @@ -96,6 +97,7 @@ describe('Dockstore my tools', () => {
cy.contains('button', ' Edit ').click();
cy.get('input').first().should('be.visible').clear().type('/thing/Dockerfile');
cy.contains('button', ' Save ').click();
cy.wait('@updateTool');
cy.visit('/my-tools/quay.io/A2/b1');
cy.contains('/thing/Dockerfile');
// Change the dockerfile path back
Expand All @@ -105,28 +107,38 @@ describe('Dockstore my tools', () => {
cy.visit('/my-tools/quay.io/A2/b1');
cy.contains('/Dockerfile');

// // Topic Editing
// Topic Editing
let privateEntryURI = '/my-tools/github.com/A2/a';
cy.visit(privateEntryURI);
// Modify the manual topic, but don't save it
cy.get('[data-cy=topicEditButton]').click();
cy.get('[data-cy=topicInput]').clear().type('badTopic');
cy.get('[data-cy=topicInput]').clear(); // Unsafe to chain commands after clear()
cy.get('[data-cy=topicInput]').type('badTopic');
cy.get('[data-cy=topicCancelButton]').click();
cy.contains('badTopic').should('not.exist');
cy.get('[data-cy=selected-topic]').should('not.contain.text', 'badTopic');
// Modify the manual topic and save it
cy.get('[data-cy=topicEditButton]').click();
cy.get('[data-cy=topicInput]').clear().type('goodTopic');
cy.get('[data-cy=topicInput]').clear(); // Unsafe to chain commands after clear()
cy.get('[data-cy=topicInput]').type('goodTopic');
cy.get('[data-cy=topicSaveButton]').click();
cy.wait('@updateTool');
// Check that the manual topic is saved
cy.get('[data-cy=topicEditButton]').click();
cy.contains('goodTopic').should('exist');
cy.get('[data-cy=topicInput]').should('have.value', 'goodTopic');
cy.get('[data-cy=topicCancelButton]').click();

// Check public view
cy.visit(privateEntryURI);
// Check public view. Manual topic should not be displayed because it's not the selected topic
cy.get('[data-cy=viewPublicToolButton]').should('be.visible').click();
cy.contains('goodTopic').should('not.exist');
cy.get('[data-cy=selected-topic]').should('not.contain.text', 'goodTopic');

// Select the manual topic and verify that it's displayed publicly
cy.visit(privateEntryURI);
cy.get('[data-cy=topicEditButton]').click();
cy.get('.mat-radio-label').contains('Manual').click();
cy.visit(privateEntryURI);
cy.get('[data-cy=topicSaveButton]').click();
cy.wait('@updateTool');
cy.get('[data-cy=viewPublicToolButton]').should('be.visible').click();
cy.contains('goodTopic').should('exist');
cy.get('[data-cy=selected-topic]').should('contain.text', 'goodTopic');
});
it('should be able to add labels', () => {
cy.contains('quay.io/A2/a:latest');
Expand Down
156 changes: 0 additions & 156 deletions cypress/fixtures/workflowWithTopicAI.json

This file was deleted.

Loading

0 comments on commit be7981a

Please sign in to comment.