Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function waitForTextToBe(
target: ElementFinder | Locator | string,
value: string,
timeout: number = DEFAULT_TIMEOUT
): webdriver.promise.Promise {
const e: ElementFinder = getElementFinder(target);
// Don't use EC.textToBePresentInElement because it doesn't return a promise which we can catch
return browser.wait(
() => {
return waitToBeDisplayed(e, timeout)
.then(() => {
return getElementFinder(target).getText();
})
.then((text: string) => text === value, () => false);
},
timeout,
`Error waiting for text in ${e.locator()} to be ${value}`
);
}
it('can add a new user as a member', () => {
expect(projectSettingsPage.membersTab.list.count()).toBe(memberCount);
projectSettingsPage.membersTab.addButton.click();
browser.wait(ExpectedConditions.visibilityOf(projectSettingsPage.membersTab.newMember.input),
Utils.conditionTimeout);
projectSettingsPage.membersTab.newMember.input.sendKeys('du');
// sendKeys is split to force correct button behaviour. IJH 2015-10
projectSettingsPage.membersTab.newMember.input.sendKeys('de');
projectSettingsPage.membersTab.newMember.button.click();
projectSettingsPage.membersTab.waitForNewUserToLoad(memberCount);
expect(projectSettingsPage.membersTab.list.count()).toBe(memberCount + 1);
});
await LoginHelper.navigateToRegisterViaHeader();
await registerPage.waitForReady();
const testUserId = Date.now() - 1535535333333;
const userEmail = `user${testUserId}@${LoginHelper.DEFAULT_USER_DOMAIN}`;
const userPassword = LoginHelper.DEFAULT_PASSWORD;
await registerPage.registerForm.fillInForm(
LoginHelper.DEFAULT_TITLE,
LoginHelper.DEFAULT_FIRST_NAME,
LoginHelper.DEFAULT_LAST_NAME,
userEmail,
userPassword
);
await registerPage.registerForm.submit();
await browser.wait(
ExpectedConditions.urlIs('http://localhost:4200/'),
5000
);
await LoginHelper.logOutViaHeader();
// Let's fill the same
await LoginHelper.navigateToRegisterViaHeader();
await registerPage.waitForReady();
await registerPage.registerForm.fillInForm(
LoginHelper.DEFAULT_TITLE,
LoginHelper.DEFAULT_FIRST_NAME,
LoginHelper.DEFAULT_LAST_NAME,
userEmail,
userPassword
);
await registerPage.registerForm.submit();
export const isLoaded = () =>
browser
.wait(until.and(waitForNone($$('.co-m-loader')), until.visibilityOf(saveButton)))
.then(() => browser.sleep(1000));
it('uninstalls Operator from the cluster', async () => {
await operatorHubView.operatorModalUninstallBtn.click();
await browser.wait(until.visibilityOf($('.co-catalog-install-modal')));
await element(by.cssContainingText('#confirm-action', 'Remove')).click();
await crudView.isLoaded();
await browser.wait(until.invisibilityOf(crudView.rowForOperator('Jaeger Tracing')), 5000);
expect(crudView.rowForOperator('Jaeger Tracing').isPresent()).toBe(false);
});
});
export const catalogDetailsLoaded = () =>
browser.wait(until.presenceOf($('.modal-content')), 10000).then(() => browser.sleep(1000));
export const createServiceInstanceButton = $('.co-catalog-page__overlay-create');
async getCommentById(commentId?: string) {
if (commentId) {
return browser.wait(until.elementLocated(by.id(`${CommentsTab.selectors.commentById}${commentId}`)), BROWSER_WAIT_TIMEOUT / 2);
}
return this.getCommentListItem();
}
getTitleText() {
let title;
return browser
.wait(() => {
title = $('.panel-title');
return title.isPresent();
})
.then(() => title.getText());
}
isPresentBreadcrumb() {
browser.wait(EC.presenceOf(this.breadcrumbTag), 5000);
return this.breadcrumbTag.isPresent();
}
} else {
await _$$(`option[value*="year"]`).first().click();
await _$$(`option[value*="year"]`).first().click();
}
const parsedPath = path.parse(absolutePath);
const fileValue = await this.upload.getAttribute('value');
if (fileValue) {
await this.upload.safeClear();
await this.upload.safeClear();
await browser.wait(EC.textToBePresentInElementValue(this.upload, ''), 15000);
}
await this.upload.safeSendKeys(absolutePath);
await browser.wait(EC.textToBePresentInElementValue(this.upload, parsedPath.base), 15000);
await _$$('.ok-btn').first().safeClick();
await waitForErrorMessage();
}
}