mirror of
https://github.com/wassname/talk.git
synced 2026-08-16 11:29:31 +08:00
First isolated e2e
This commit is contained in:
+17
-7
@@ -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'
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@ module.exports = {
|
||||
},
|
||||
ready() {
|
||||
return this
|
||||
.waitForElementVisible('body', 2000);
|
||||
.waitForElementVisible('body');
|
||||
},
|
||||
}],
|
||||
elements: {
|
||||
|
||||
@@ -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',
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user