Skip to content

Commit

Permalink
Upgrade to Cypress 13 (#1966)
Browse files Browse the repository at this point in the history
* try cypress 13 upgrade

* update license

* fix mytools test's input failure

* see if experimentalMemoryManagement resolves crashes

* will the newest version help performance?

* try fixing organizations test (remove entry from collection)

* try fixing mytools (get buttons by data-cy)

* try intercepting tool's unpublish request

* try fixing checker flake (add visit, add visibility assertion)

* fix some flakes/errors
- mytools: scrollIntoView might help with typing in modals
- checkerWorkflowFromWorkflow: apply same visibility assertion as tool version

* fix goodTopic flake

* add assertions to fix searchTable flake

* try longer wait time in linkCheck

* fix link in download cli client
(handled in hotfix, but fix here to pass linkCheck)

* hopefully handle occasional flakes
- myworkflows: visibility assertion to fix typing
- starErrorMessage: assert starred state

* myworkflows fix didn't work - try scrollIntoView?

* try scrolling into modal

* mat-horizontal-stepper errored more

* add wait for redirect, observe decode

* try moving intercept to beforeEach
  • Loading branch information
ll5zh authored Apr 26, 2024
1 parent 87af084 commit d8aba8a
Show file tree
Hide file tree
Showing 14 changed files with 164 additions and 149 deletions.
2 changes: 1 addition & 1 deletion THIRD-PARTY-LICENSES.csv
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
"[email protected]","Apache-2.0","https://github.com/mathjax/MathJax"
"[email protected]","MIT","https://github.com/mermaid-js/mermaid"
"[email protected]","ISC","https://github.com/isaacs/minimatch"
"[email protected].6","MIT","https://github.com/substack/minimist"
"[email protected].8","MIT","https://github.com/minimistjs/minimist"
"[email protected]","ISC","https://github.com/isaacs/minipass"
"[email protected]","MIT","https://github.com/isaacs/minizlib"
"[email protected]","BSD-2-Clause","https://github.com/maxogden/mississippi"
Expand Down
1 change: 1 addition & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default defineConfig({
viewportWidth: 1440,
defaultCommandTimeout: 30000,
requestTimeout: 30000,
experimentalMemoryManagement: true,
retries: {
runMode: 3,
openMode: 0,
Expand Down
8 changes: 5 additions & 3 deletions cypress/e2e/group1/checkerWorkflowFromTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('Checker workflow test from my-tools', () => {
resetDB();
setTokenUserViewPort();
beforeEach(() => {
cy.intercept('api/containers/*?include=validations').as('getTool');
// Visit my-tools page
cy.visit('/my-tools');
});
Expand All @@ -34,7 +35,6 @@ describe('Checker workflow test from my-tools', () => {

describe('Should be able to register and publish a checker workflow from a tool', () => {
it('visit a tool and have the correct buttons and be able to register a checker workflow', () => {
cy.intercept('api/containers/*?include=validations').as('getTool');
cy.wait('@getTool');
goToB3();

Expand All @@ -43,9 +43,9 @@ describe('Checker workflow test from my-tools', () => {
cy.get('#launchCheckerWorkflow').should('not.exist');
cy.get('#addCheckerWorkflowButton').should('be.visible').click();

cy.get('#checkerWorkflowPath').type('/Dockstore.cwl');
cy.get('#checkerWorkflowPath').should('be.visible').type('/Dockstore.cwl');

cy.get('#checkerWorkflowTestParameterFilePath').type('/test.json');
cy.get('#checkerWorkflowTestParameterFilePath').should('be.visible').type('/test.json');

cy.get('#submitButton').click();

Expand Down Expand Up @@ -89,12 +89,14 @@ describe('Checker workflow test from my-tools', () => {
});
it('visit the tool and have its publish/unpublish reflected in the checker workflow', () => {
cy.intercept('api/containers/*?include=validations').as('getTool');
cy.intercept('api/containers/4/publish').as('unpublishTool');
cy.wait('@getTool');
goToB3();
// In the parent tool right now
// Didn't change the tool path upon entry or select
// cy.url().should('eq','/my-tools/quay.io/A2/b3')
cy.get('#publishToolButton').should('be.visible').should('contain', 'Unpublish').click();
cy.wait('@unpublishTool');

goToTab('Versions');
cy.contains('button', 'Actions').should('be.visible').click();
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/group1/checkerWorkflowFromWorkflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ describe('Checker workflow test from my-workflows', () => {
cy.get('#launchCheckerWorkflow').should('not.exist');
goToTab('Info');
cy.get('#addCheckerWorkflowButton').should('be.visible').click();
cy.get('#checkerWorkflowPath').type('/Dockstore.cwl');
cy.get('#checkerWorkflowTestParameterFilePath').type('/test.json');
cy.get('#checkerWorkflowPath').should('be.visible').type('/Dockstore.cwl');
cy.get('#checkerWorkflowTestParameterFilePath').should('be.visible').type('/test.json');
cy.fixture('refreshedChecker').then((json) => {
cy.intercept('GET', '/api/workflows/*/refresh', {
body: json,
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/group2/myworkflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ describe('Dockstore my workflows', () => {
cy.contains('goodTopic').should('not.exist');

cy.visit(privateEntryURI);
cy.get('.mat-radio-label').contains('Manual').click();
cy.contains('mat-radio-button', 'Manual').find('input').should('not.be.disabled').click({ force: true });
cy.visit(privateEntryURI);
cy.get('[data-cy=viewPublicWorkflowButton]').should('be.visible').click();
cy.contains('goodTopic').should('exist');
Expand Down Expand Up @@ -529,9 +529,9 @@ describe('Dockstore my workflows part 3', () => {
// Untouched form should not have errors but is disabled
cy.get('#submitButton').should('be.disabled');
notHaveAlert();
cy.get('#sourceCodeRepositoryInput').clear().type('beef/stew');
cy.get('#sourceCodeRepositoryInput').scrollIntoView().should('be.visible').clear().type('beef/stew');
cy.get('#submitButton').should('be.disabled');
cy.get('#sourceCodeRepositoryWorkflowPathInput').clear().type('/Dockstore.cwl');
cy.get('#sourceCodeRepositoryWorkflowPathInput').scrollIntoView().should('be.visible').clear().type('/Dockstore.cwl');
notHaveAlert();
// Apparently the actual radio button inside Angular material buttons is hidden, so doing it this way
cy.get('#descriptorTypeRadioButtons').contains(cwlDescriptorType).find('.mat-radio-container').click();
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/group2/organizations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ describe('Dockstore Organizations', () => {
cy.url().should('include', url);
cy.get('[data-cy=cancel-remove-entry-from-org]').click();
cy.url().should('include', url);
cy.get('app-collection-entry-confirm-remove').should('not.exist');
cy.get('#removeEntryButton').click();
cy.url().should('include', url);
cy.get('[data-cy=accept-remove-entry-from-org]').click();
Expand All @@ -293,7 +294,6 @@ describe('Dockstore Organizations', () => {
cy.contains('This collection has no associated entries');
cy.visit('/organizations/Potatoe');
cy.contains('Members').should('be.visible');

approvePotatoOrganization();
for (const url of ['/organizations', '/organizations/Potatoe', '/organizations/Potatoe/collections/veryFakeCollectionName']) {
cy.visit(url);
Expand Down
10 changes: 5 additions & 5 deletions cypress/e2e/group3/mytools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ describe('Dockstore my tools', () => {
selectTool('b1');
cy.contains('Versions').click();
cy.contains('button', 'Actions').should('be.visible').click();
cy.contains('button:visible', 'Edit').should('be.visible').click();
cy.get('[data-cy=editTagButton]').should('be.visible').click();
// For some unknown reason, Cypress likes to type '/test.wdl.json' in the wrong place
cy.wait(5000);
cy.get('input[data-cy=addWDLField]').should('be.visible').should('have.value', '').type('/test.wdl.json');
cy.get('input[data-cy=addCWLField]').should('be.visible').should('have.value', '').type('/test.cwl.json');
cy.get('#saveVersionModal').click();
cy.get('#saveVersionModal').should('not.exist');
cy.contains('button', 'Actions').should('be.visible').click();
cy.contains('button:visible', 'Edit').should('be.visible').click();
cy.get('[data-cy=editTagButton]').should('be.visible').click();
cy.get('#removeCWLTestParameterFileButton').click();
cy.get('#removeWDLTestParameterFileButton').click();
cy.get('#saveVersionModal').click();
Expand Down Expand Up @@ -278,7 +278,7 @@ describe('Dockstore my tools', () => {
cy.contains('Create tool with descriptor(s) on remote sites').should('be.visible').click();
cy.get('.modal-footer').contains('Next').first().click();

cy.get('#sourceCodeRepositoryInput').type('testnamespace/testname').wait(1000);
cy.get('#sourceCodeRepositoryInput').scrollIntoView().should('be.visible').click().type('testnamespace/testname');

cy.get('[data-cy=imageRegistryProviderSelect]').click();
cy.contains('Amazon ECR').click();
Expand Down Expand Up @@ -342,7 +342,7 @@ describe('Dockstore my tools', () => {
cy.contains('Create tool with descriptor(s) on remote sites').should('be.visible').click();
cy.get('.modal-footer').contains('Next').first().click();

cy.get('#sourceCodeRepositoryInput').type('testnamespace/testname').wait(1000);
cy.get('#sourceCodeRepositoryInput').scrollIntoView().should('be.visible').click().type('testnamespace/testname');

cy.get('[data-cy=imageRegistryProviderSelect]').click();
cy.contains('Amazon ECR').click();
Expand Down Expand Up @@ -448,7 +448,7 @@ describe('Dockstore my tools', () => {
cy.contains('Create tool with descriptor(s) on remote sites').should('be.visible').click();
cy.get('.modal-footer').contains('Next').first().click();

cy.get('#sourceCodeRepositoryInput').type('testnamespace/testname').wait(1000);
cy.get('#sourceCodeRepositoryInput').scrollIntoView().should('be.visible').click().type('testnamespace/testname');

cy.get('[data-cy=imageRegistryProviderSelect]').click();
cy.contains('mat-option', 'Seven Bridges').click();
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/group3/starErrorMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ describe('Tool and workflow starring error messages', () => {
cy.visit(url);

cy.get('#starringButtonIcon').click();
cy.get('#starCountButton').should('contain', 1);

cy.intercept('PUT', routePath, {
body: 'You cannot unstar the ' + type + ' ' + name + ' because you have not starred it.',
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/immutableDatabaseTests/linkCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('Find broken anchor links', () => {

function checkUrls(path: string) {
let brokenUrls = [];
cy.visit(path).wait(500); // Temporary solution to ensure the page loads entirely
cy.visit(path).wait(1000); // Temporary solution to ensure the page loads entirely
cy.get('a')
.each((anchor) => {
cy.get(anchor).then((anchor) => {
Expand Down Expand Up @@ -73,7 +73,7 @@ describe('Find broken image links', () => {

function checkImages(path: string, selector: string) {
let brokenImages = [];
cy.visit(path).wait(500);
cy.visit(path).wait(1000);
cy.get('app-root').should('be.visible');
cy.get('img')
.each((image) => {
Expand Down
14 changes: 9 additions & 5 deletions cypress/e2e/immutableDatabaseTests/searchTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,28 +394,32 @@ describe('search table items per page', () => {
cy.get('[data-cy=advanced-search]').click();

cy.get('[data-cy=dropdown]').click();
cy.get('[data-cy=file_select').should('not.exist');
cy.get('[data-cy=desc_select').should('be.visible').click();
cy.get('[data-cy=file_select]').should('not.exist');
cy.get('[data-cy=desc_select]').should('be.visible').click();

cy.get('[data-cy=NOTFilter]').click().type('garyluu');
cy.get('[data-cy=confirm-search]').click();
// Check that the advanced search dialog box has been closed
cy.get('app-advancedsearch').should('not.exist');

cy.get('[data-cy=advanced-search]').click();
cy.get('[data-cy=clear-advanced-search]').click();
cy.get('app-advancedsearch').should('not.exist');

cy.get('[data-cy=advanced-search]').click();

cy.get('[data-cy=dropdown]').click();
cy.get('[data-cy=desc_select').should('be.visible').click();
cy.get('[data-cy=desc_select]').should('be.visible').click();

cy.get('[data-cy=dropdown]').click();
cy.get('[data-cy=desc_select').should('not.exist');
cy.get('[data-cy=file_select').should('be.visible').click();
cy.get('[data-cy=desc_select]').should('not.exist');
cy.get('[data-cy=file_select]').should('be.visible').click();

cy.get('[data-cy=ANDNoSplitFilter]').click().type('gary');
cy.get('[data-cy=ORFilter]').click().type('A2');
cy.get('[data-cy=NOTFilter]').click().type('b3');
cy.get('[data-cy=confirm-search]').click();
cy.get('app-advancedsearch').should('not.exist');

cy.get('[data-cy=advanced-search]').click();
cy.get('[data-cy=clear-advanced-search]').click();
Expand Down
15 changes: 11 additions & 4 deletions cypress/e2e/immutableDatabaseTests/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,28 @@ import {
describe('Dockstore Home', () => {
describe('GitHub App Callback Routing', () => {
setTokenUserViewPort();
beforeEach(() => {
cy.intercept('GET', '/api/metadata/entryTypeMetadataList').as('getMetadata');
});
it('Redirects to my-tools', () => {
cy.visit('/githubCallback?state=/my-tools/quay.io/A2/b1');
cy.url().should('contain', '/my-tools/quay.io/A2/b1');
cy.wait('@getMetadata');
cy.url().should('contain', '%2Fmy-tools%2Fquay.io%2FA2%2Fb1');
});
it('Redirects to my-workflows', () => {
cy.visit('/githubCallback?state=/my-workflows/github.com/A/l');
cy.url().should('contain', '/my-workflows/github.com/A/l');
cy.wait('@getMetadata');
cy.url().should('contain', '%2Fmy-workflows%2Fgithub.com%2FA%2Fl');
});
it('Redirects to my-services', () => {
cy.visit('/githubCallback?state=/services/github.com/garyluu/another-test-service');
cy.url().should('contain', '/services/github.com/garyluu/another-test-service');
cy.wait('@getMetadata');
cy.url().should('contain', '%2Fservices%2Fgithub.com%2Fgaryluu%2Fanother-test-service');
});
it('Redirects to dashboard', () => {
cy.visit('githubCallback?state=/dashboard');
cy.url().should('contain', '/dashboard');
cy.wait('@getMetadata');
cy.url().should('contain', '%2Fdashboard');
});
});

Expand Down
Loading

0 comments on commit d8aba8a

Please sign in to comment.