Skip to content

Commit

Permalink
Fix codefactor
Browse files Browse the repository at this point in the history
  • Loading branch information
audiodude committed May 3, 2024
1 parent 7c92ea9 commit 0c6b468
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions wp1-frontend/cypress/e2e/createWikiProjectList.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ describe('the create WikiProject builder page', () => {
});

it('displays a textbox with invalid wikiProjects', () => {
cy.get('#listName > .form-control').click().type('List name');
cy.get('#include-items').click().type('Fake Project 1\nAnother Fake');
cy.get('#listName > .form-control').click();
cy.get('#listName > .form-control').type('List name');
cy.get('#include-items').click();
cy.get('#include-items').type('Fake Project 1\nAnother Fake');
cy.intercept('v1/builders/', {
fixture: 'save_wikiproject_failure.json',
});
Expand Down Expand Up @@ -68,8 +70,10 @@ describe('the create WikiProject builder page', () => {
}
});

cy.get('#listName > .form-control').click().type('List Name');
cy.get('#include-items').click().type('Fake Project 1\nAnother Fake');
cy.get('#listName > .form-control').click();
cy.get('#listName > .form-control').type('List Name');
cy.get('#include-items').click();
cy.get('#include-items').type('Fake Project 1\nAnother Fake');
cy.get('#saveListButton').click();
cy.get('#saveListButton').click();
cy.url().should('eq', 'http://localhost:5173/#/selections/user');
Expand All @@ -87,23 +91,29 @@ describe('the create WikiProject builder page', () => {
});

it('shows spinner', () => {
cy.get('#listName > .form-control').click().type('List Name');
cy.get('#include-items').click().type('Fake Project');
cy.get('#listName > .form-control').click();
cy.get('#listName > .form-control').type('List Name');
cy.get('#include-items').click();
cy.get('#include-items').type('Fake Project');
cy.get('#saveListButton').click();
cy.get('#saveLoader').should('be.visible');
});

it('disables save button', () => {
cy.get('#listName > .form-control').click().type('List Name');
cy.get('#include-items').click().type('Fake Project');
cy.get('#listName > .form-control').click();
cy.get('#listName > .form-control').type('List Name');
cy.get('#include-items').click();
cy.get('#include-items').type('Fake Project');
cy.get('#saveListButton').click();
cy.get('#saveListButton').should('have.attr', 'disabled');
});
});

it('redirects on saving valid project names', () => {
cy.get('#listName > .form-control').click().type('List Name');
cy.get('#include-items').click().type('Fake Project\nAnother Fake');
cy.get('#listName > .form-control').click();
cy.get('#listName > .form-control').type('List Name');
cy.get('#include-items').click();
cy.get('#include-items').type('Fake Project\nAnother Fake');
cy.intercept('v1/builders/', { fixture: 'save_list_success.json' });
cy.get('#saveListButton').click();
cy.url().should('eq', 'http://localhost:5173/#/selections/user');
Expand Down

0 comments on commit 0c6b468

Please sign in to comment.