mirror of
https://github.com/wassname/talk.git
synced 2026-08-12 12:30:39 +08:00
Updated login
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const iframeId = 'coralStreamEmbed_iframe';
|
||||
const SortedWindowHandler = require('../utils/SortedWindowHandler');
|
||||
|
||||
module.exports = {
|
||||
commands: [{
|
||||
@@ -18,36 +19,53 @@ module.exports = {
|
||||
return this.section.embed;
|
||||
},
|
||||
login(user = {}) {
|
||||
|
||||
const embed = this
|
||||
.navigate()
|
||||
.getEmbedSection();
|
||||
|
||||
const windowHandler = new SortedWindowHandler(this);
|
||||
|
||||
embed
|
||||
.waitForElementVisible('@signInButton')
|
||||
.click('@signInButton');
|
||||
|
||||
this.api.pause(3000);
|
||||
// Wait for window to be created
|
||||
// https://www.browserstack.com/automate/builds/1ceccf4efb4683b7feb890f45a32b5922b40ed3f/sessions/17b1a79682bef2498cb0be86eac317a08c976b0a#automate_button
|
||||
this.api.pause(200);
|
||||
|
||||
// Focusing on the Login PopUp
|
||||
this.api.windowHandles((result) => {
|
||||
const handle = result.value[1];
|
||||
this.api.switchWindow(handle);
|
||||
windowHandler.windowHandles((handles) => {
|
||||
this.api.switchWindow(handles[1]);
|
||||
});
|
||||
|
||||
|
||||
const login = this.api.page.login();
|
||||
|
||||
|
||||
login
|
||||
.waitForElementVisible('@registerButton')
|
||||
.click('@registerButton')
|
||||
.setValue('@emailInput', user.email)
|
||||
.setValue('@usernameInput', user.username)
|
||||
.setValue('@passwordInput', user.password)
|
||||
.setValue('@confirmPasswordInput', user.password)
|
||||
.waitForElementVisible('@signUpButton')
|
||||
.click('@signUpButton')
|
||||
.waitForElementVisible('@signIn')
|
||||
.waitForElementVisible('@loginButton')
|
||||
.click('@loginButton');
|
||||
|
||||
|
||||
// Give a tiny bit of time to let popup close.
|
||||
this.api.pause(50);
|
||||
|
||||
if (this.api.capabilities.browserName === 'MicrosoftEdge') {
|
||||
|
||||
// More time for edge.
|
||||
// https://www.browserstack.com/automate/builds/1ceccf4efb4683b7feb890f45a32b5922b40ed3f/sessions/7393dbfda8387e43b6d5851f359b0c07db414973
|
||||
this.api.pause(1000);
|
||||
}
|
||||
|
||||
// Focusing on the Embed Window
|
||||
this.api.windowHandles((result) => {
|
||||
const handle = result.value[0];
|
||||
this.api.switchWindow(handle);
|
||||
windowHandler.windowHandles((handles) => {
|
||||
this.api.switchWindow(handles[0]);
|
||||
});
|
||||
},
|
||||
logout() {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
const SortedWindowHandler = require('../utils/SortedWindowHandler');
|
||||
|
||||
module.exports = {
|
||||
'@tags': ['embedStream', 'login'],
|
||||
'creates a new asset': (client) => {
|
||||
@@ -16,54 +14,8 @@ module.exports = {
|
||||
const {testData: {user}} = client.globals;
|
||||
const embedStream = client.page.embedStream();
|
||||
|
||||
const embed = embedStream
|
||||
.navigate()
|
||||
.getEmbedSection();
|
||||
|
||||
const windowHandler = new SortedWindowHandler(client);
|
||||
|
||||
embed
|
||||
.waitForElementVisible('@signInButton')
|
||||
.click('@signInButton');
|
||||
|
||||
// Wait for window to be created
|
||||
// https://www.browserstack.com/automate/builds/1ceccf4efb4683b7feb890f45a32b5922b40ed3f/sessions/17b1a79682bef2498cb0be86eac317a08c976b0a#automate_button
|
||||
client.pause(200);
|
||||
|
||||
// Focusing on the Login PopUp
|
||||
windowHandler.windowHandles((handles) => {
|
||||
client.switchWindow(handles[1]);
|
||||
});
|
||||
|
||||
const login = client.page.login();
|
||||
|
||||
login
|
||||
.waitForElementVisible('@registerButton')
|
||||
.click('@registerButton')
|
||||
.setValue('@emailInput', user.email)
|
||||
.setValue('@usernameInput', user.username)
|
||||
.setValue('@passwordInput', user.password)
|
||||
.setValue('@confirmPasswordInput', user.password)
|
||||
.waitForElementVisible('@signUpButton')
|
||||
.click('@signUpButton')
|
||||
.waitForElementVisible('@signIn')
|
||||
.waitForElementVisible('@loginButton')
|
||||
.click('@loginButton');
|
||||
|
||||
// Give a tiny bit of time to let popup close.
|
||||
client.pause(50);
|
||||
|
||||
if (client.capabilities.browserName === 'MicrosoftEdge') {
|
||||
|
||||
// More time for edge.
|
||||
// https://www.browserstack.com/automate/builds/1ceccf4efb4683b7feb890f45a32b5922b40ed3f/sessions/7393dbfda8387e43b6d5851f359b0c07db414973
|
||||
client.pause(1000);
|
||||
}
|
||||
|
||||
// Focusing on the Embed Window
|
||||
windowHandler.windowHandles((handles) => {
|
||||
client.switchWindow(handles[0]);
|
||||
});
|
||||
embedStream
|
||||
.login(user);
|
||||
},
|
||||
'user posts a comment': (client) => {
|
||||
const embedStream = client.page.embedStream();
|
||||
|
||||
Reference in New Issue
Block a user