-
Notifications
You must be signed in to change notification settings - Fork 0
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 #197 from scientist-softserv/193-mock-auth-tests
193 Mock Test Auth & 2 tests from 192
- Loading branch information
Showing
11 changed files
with
156 additions
and
16 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 |
---|---|---|
|
@@ -4,3 +4,7 @@ | |
NEXT_PUBLIC_PROVIDER_NAME=acme | ||
NEXT_PUBLIC_PROVIDER_ID=572 | ||
NEXT_PUBLIC_SCIENTIST_API_VERSION=v2 | ||
|
||
# values to use for testing | ||
TEST_SCIENTIST_USER=[email protected] | ||
TEST_SCIENTIST_PW=!test1234 |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
describe('Browsing', () => { | ||
it('completes a search from the home page and navigates to "/browse" with a blank query', () => { | ||
// Start from the home/index page | ||
cy.visit('/') | ||
|
||
// Find the search button and perform an empty search, which should lead to the browse page | ||
cy.get('button.search-button').click() | ||
|
||
// The new url should include "/browse" | ||
cy.url().should('include', '/browse') | ||
|
||
// The new url should not contain a query | ||
cy.url().should('not.include', '?') | ||
|
||
// The search bar on the browse page should remain blank | ||
cy.get('input.search-bar').should('have.value', '') | ||
}) | ||
|
||
it('completes a search from the home page and navigates to "/browse" with a query term', () => { | ||
// Start from the home/index page | ||
cy.visit('/') | ||
|
||
// type an example search into the searchbar | ||
cy.get('input.search-bar').type('next') | ||
|
||
// Press the search button | ||
cy.get('button.search-button').click() | ||
|
||
// The new url should include "/browse" | ||
cy.url().should('include', '/browse?=next') | ||
|
||
// The search bar on the browse page should have the text that was searched for | ||
cy.get('input.search-bar').should('have.value', 'next') | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
describe('Viewing all requests', () => { | ||
it('does not show a request list if the user is logged out.', () => { | ||
// Visit a protected route in order to allow cypress to set the cookie and mock the login | ||
cy.visit("/requests") | ||
|
||
cy.get('div.alert-heading').contains('Unauthorized').then(() => { | ||
cy.log("A logged out user is not able to view requests.") | ||
}) | ||
}) | ||
|
||
it("shows the user's request list if they are logged in.", () => { | ||
// Call the custom cypress command to log in | ||
cy.login(Cypress.env('TEST_SCIENTIST_USER'), Cypress.env('TEST_SCIENTIST_PW')) | ||
|
||
// Visit a protected route in order to allow cypress to set the cookie and mock the login | ||
cy.visit("/requests") | ||
|
||
// check that either the requests are showing, or that the user has no requests | ||
const requestListExists = cy.get('article.request-item').should('exist') || | ||
cy.get('p.no-requests').contains('You do not have any requests yet.') | ||
|
||
requestListExists.then(() => { | ||
cy.log('Successfully logged in and viewing request list') | ||
}) | ||
}) | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"user": { | ||
"name": "Spongebob Squarepants", | ||
"email": "[email protected]", | ||
"image": "/path/to/mock/user.jpg" | ||
}, | ||
"expires": "3000-01-01T00:00:00.000Z", | ||
"accessToken": "abcdefghijklmnopqrst" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const dotenvPlugin = require('cypress-dotenv'); | ||
module.exports = (on, config) => { | ||
config = dotenvPlugin(config) | ||
return config | ||
} |
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