Skip to content

Test Implementation and Basic User Creation Script #749

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
291 changes: 291 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions packages/app/cypress/e2e/tests/Scripts/CreateUser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const { PrismaClient } = require('@prisma/client');

const prisma = new PrismaClient();

async function createTestingUser() {
try {
await prisma.user.create({
data: {
name: 'testinguser',
// email: 'test@example.com',
// password: 'securepassword',
},
});
} catch (error) {
console.error('Error creating testing user: ', error);
} finally {
await prisma.$disconnect();
}
}

createTestingUser();
15 changes: 15 additions & 0 deletions packages/app/cypress/e2e/tests/TestLogin.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
beforeEach(() => {
// Navigate to homepage
cy.visit("/");
});

it("can reach the login page and access github API", () => {
// cy.contains('button', 'Sign in').click()
cy.get('[data-cy="sign in"]').click()

// cy.url().should('include', 'github.com/login')
cy.on("url:changed", (newUrl) => {
expect(newUrl).to.contain("github.com/login")
})
});

14 changes: 14 additions & 0 deletions packages/app/cypress/e2e/tests/TestPageMetaData.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
beforeEach(() => {
// Navigate to homepage
cy.visit("/");
});

it("test meta data", () => {
// Test title
cy.get('head title').should('include.text', 'CodeRacer')

// Test description
cy.get('head meta[name=description]')
.should('have.attr', 'content')
.should('include', 'Accelerating coding skills, competitive thrills!')
});
Empty file.
1 change: 1 addition & 0 deletions packages/app/src/components/ui/buttons.tsx
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@ export const LoginButton = () => {
<Button
variant="outline"
className="flex gap-2 px-4"
data-cy="sign in"
onClick={() =>
signIn("github", {
callbackUrl: `${location.origin}/race`,