Skip to content

Commit

Permalink
Add rudimentary Cypress test
Browse files Browse the repository at this point in the history
  • Loading branch information
williamjallen committed May 23, 2024
1 parent 1399ac2 commit 8104ae8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions resources/js/components/AllProjects.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
:rows="formatProjectResults(result.projects.edges)"
:full-width="true"
class="projects-table"
data-cy="all-projects"
>
<template #last_submission="{ props: { project } }" >
<a
Expand Down
22 changes: 22 additions & 0 deletions tests/cypress/e2e/all-projects.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* TODO: Make this test independent of the other tests.
*/
describe('All projects page', () => {
it('switches between active and all projects', () => {
cy.visit('/projects');
cy.get('[data-cy="all-projects"]').should('not.contain', 'never');
cy.contains('Show All Projects').click();
cy.get('[data-cy="all-projects"]').should('contain', 'never');
cy.contains('Show Active Projects').click();
cy.get('[data-cy="all-projects"]').should('not.contain', 'never');
});

it('shows private projects when logged in', () => {
cy.visit('/projects/all');
// ProjectTest4Db is a random private project generated by previous tests
cy.get('[data-cy="all-projects"]').should('not.contain', 'ProjectTest4Db');
cy.login();
cy.visit('/projects/all');
cy.get('[data-cy="all-projects"]').should('contain', 'ProjectTest4Db');
});
});

0 comments on commit 8104ae8

Please sign in to comment.