-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
setting up database cleanup for cypress tests
- Loading branch information
Showing
5 changed files
with
59 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,5 +1,6 @@ | ||
{ | ||
"devDependencies": { | ||
"cypress": "^9.5.3", | ||
"husky": "^7.0.4", | ||
"lerna": "^4.0.0" | ||
}, | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,60 @@ | ||
describe.only('The login flow and user creation flow', () => { | ||
before(() => { | ||
|
||
cy.task("db:tableCleanup"); | ||
|
||
}) | ||
|
||
it('should ensure login page loads correctly', () => { | ||
|
||
cy.visit('/'); | ||
cy.get('[data-cy=email]').should('exist'); | ||
cy.get('[data-cy=continue]').should('exist'); | ||
cy.get('[data-cy=continue]').should('be.disabled'); | ||
cy.get('[data-cy=continueGoogle]').should('exist'); | ||
|
||
|
||
//get users.json fixtures file | ||
cy.fixture('users').as('myUserFixture'); | ||
|
||
//create test data | ||
const email = '[email protected]'; | ||
const fullName = 'Test User'; | ||
const password = 'P@ssword123'; | ||
const farmName = 'UBC FARM'; | ||
const location = '49.250833,-123.2410777'; | ||
//type email from the first user in users.json file into email input | ||
cy.get('@myUserFixture').then((user) => { | ||
cy.get('[data-cy=email]').type(user[0].email).then(()=>{ | ||
//check that the continue button is enabled | ||
cy.contains('Continue').should('exist').should('be.enabled').click(); | ||
}); | ||
}); | ||
|
||
|
||
|
||
cy.get('[data-cy=email]').type(email); | ||
//check that the continue button is enabled | ||
cy.contains('Continue').should('exist').and('be.enabled').click(); | ||
|
||
//check you are on the create user account page | ||
cy.contains('Create new user account').should('exist'); | ||
|
||
//type a fullName | ||
cy.fixture('users').as('myUserFixture'); | ||
cy.get('@myUserFixture').then((user) => { | ||
cy.get('[data-cy=createUser-fullName]').type(user[0].name); | ||
}); | ||
cy.get('[data-cy=createUser-fullName]').type(fullName); | ||
|
||
//type a password | ||
cy.get('[data-cy=createUser-password]').type('P@ssword123'); | ||
cy.get('[data-cy=createUser-password]').type(password); | ||
//click create account | ||
cy.contains('Create Account').should('exist').should('be.enabled').click(); | ||
cy.contains('Create Account').should('exist').and('be.enabled').click(); | ||
|
||
cy.contains('started').should('exist'); | ||
cy.pause(); | ||
|
||
|
||
// Get Started page | ||
cy.get('[data-cy=getStarted]').should('exist'); | ||
cy.get('[data-cy=getStarted]').click(); | ||
// Step 1 | ||
cy.get('[data-cy=addFarm-continue]').should('exist'); | ||
cy.get('[data-cy=addFarm-continue]').should('be.disabled'); | ||
cy.get('[data-cy=addFarm-farmName]').should('exist'); | ||
cy.get('[data-cy=addFarm-location]').should('exist'); | ||
|
||
// Step 2 | ||
|
||
cy.get('[data-cy=addFarm-farmName]').type('UBC FARM'); | ||
cy.get('[data-cy=addFarm-location]').type('49.250833,-123.2410777'); | ||
cy.get('[data-cy=addFarm-continue]').should('not.be.disabled'); | ||
cy.get('[data-cy=addFarm-continue]').click(); | ||
cy.get('[data-cy=getStarted]').should('exist'); | ||
cy.get('[data-cy=getStarted]').click(); | ||
|
||
// Step 1 | ||
cy.get('[data-cy=addFarm-continue]').should('exist'); | ||
cy.get('[data-cy=addFarm-continue]').should('be.disabled'); | ||
cy.get('[data-cy=addFarm-farmName]').should('exist'); | ||
cy.get('[data-cy=addFarm-location]').should('exist'); | ||
|
||
// Step 2 | ||
cy.get('[data-cy=addFarm-farmName]').type(farmName); | ||
cy.get('[data-cy=addFarm-location]').type(location); | ||
cy.get('[data-cy=addFarm-continue]').should('not.be.disabled'); | ||
cy.get('[data-cy=addFarm-continue]').click(); | ||
|
||
|
||
|
||
}); | ||
|
||
|
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