Skip to content

Commit

Permalink
Signup flow e2e tests and polish
Browse files Browse the repository at this point in the history
  • Loading branch information
Harin329 committed Jun 15, 2023
1 parent 68b09bd commit a42e013
Show file tree
Hide file tree
Showing 11 changed files with 1,845 additions and 37,677 deletions.
71 changes: 71 additions & 0 deletions frontend/e2e/newUser.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { Selector } from 'testcafe';

fixture('New User').page('http://localhost:3000/');

test('Create an account', async t => {
await t
// automatically dismiss dialog boxes
.setNativeDialogHandler(() => true)

// go to signup page
.click('a[data-testid="signup"]')

// fill out form
.click('input[placeholder="Email"]')
.typeText('input[placeholder="Email"]', '[email protected]')
.click('input[placeholder="First Name"]')
.typeText('input[placeholder="First Name"]', 'Test')
.click('input[placeholder="Last Name"]')
.typeText('input[placeholder="Last Name"]', 'User')
.click('input[placeholder="Password"]')
.typeText('input[placeholder="Password"]', 'password')

// click signup
.click('button[data-testid="SignupButton"]')

// login
.click('input[placeholder="Email"]')
.typeText('input[placeholder="Email"]', '[email protected]')
.click('input[placeholder="Password"]')
.typeText('input[placeholder="Password"]', 'password')

// click login
.click('button[data-testid="LoginButton"]');

// check that we are on the home page
const homePage = Selector('div').withText('MAPcore Services');
await t.expect(homePage.exists).ok();
});

test('Approve new employee', async t => {
await t
// automatically dismiss dialog boxes
.setNativeDialogHandler(() => true)

// login
.click('input[placeholder="Email"]')
.typeText('input[placeholder="Email"]', '[email protected]')
.click('input[placeholder="Password"]')
.typeText('input[placeholder="Password"]', 'password')

// click login
.click('button[data-testid="LoginButton"]')

// go to administration page
.click('a[data-testid="admin"]')

// go to users tab
.click('a[data-testid="users"]')

// approve all
.click('button[data-testid="approveAllButton"]')

// select dropdown in row with name "Test User"
.click('div[data-testid="[email protected]"]')
.typeText('div[data-testid="[email protected]"]', 'Yes')
.pressKey('enter')

// delete user
.click('img[data-testid="[email protected]"]')
.click(Selector('button').withText('Delete'));
});
Loading

0 comments on commit a42e013

Please sign in to comment.