From b15c6f98790097d49dd55a22ee9914d857883b32 Mon Sep 17 00:00:00 2001 From: hyunnaye Date: Thu, 21 Nov 2024 17:06:52 -0500 Subject: [PATCH] test fix --- cypress/e2e/group2/myworkflows.ts | 594 +++++++++++++++--------------- 1 file changed, 297 insertions(+), 297 deletions(-) diff --git a/cypress/e2e/group2/myworkflows.ts b/cypress/e2e/group2/myworkflows.ts index eb76b9e58..bca4abd68 100644 --- a/cypress/e2e/group2/myworkflows.ts +++ b/cypress/e2e/group2/myworkflows.ts @@ -31,303 +31,303 @@ const cwlDescriptorType = 'CWL'; const wdlDescriptorType = 'WDL'; const nextflowDescriptorType = 'Nextflow'; -// describe('Dockstore my workflows', () => { -// resetDB(); -// setTokenUserViewPort(); -// -// it('have entries shown on the dashboard', () => { -// cy.visit('/dashboard'); -// cy.contains('Search your Workflows...'); -// cy.get('#mat-input-0').type('hosted'); -// cy.contains('hosted-workflow'); -// cy.get('#mat-input-0').type('potato'); -// cy.contains('No matching workflows'); -// }); -// -// it('should have discover existing workflows button', () => { -// cy.fixture('myWorkflows.json').then((json) => { -// cy.intercept('PATCH', '/api/users/1/workflows', { -// body: json, -// statusCode: 200, -// }); -// }); -// -// cy.visit('/my-workflows'); -// cy.get('[data-cy=myWorkflowsMoreActionButtons]').should('be.visible').click(); -// cy.fixture('myWorkflows.json').then((json) => { -// cy.intercept('GET', '/api/users/1/workflows', { -// body: json, -// statusCode: 200, -// }).as('getWorkflows'); -// }); -// cy.get('[data-cy=addToExistingWorkflows]').should('be.visible').click(); -// -// cy.wait('@getWorkflows'); -// cy.contains('addedthisworkflowviasync'); -// }); -// -// describe('Should contain extended Workflow properties', () => { -// // Flaky test, see https://github.com/dockstore/dockstore/issues/5696 -// it('Should show GitHub App logs', () => { -// cy.visit('/my-workflows'); -// cy.contains('github.com/A/l'); -// -// cy.contains('Apps Logs').click(); -// cy.contains('There were problems retrieving the GitHub App logs for this organization.'); -// cy.contains('Close').click(); -// cy.intercept('GET', '/api/lambdaEvents/**', { -// body: [], -// }).as('No lambda events'); -// cy.contains('Apps Logs').click(); -// cy.contains('There are no GitHub App logs for this organization.'); -// cy.contains('Close').click(); -// const entry1 = 'entry1'; -// const entry2 = 'entry2'; -// const realResponse = [ -// { -// deliveryId: '1', -// entryName: entry1, -// eventDate: 1582165220000, -// githubUsername: 'boil', -// id: 1, -// message: 'HTTP 418 ', -// organization: 'dockstore', -// reference: 'refs/tag/1.03', -// repository: 'hello_world', -// success: false, -// type: 'PUSH', -// }, -// { -// deliveryId: '2', -// entryName: entry2, -// eventDate: 1591368041850, -// githubUsername: 'em', -// id: 2, -// message: 'HTTP 418 ', -// organization: 'dockstore', -// reference: 'refs/tag/1.03', -// repository: 'hello_world', -// success: false, -// type: 'PUSH', -// }, -// ]; -// const sortedAsc = [...realResponse].sort((a, b) => a.entryName.toLowerCase().localeCompare(b.entryName.toLowerCase())); -// const sortedDesc = [...realResponse].sort((a, b) => b.entryName.toLowerCase().localeCompare(a.entryName.toLowerCase())); -// cy.intercept('GET', '/api/lambdaEvents/**sortCol=entryName&sortOrder=asc', { -// body: sortedAsc, -// headers: { -// 'X-total-count': '2', -// }, -// }).as('Sorted by entryName asc'); -// cy.intercept('GET', '/api/lambdaEvents/**sortCol=entryName&sortOrder=desc', { -// body: sortedDesc, -// headers: { -// 'X-total-count': '2', -// }, -// }).as('Sorted by entryName desc'); -// cy.intercept('GET', '/api/lambdaEvents/A?offset=0&limit=10&sortOrder=desc', { -// body: realResponse, -// headers: { -// 'X-total-count': '2', -// }, -// }).as('Default sort'); -// cy.contains('Apps Logs').click(); -// // Check that app logs contain the correct columns -// const appLogColumns = ['Date', 'GitHub Username', 'Entry Name', 'Delivery ID', 'Repository', 'Reference', 'Status', 'Type']; -// appLogColumns.forEach((column) => cy.contains(column)); -// // These next 2 values work on Circle CI (UTC?) I would have thought East Coast time, but there's an 8 hour diff with West Coast time. Confused -// cy.contains('2020-02-20T02:20'); -// cy.contains('2020-06-05T14:40'); -// // These next 2 values only work on the West Coast -// // cy.contains('2020-02-19T18:20'); -// // cy.contains('2020-06-05T07:40'); -// -// // Sort by entry name ascending, entry1 should be first row -// cy.contains('th', 'Entry Name').click(); -// cy.get('[data-cy=entry-name').first().should('have.text', entry1); -// -// // Sort by entry name descending, entry2 should be first row -// cy.contains('th', 'Entry Name').click(); -// cy.get('[data-cy=entry-name').first().should('have.text', entry2); -// -// cy.contains('1 – 2 of 2'); -// -// //Filtering -// const filteredResponse: LambdaEvent[] = [ -// { -// deliveryId: '1', -// entryName: entry1, -// eventDate: 1582165220000, -// githubUsername: 'boil', -// id: 1, -// message: 'HTTP 418 ', -// organization: 'dockstore', -// reference: 'refs/tag/1.03', -// repository: 'hello_world', -// success: false, -// type: 'PUSH', -// }, -// ]; -// cy.intercept('GET', '/api/lambdaEvents/**', { -// body: filteredResponse, -// headers: { -// 'X-total-count': '1', -// }, -// }); -// cy.get('[data-cy=apps-logs-filter]').type(entry1); -// cy.contains('2020-02-20T02:20'); -// cy.contains('1 – 1 of 1'); -// 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'); -// cy.get('[data-cy=sourceRepository]').should('contain.text', '1st-workflow.cwl'); -// cy.visit('/my-workflows/github.com/A/g'); -// cy.contains('/Dockstore.cwl'); -// // Change the file path -// cy.contains('button', ' Edit ').click(); -// 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); -// -// // Test Revert -// cy.get('[data-cy=editWorkflowPathButton').click(); -// const sillyText = 'silly'; -// cy.get(workflowPathInput).clear().type(sillyText); -// // Verify it took -// cy.get(workflowPathInput).should('have.value', sillyText); -// cy.get('[data-cy=cancelWorkflowPathButton').click(); -// // Input goes away, check that correct text displayed -// cy.get(workflowPathSpan).contains(dockstoreCwlPath); -// -// // Topic Editing -// const privateEntryURI = '/my-workflows/github.com/A/l'; -// cy.visit(privateEntryURI); -// // Modify the manual topic, but don't save it -// cy.get('[data-cy=topicEditButton]').click(); -// cy.get('[data-cy=topicInput]').clear(); // Unsafe to chain clear() -// cy.get('[data-cy=topicInput]').type('badTopic'); -// cy.get('[data-cy=topicCancelButton]').click(); -// 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(); // Unsafe to chain clear() -// cy.get('[data-cy=topicInput]').type('goodTopic'); -// cy.get('[data-cy=topicSaveButton]').click(); -// 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. Manual topic should not be displayed because it's not the selected topic -// cy.get('[data-cy=viewPublicWorkflowButton]').should('be.visible').click(); -// 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.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'); -// -// // Add an AI topic for testing and set topic selection to AI. The user has not approved of this topic. -// invokeSql("update workflow set topicai = 'test AI topic sentence' where id = 11"); -// invokeSql("update workflow set topicselection = 'AI' where id = 11"); -// cy.visit(privateEntryURI); -// cy.get('[data-cy=topicEditButton]').click(); -// cy.get('[data-cy=unapprovedAITopicCard]').should('be.visible'); -// cy.get('[data-cy=topicCancelButton]').click(); -// // AI topic on public page should have an AI bubble because it wasn't approved by the user -// cy.get('[data-cy=viewPublicWorkflowButton]').should('be.visible').click(); -// cy.get('[data-cy=ai-bubble]').should('be.visible'); -// -// // Select the AI topic and verify that it's displayed publicly without 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.get('[data-cy=confirmAISelectionPrompt').should('be.visible'); -// cy.get('[data-cy=topicConfirmButton]').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 is displayed privately to indicate the topic selection -// // AI bubble should not be displayed on public page because the user selected it and thus approves of it -// cy.get('[data-cy=viewPublicWorkflowButton]').should('be.visible').click(); -// cy.get('[data-cy=selected-topic]').should('contain.text', 'test AI topic sentence'); -// cy.get('[data-cy=ai-bubble]').should('not.exist'); -// }); -// it('should have mode tooltip', () => { -// cy.visit('/my-workflows/github.com/A/g'); -// // .trigger('mouseover') doesn't work for some reason -// cy.contains('Mode').trigger('mouseenter'); -// cy.get('.mat-tooltip').contains('STUB: Basic metadata pulled from source control.'); -// -// cy.contains('github.com/A/g'); -// cy.get('button').contains('Manage labels').click(); -// cy.get('[data-cy=workflowLabelInput]').type('potato'); -// // Adding force:true, appears to be a cypress issue, when clicking this button the event does not fire -// // this will force submitWorkflowEdits() to fire -// cy.get('[data-cy=saveLabelButton]').click({ force: true }); -// cy.get('[data-cy=saveLabelButton]').should('not.exist'); -// }); -// it('add and remove test parameter file', () => { -// cy.visit('/my-workflows/github.com/A/l'); -// cy.contains('Versions').click(); -// cy.get('td').contains('Actions').click(); -// cy.get('.cdk-overlay-connected-position-bounding-box').contains('Edit').click(); -// // For some reason, it would type half in the correct input field, but the other half in the first field -// cy.wait(2000); -// cy.get('[data-cy=test-parameter-file-input]').click(); -// cy.get('[data-cy=test-parameter-file-input]').type('/test.wdl.json'); -// cy.get('[data-cy=save-version').click(); -// cy.get('[data-cy=save-version').should('not.exist'); -// cy.get('td').contains('Actions').click(); -// cy.get('.cdk-overlay-connected-position-bounding-box').contains('Edit').click(); -// cy.get('[data-cy=remove-test-parameter-file-button]').click(); -// cy.get('[data-cy=save-version').click(); -// cy.get('[data-cy=save-version').should('not.exist'); -// }); -// it('Should be able to hide/unhide', () => { -// cy.visit('/my-workflows/github.com/A/l'); -// cy.contains('Versions').click(); -// cy.get('td').contains('Actions').should('exist').click(); -// cy.get('.cdk-overlay-connected-position-bounding-box').contains('Edit').click(); -// cy.get('[type="checkbox"]').check(); -// cy.contains('button', ' Save ').click(); -// // Check for hidden version and unhide -// cy.get('[data-cy=hidden').should('exist'); -// cy.visit('/my-workflows/github.com/A/l'); -// cy.contains('Versions').click(); -// cy.get('td').contains('Actions').should('exist').click(); -// cy.get('.cdk-overlay-connected-position-bounding-box').contains('Edit').click(); -// cy.get('[type="checkbox"]').uncheck(); -// cy.contains('button', ' Save ').click(); -// }); -// }); -// }); +describe('Dockstore my workflows', () => { + resetDB(); + setTokenUserViewPort(); + + it('have entries shown on the dashboard', () => { + cy.visit('/dashboard'); + cy.contains('Search your Workflows...'); + cy.get('#mat-input-0').type('hosted'); + cy.contains('hosted-workflow'); + cy.get('#mat-input-0').type('potato'); + cy.contains('No matching workflows'); + }); + + it('should have discover existing workflows button', () => { + cy.fixture('myWorkflows.json').then((json) => { + cy.intercept('PATCH', '/api/users/1/workflows', { + body: json, + statusCode: 200, + }); + }); + + cy.visit('/my-workflows'); + cy.get('[data-cy=myWorkflowsMoreActionButtons]').should('be.visible').click(); + cy.fixture('myWorkflows.json').then((json) => { + cy.intercept('GET', '/api/users/1/workflows', { + body: json, + statusCode: 200, + }).as('getWorkflows'); + }); + cy.get('[data-cy=addToExistingWorkflows]').should('be.visible').click(); + + cy.wait('@getWorkflows'); + cy.contains('addedthisworkflowviasync'); + }); + + describe('Should contain extended Workflow properties', () => { + // Flaky test, see https://github.com/dockstore/dockstore/issues/5696 + it('Should show GitHub App logs', () => { + cy.visit('/my-workflows'); + cy.contains('github.com/A/l'); + + cy.contains('Apps Logs').click(); + cy.contains('There were problems retrieving the GitHub App logs for this organization.'); + cy.contains('Close').click(); + cy.intercept('GET', '/api/lambdaEvents/**', { + body: [], + }).as('No lambda events'); + cy.contains('Apps Logs').click(); + cy.contains('There are no GitHub App logs for this organization.'); + cy.contains('Close').click(); + const entry1 = 'entry1'; + const entry2 = 'entry2'; + const realResponse = [ + { + deliveryId: '1', + entryName: entry1, + eventDate: 1582165220000, + githubUsername: 'boil', + id: 1, + message: 'HTTP 418 ', + organization: 'dockstore', + reference: 'refs/tag/1.03', + repository: 'hello_world', + success: false, + type: 'PUSH', + }, + { + deliveryId: '2', + entryName: entry2, + eventDate: 1591368041850, + githubUsername: 'em', + id: 2, + message: 'HTTP 418 ', + organization: 'dockstore', + reference: 'refs/tag/1.03', + repository: 'hello_world', + success: false, + type: 'PUSH', + }, + ]; + const sortedAsc = [...realResponse].sort((a, b) => a.entryName.toLowerCase().localeCompare(b.entryName.toLowerCase())); + const sortedDesc = [...realResponse].sort((a, b) => b.entryName.toLowerCase().localeCompare(a.entryName.toLowerCase())); + cy.intercept('GET', '/api/lambdaEvents/**sortCol=entryName&sortOrder=asc', { + body: sortedAsc, + headers: { + 'X-total-count': '2', + }, + }).as('Sorted by entryName asc'); + cy.intercept('GET', '/api/lambdaEvents/**sortCol=entryName&sortOrder=desc', { + body: sortedDesc, + headers: { + 'X-total-count': '2', + }, + }).as('Sorted by entryName desc'); + cy.intercept('GET', '/api/lambdaEvents/A?offset=0&limit=10&sortOrder=desc', { + body: realResponse, + headers: { + 'X-total-count': '2', + }, + }).as('Default sort'); + cy.contains('Apps Logs').click(); + // Check that app logs contain the correct columns + const appLogColumns = ['Date', 'GitHub Username', 'Entry Name', 'Delivery ID', 'Repository', 'Reference', 'Status', 'Type']; + appLogColumns.forEach((column) => cy.contains(column)); + // These next 2 values work on Circle CI (UTC?) I would have thought East Coast time, but there's an 8 hour diff with West Coast time. Confused + cy.contains('2020-02-20T02:20'); + cy.contains('2020-06-05T14:40'); + // These next 2 values only work on the West Coast + // cy.contains('2020-02-19T18:20'); + // cy.contains('2020-06-05T07:40'); + + // Sort by entry name ascending, entry1 should be first row + cy.contains('th', 'Entry Name').click(); + cy.get('[data-cy=entry-name').first().should('have.text', entry1); + + // Sort by entry name descending, entry2 should be first row + cy.contains('th', 'Entry Name').click(); + cy.get('[data-cy=entry-name').first().should('have.text', entry2); + + cy.contains('1 – 2 of 2'); + + //Filtering + const filteredResponse: LambdaEvent[] = [ + { + deliveryId: '1', + entryName: entry1, + eventDate: 1582165220000, + githubUsername: 'boil', + id: 1, + message: 'HTTP 418 ', + organization: 'dockstore', + reference: 'refs/tag/1.03', + repository: 'hello_world', + success: false, + type: 'PUSH', + }, + ]; + cy.intercept('GET', '/api/lambdaEvents/**', { + body: filteredResponse, + headers: { + 'X-total-count': '1', + }, + }); + cy.get('[data-cy=apps-logs-filter]').type(entry1); + cy.contains('2020-02-20T02:20'); + cy.contains('1 – 1 of 1'); + 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'); + cy.get('[data-cy=sourceRepository]').should('contain.text', '1st-workflow.cwl'); + cy.visit('/my-workflows/github.com/A/g'); + cy.contains('/Dockstore.cwl'); + // Change the file path + cy.contains('button', ' Edit ').click(); + 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); + + // Test Revert + cy.get('[data-cy=editWorkflowPathButton').click(); + const sillyText = 'silly'; + cy.get(workflowPathInput).clear().type(sillyText); + // Verify it took + cy.get(workflowPathInput).should('have.value', sillyText); + cy.get('[data-cy=cancelWorkflowPathButton').click(); + // Input goes away, check that correct text displayed + cy.get(workflowPathSpan).contains(dockstoreCwlPath); + + // Topic Editing + const privateEntryURI = '/my-workflows/github.com/A/l'; + cy.visit(privateEntryURI); + // Modify the manual topic, but don't save it + cy.get('[data-cy=topicEditButton]').click(); + cy.get('[data-cy=topicInput]').clear(); // Unsafe to chain clear() + cy.get('[data-cy=topicInput]').type('badTopic'); + cy.get('[data-cy=topicCancelButton]').click(); + 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(); // Unsafe to chain clear() + cy.get('[data-cy=topicInput]').type('goodTopic'); + cy.get('[data-cy=topicSaveButton]').click(); + 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. Manual topic should not be displayed because it's not the selected topic + cy.get('[data-cy=viewPublicWorkflowButton]').should('be.visible').click(); + 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.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'); + + // Add an AI topic for testing and set topic selection to AI. The user has not approved of this topic. + invokeSql("update workflow set topicai = 'test AI topic sentence' where id = 11"); + invokeSql("update workflow set topicselection = 'AI' where id = 11"); + cy.visit(privateEntryURI); + cy.get('[data-cy=topicEditButton]').click(); + cy.get('[data-cy=unapprovedAITopicCard]').should('be.visible'); + cy.get('[data-cy=topicCancelButton]').click(); + // AI topic on public page should have an AI bubble because it wasn't approved by the user + cy.get('[data-cy=viewPublicWorkflowButton]').should('be.visible').click(); + cy.get('[data-cy=ai-bubble]').should('be.visible'); + + // Select the AI topic and verify that it's displayed publicly without 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.get('[data-cy=confirmAISelectionPrompt').should('be.visible'); + cy.get('[data-cy=topicConfirmButton]').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 is displayed privately to indicate the topic selection + // AI bubble should not be displayed on public page because the user selected it and thus approves of it + cy.get('[data-cy=viewPublicWorkflowButton]').should('be.visible').click(); + cy.get('[data-cy=selected-topic]').should('contain.text', 'test AI topic sentence'); + cy.get('[data-cy=ai-bubble]').should('not.exist'); + }); + it('should have mode tooltip', () => { + cy.visit('/my-workflows/github.com/A/g'); + // .trigger('mouseover') doesn't work for some reason + cy.contains('Mode').trigger('mouseenter'); + cy.get('.mat-tooltip').contains('STUB: Basic metadata pulled from source control.'); + + cy.contains('github.com/A/g'); + cy.get('button').contains('Manage labels').click(); + cy.get('[data-cy=workflowLabelInput]').type('potato'); + // Adding force:true, appears to be a cypress issue, when clicking this button the event does not fire + // this will force submitWorkflowEdits() to fire + cy.get('[data-cy=saveLabelButton]').click({ force: true }); + cy.get('[data-cy=saveLabelButton]').should('not.exist'); + }); + it('add and remove test parameter file', () => { + cy.visit('/my-workflows/github.com/A/l'); + cy.contains('Versions').click(); + cy.get('td').contains('Actions').click(); + cy.get('.cdk-overlay-connected-position-bounding-box').contains('Edit').click(); + // For some reason, it would type half in the correct input field, but the other half in the first field + cy.wait(2000); + cy.get('[data-cy=test-parameter-file-input]').click(); + cy.get('[data-cy=test-parameter-file-input]').type('/test.wdl.json'); + cy.get('[data-cy=save-version').click(); + cy.get('[data-cy=save-version').should('not.exist'); + cy.get('td').contains('Actions').click(); + cy.get('.cdk-overlay-connected-position-bounding-box').contains('Edit').click(); + cy.get('[data-cy=remove-test-parameter-file-button]').click(); + cy.get('[data-cy=save-version').click(); + cy.get('[data-cy=save-version').should('not.exist'); + }); + it('Should be able to hide/unhide', () => { + cy.visit('/my-workflows/github.com/A/l'); + cy.contains('Versions').click(); + cy.get('td').contains('Actions').should('exist').click(); + cy.get('.cdk-overlay-connected-position-bounding-box').contains('Edit').click(); + cy.get('[type="checkbox"]').check(); + cy.contains('button', ' Save ').click(); + // Check for hidden version and unhide + cy.get('[data-cy=hidden').should('exist'); + cy.visit('/my-workflows/github.com/A/l'); + cy.contains('Versions').click(); + cy.get('td').contains('Actions').should('exist').click(); + cy.get('.cdk-overlay-connected-position-bounding-box').contains('Edit').click(); + cy.get('[type="checkbox"]').uncheck(); + cy.contains('button', ' Save ').click(); + }); + }); +}); describe('Dockstore my workflows part 2', () => { resetDB();