Skip to content

Commit

Permalink
Make admin user creation test to create settings
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriciovieira committed Jun 22, 2017
1 parent f2b43d1 commit 0c7a128
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
2 changes: 1 addition & 1 deletion tests/chimp-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
mochaCommandLineOptions: ['--color'],
mochaConfig: {
tags: '',
grep: '', // Change to '03' for testing the 03-user-creation.js file
grep: '03', // Change to '03' for testing the 03-user-creation.js file
timeout: 80000,
reporter: 'spec',
slow: 100,
Expand Down
28 changes: 25 additions & 3 deletions tests/end-to-end/ui/03-user-creation.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,41 @@ https://joinup.ec.europa.eu/community/eupl/og_page/european-union-public-licence

import signUpPage from '../../page-objects/signup.page';
import mainContent from '../../page-objects/main-content.page';
import settingsPage from '../../page-objects/settings.page';

import { username, email, password } from '../../data/user';

import {
username,
email,
password,
adminUsername,
adminEmail,
adminPassword,
} from '../../data/user';
import { githubClientId, githubClientSecret } from '../../data/settings';

describe('03 user creation', () => {
before(() => {
signUpPage.open();
});

it('create user', () => {
it('create admin user', () => {
// Create Admin user
signUpPage.registerNewUser({ adminUsername, adminEmail, adminPassword });

// Setup settings
signUpPage.gotModalToSetup();
settingsPage.setupGithub({ githubClientId, githubClientSecret });

mainContent.signOutLink.waitForExist(5000);
mainContent.signOutLink.isVisible().should.be.true;
mainContent.logOut();
});

it('create normal user', () => {
signUpPage.registerNewUser({ username, email, password });

mainContent.signOutLink.waitForExist(5000);
mainContent.signOutLink.isVisible().should.be.true;
mainContent.logOut();
});
});
4 changes: 2 additions & 2 deletions tests/page-objects/settings.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ https://joinup.ec.europa.eu/community/eupl/og_page/european-union-public-licence

/* globals browser */

import MainContentPage from './main-content.page';
import Page from './page';

class SettingsPage extends MainContentPage {
class SettingsPage extends Page {

// Left Menu

Expand Down
8 changes: 4 additions & 4 deletions tests/page-objects/signup.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class SignUpPage extends Page {
get confirmPasswordErrorField () { return this.errorFields[3]; }

// Modal after first signup
get settingsLink () { return browser.element('#setup-settings'); }
get modalSettingsLink () { return browser.element('#setup-settings'); }

open () {
super.open();
Expand All @@ -43,9 +43,9 @@ class SignUpPage extends Page {
this.submit();
}

gotToSetup () {
this.settingsLink.waitForVisible(5000);
this.settingsLink.click();
gotModalToSetup () {
this.modalSettingsLink.waitForVisible(5000);
this.modalSettingsLink.click();
}

submit () {
Expand Down

0 comments on commit 0c7a128

Please sign in to comment.