DEV Community

AjeaS
AjeaS

Posted on

Self-documentation of Hire +Plus: V1 (5)

What I cover

  • Testing for Launch page
  • Testing for Auth page

Testing Launch page

I made a few changes to the launch.spec.js test file. Here's what it looks like now

describe('Launch Page', () => {
    before(() => {
        cy.visit('http://localhost:3000');
    });
    it('renders the launch page', () => {
        cy.contains('For Employers');
    });
    it('redirect to auth page', () => {
        cy.contains('GET STARTED').click();

        cy.url().should('include', '/auth');
    });
});
Enter fullscreen mode Exit fullscreen mode

Created a test for Auth page

auth.spec.js test file has simple tests to ensure the correct components are rendering when a user routes to the auth/employees and auth/employer routes.

describe('Authentication for employees', () => {
    before(() => {
        cy.visit('http://localhost:3000/auth/employees');
    });
    it('should show the login component', () => {
        cy.contains('Already have an account?');
    });
    it('should show the sign up component', () => {
        cy.contains("Don't have an account?");
    });
});
describe('Authentication for employer', () => {
    before(() => {
        cy.visit('http://localhost:3000/auth/employer');
    });
    it('should show the login component', () => {
        cy.contains('Already have an account?');
    });
    it('should show the sign up component', () => {
        cy.contains("Don't have an account?");
    });
});
Enter fullscreen mode Exit fullscreen mode

That's all for now. Stay tuned for more. View the source code here.

Top comments (0)