-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1118 from saithsab877/fix-unit-test
Updates to Cypress Tests to Avoid Failures
- Loading branch information
Showing
8 changed files
with
44 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,56 @@ | ||
/* eslint-disable @typescript-eslint/typedef */ | ||
describe('Alice Create a Workspace and then Edit to validate characters the limit', () => { | ||
const workspace = { | ||
const worksapce = { | ||
loggedInAs: 'alice', | ||
name: 'Cypress Workspace1', | ||
description: 'Cypress Work description' | ||
}; | ||
|
||
const orgExceedingLimits = { | ||
name: 'ThisNameIsWayTooLongForAnWorkspace', | ||
description: 'x'.repeat(121) // Exact 121 characters | ||
description: | ||
'This description is intentionally made longer than one hundred and twenty characters to test the be validation functionality of the workspace creation form.' | ||
}; | ||
|
||
it('should not allow editing a workspace with excessive character limits', () => { | ||
Cypress.config('defaultCommandTimeout', 30000); | ||
cy.login(worksapce.loggedInAs); | ||
cy.wait(1000); | ||
|
||
cy.login(workspace.loggedInAs); | ||
cy.clickAlias(workspace.loggedInAs); | ||
cy.clickAlias(worksapce.loggedInAs); | ||
cy.wait(1000); | ||
|
||
cy.contains('Workspaces').should('exist').click({ force: true }); | ||
cy.contains('Workspaces').click(); | ||
cy.wait(1000); | ||
|
||
cy.get('body').then(($body) => { | ||
const overlay = $body.find('#sphinx-top-level-overlay'); | ||
if (overlay.length) { | ||
overlay.remove(); | ||
} | ||
}); | ||
cy.contains('Add Workspace').click(); | ||
cy.wait(1000); | ||
|
||
cy.contains('button', /^Edit$/).click({ force: true }); | ||
cy.get('[placeholder="My Workspace..."]').type(worksapce.name); | ||
cy.get('[placeholder="Description Text..."]').type(worksapce.description); | ||
|
||
cy.get('#name').invoke('val', '').type(orgExceedingLimits.name); | ||
cy.get('#description').invoke('val', '').type(orgExceedingLimits.description); | ||
cy.wait(600); | ||
|
||
cy.get('input#name').then(($input) => { | ||
expect($input.parent().find('p').text()).to.include('name is too long'); | ||
}); | ||
cy.get('[data-testid="add-workspace"]').contains('Add Workspace').click(); | ||
cy.wait(1000); | ||
|
||
cy.contains('.org-text-wrap', worksapce.name) | ||
.parents('.org-data') | ||
.within(() => { | ||
cy.get('button').contains('Manage').click(); | ||
}); | ||
cy.wait(1000); | ||
|
||
cy.get('textarea#description').then(($textarea) => { | ||
expect($textarea.parent().find('p').text()).to.include('Description is too long'); | ||
cy.contains(/^Edit$/).click(); | ||
cy.wait(1000); | ||
|
||
cy.get('#name').type(orgExceedingLimits.name); | ||
cy.get('#description').type(orgExceedingLimits.description); | ||
cy.wait(1000); | ||
|
||
cy.get('input#name').then(($input) => { | ||
cy.wrap($input.closest('div')).find('p').should('contain.text', 'name is too long'); | ||
}); | ||
|
||
cy.window().then((win) => win.location.reload()); | ||
cy.get('body').click(0, 0); | ||
cy.logout(worksapce.loggedInAs); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters