Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing/no auth testing branch #42

Open
wants to merge 50 commits into
base: main
Choose a base branch
from

Conversation

JoeyStewart
Copy link
Collaborator

@JoeyStewart JoeyStewart commented Jan 7, 2024

What I did:

Hey Nick, this is our separate testing branch for our project. We could not get e2e testing involving with Auth0, so this is a branch that excludes that feature and tests the rest of our project. He have a login button in this branch. It just does not test Auth0

Did this break anything?

  • No
  • Yes

Type of change

  • New feature (non-breaking change which adds functionality)
  • Styling
  • Bug fix (non-breaking change which fixes an issue)
  • Refactor(DRY-ing up/ reorganizing code, etc.)
  • Super small fix (Corrected a typo, removed a comment, etc.)
  • Skip all the other stuff and briefly explain the fix.

Checklist:

  • If this code needs to be tested, all tests are passing
  • The code runs locally
  • There are comments where clarification/ organization is needed
  • The code is DRY. If it's not, I tried my best
  • I reviewed my code before pushing

@tenthwalker tenthwalker requested a review from Jesuitman January 7, 2024 22:24
This was linked to issues Jan 7, 2024
describe('App spec', () => {
beforeEach(() => {
cy.intercept('GET', '**/w/api.php?action=query&list=search**', { fixture: 'initialSearch.json' }).as('initialSearch');
cy.intercept('GET', '**/w/api.php?action=parse&prop=sections**', { fixture: 'sectionsRequest.json' }).as('sectionsRequest');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So glad this worked!

it('Handles show more/show less functionality', () => {
cy.get('.card-content').should('be.visible');
cy.get('.card-content').first().click();
cy.get('p').should('contain', 'According to The Washington Post, \"the site\'s users have managed to pull off some of the highest-profile collective actions in the history of the Internet.\"[1]');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good job rembmering uyou can use backslashes to put quotes into strings!!!

@MaryBruff
Copy link
Collaborator

Great work fam! I am so glad we were able to figure this out and I could help with the intercepting and stubbing! claps

env: {
auth0_username: process.env.AUTH0_USERNAME,
auth0_password: process.env.AUTH0_PASSWORD,
auth0_domain: process.env.REACT_APP_AUTH0_DOMAIN,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still need this auth stuff given that we arent testing it anymore?

cy.wait('@controversiesRequest');
});

it('should display all content on page load', () => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

excellent use of the stubs and the waiting to make it load!

"continue": "-||"
},
"query": {
"searchinfo": {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good fixture


{
"batchcomplete": "",
"continue": {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good fixture

displayName: 'AUTH0 LOGIN',
message: [`🔐 Authenticating | ${username}`],
autoEnd: false,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still wish we could have gotten auth0 testing to work! darn! but glad we made the progress we did!

@@ -35,6 +38,14 @@ function App() {
randomSearch();
}, []);

const handleLogin = () => {
setIsAuthenticated(true); // Set isAuthenticated to true on login button click
};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glad i was able to get this part squared away for us!

hasError: false,
errorMessage: '',
};
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Joey im glad you could get the error state working! I'm gonna be picking your brain about this later!

import { useNavigate } from "react-router-dom";
import { useAuth0 } from "@auth0/auth0-react";
// import React from "react";
// import { Auth0Provider } from "@auth0/auth0-react";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a pain to figure out, glad you guys helped me with it

@@ -15,7 +15,7 @@ function WikipediaSearch({ saveControversy }) {
setSearchInput('');
};

const { isAuthenticated } = useAuth0();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as was this

domain={domain}
clientId={clientId}
authorizationParams={{
redirect_uri: "http://localhost:3000/"
}}
>
> */}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i cant wait for us to learn how to get the testing for it to work when we have more time!

@Jesuitman
Copy link
Owner

reviewed! glad we all were able to contribute to this!

@tenthwalker tenthwalker removed their request for review January 7, 2024 23:23
@tenthwalker tenthwalker mentioned this pull request Jan 7, 2024
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Cypress testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cypress Test API Endpoints Add PropTypes
4 participants