First isolated e2e

This commit is contained in:
Chi Vinh Le
2017-10-16 22:27:49 +07:00
parent 606871e4b7
commit f38e718373
12 changed files with 306 additions and 114 deletions
+17 -7
View File
@@ -1,14 +1,24 @@
const uuid = require('uuid');
const {murmur3} = require('murmurhash-js');
const rHash = murmur3(uuid.v4());
const serve = require('../../scripts/e2e-serve');
const mongoose = require('../../services/mongoose');
const {shutdown} = require('../../bin/util');
module.exports = {
before: async (done) => {
await mongoose.connection.dropDatabase();
await serve();
done();
},
after: (done) => {
shutdown();
done();
},
waitForConditionTimeout: 5000,
testData: {
admin: {
email: 'admin@test.com',
username: 'admin',
password: 'testtest',
},
organizationName: 'Coral',
email: `test_${rHash}@test.test`,
username: `test${rHash}`,
password: `testpassword${rHash}`,
domain: 'http://localhost:3000'
}
};
+1 -1
View File
@@ -5,7 +5,7 @@ module.exports = {
},
ready() {
return this
.waitForElementVisible('body', 2000);
.waitForElementVisible('body');
},
}],
elements: {
+2 -2
View File
@@ -5,7 +5,7 @@ module.exports = {
},
ready() {
return this
.waitForElementVisible('body', 2000);
.waitForElementVisible('body');
}
}],
elements: {
@@ -20,7 +20,7 @@ module.exports = {
'step3ConfirmPasswordInput': '.talk-install-step-3 #confirmPassword',
'step3saveButton': '.talk-install-step-3-save-button',
'step4': '.talk-install-step-4',
'step4DomainInput': '.talk-install-step-4-permited-domains-input',
'step4DomainInput': '.talk-install-step-4-permited-domains-input input',
'step4saveButton': '.talk-install-step-4-save-button',
}
};
+12 -13
View File
@@ -2,7 +2,7 @@ module.exports = {
'@tags': ['install'],
'User goes to install': (client) => {
const installPage = client.page.installPage();
installPage
.navigate()
.ready();
@@ -10,14 +10,14 @@ module.exports = {
},
'User clicks get started button': (client) => {
const installPage = client.page.installPage();
installPage
.waitForElementVisible('@getStartedButton')
.click('@getStartedButton');
},
'User should see step 2 - Add Organization Name': (client) => {
const installPage = client.page.installPage();
installPage
.waitForElementVisible('@step2');
},
@@ -33,38 +33,37 @@ module.exports = {
},
'User should see step 3 - Create your account': (client) => {
const installPage = client.page.installPage();
installPage
.waitForElementVisible('@step3');
},
'User fills step 3': (client) => {
const installPage = client.page.installPage();
const {testData} = client.globals;
const {testData: {admin}} = client.globals;
installPage
.setValue('@step3EmailInput', testData.email)
.setValue('@step3UsernameInput', testData.username)
.setValue('@step3PasswordInput', testData.password)
.setValue('@step3ConfirmPasswordInput', testData.password)
.setValue('@step3EmailInput', admin.email)
.setValue('@step3UsernameInput', admin.username)
.setValue('@step3PasswordInput', admin.password)
.setValue('@step3ConfirmPasswordInput', admin.password)
.waitForElementVisible('@step3saveButton')
.click('@step3saveButton');
},
'User should see step 4 - Domain Whitelist': (client) => {
const installPage = client.page.installPage();
installPage
.waitForElementVisible('@step4');
},
'User fills step 4': (client) => {
const installPage = client.page.installPage();
const testData = client.page.getTestData();
installPage
.waitForElementVisible('@step4DomainInput')
.setValue('@step4DomainInput', testData.domain);
.setValue('@step4DomainInput', client.launchUrl);
client.keys(client.Keys.ENTER);
installPage
.waitForElementVisible('@step4saveButton')
.click('@step4saveButton');
+5 -4
View File
@@ -2,13 +2,14 @@ module.exports = {
'@tags': ['admin', 'login'],
'Admin logs in': (client) => {
const adminPage = client.page.adminPage();
const {testData} = client.globals;
const {testData: {admin}} = client.globals;
adminPage
.navigate()
.waitForElementVisible('@loginLayout')
.waitForElementVisible('@signInForm')
.setValue('@emailInput', testData.email)
.setValue('@passwordInput', testData.password)
.setValue('@emailInput', admin.email)
.setValue('@passwordInput', admin.password)
.waitForElementVisible('@signInButton')
.click('@signInButton');
@@ -1,18 +1,13 @@
const uuid = require('uuid');
const {murmur3} = require('murmurhash-js');
module.exports = {
'Creates a new asset': (client) => {
const asset = `test@${murmur3(uuid.v4())}`;
const asset = 'newAssetTest';
const embedStream = client.page.embedStream();
embedStream
.navigateToAsset(asset)
.assert.title(asset)
.getEmbedSection();
client
.end();
},
'not logged in user clicks my profile tab': (client) => {
@@ -27,8 +22,9 @@ module.exports = {
profile
.assert.visible('@notLoggedIn');
client
.end();
},
after: (client) => {
client.end();
}
};