How to use getTitle method in Webdriverio

Best JavaScript code snippet using webdriverio-monorepo

routes-config.js

Source:routes-config.js Github

copy

Full Screen

1import React from 'react';2import { Redirect as RouterRedirect } from 'react-router-dom';3import { makeLazyLoader, routes } from '@deriv/shared';4import { Loading } from '@deriv/components';5import { localize } from '@deriv/translations';6import { Redirect } from 'App/Containers/Redirect';7import Endpoint from 'Modules/Endpoint';8// Error Routes9const Page404 = React.lazy(() => import(/* webpackChunkName: "404" */ 'Modules/Page404'));10const Trader = React.lazy(() => {11 // eslint-disable-next-line import/no-unresolved12 return import(/* webpackChunkName: "trader" */ '@deriv/trader');13});14const Account = React.lazy(() => {15 // eslint-disable-next-line import/no-unresolved16 return import(/* webpackChunkName: "account" */ '@deriv/account');17});18const Cashier = React.lazy(() => {19 // eslint-disable-next-line import/no-unresolved20 return import(/* webpackChunkName: "cashier" */ '@deriv/cashier');21});22const Bot = React.lazy(() => {23 // eslint-disable-next-line import/no-unresolved24 return import(/* webpackChunkName: "bot" */ '@deriv/bot-web-ui');25});26const Dashboard = React.lazy(() => {27 // eslint-disable-next-line import/no-unresolved28 return import(/* webpackChunkName: "dashboard" */ 'Modules/Dashboard');29});30const getModules = ({ is_dashboard }) => {31 const modules = [32 {33 path: routes.bot,34 component: Bot,35 // Don't use `Localize` component since native html tag like `option` cannot render them36 getTitle: () => localize('Bot'),37 },38 {39 path: routes.dashboard,40 component: Dashboard,41 is_modal: true,42 getTitle: () => localize('Dashboard'),43 routes: [44 {45 path: routes.home,46 component: Dashboard,47 icon_component: 'IcUserOutline',48 getTitle: () => localize('Home'),49 },50 {51 path: routes.my_apps,52 component: Dashboard,53 is_modal: true,54 icon_component: 'IcUserOutline',55 getTitle: () => localize('My Apps'),56 },57 {58 path: routes.explore,59 component: Dashboard,60 icon_component: 'IcWalletExplore',61 getTitle: () => localize('Explore'),62 },63 {64 path: routes.about_us,65 component: Dashboard,66 getTitle: () => localize('About Us'),67 },68 {69 path: routes.resources,70 component: Dashboard,71 getTitle: () => localize('Resources'),72 },73 ],74 },75 {76 path: routes.wallets,77 component: Dashboard,78 is_modal: true,79 icon_component: 'IcWalletWallets',80 getTitle: () => localize('Wallets'),81 routes: [82 {83 getTitle: () => localize('Credit/Debit Cards'),84 // path: routes.wallets_cards,85 path: routes.explore,86 },87 {88 getTitle: () => localize('E-wallet'),89 // path: routes.wallets_ewallet,90 path: routes.explore,91 },92 {93 getTitle: () => localize('Cryptocurrency'),94 // path: routes.wallets_crypto,95 path: routes.explore,96 },97 {98 getTitle: () => localize('Bank Wire'),99 // path: routes.wallets_bank,100 path: routes.explore,101 },102 ],103 },104 {105 path: routes.platforms,106 component: Dashboard,107 is_modal: true,108 icon_component: 'IcWalletPlatforms',109 getTitle: () => localize('Platforms'),110 routes: [111 {112 default: true,113 getTitle: () => localize('DMT5'),114 path: routes.platform_dmt5,115 },116 {117 default: true,118 getTitle: () => localize('DMT5 Financial STP'),119 path: routes.platform_dmt5_financial_stp,120 },121 {122 default: true,123 getTitle: () => localize('DMT5 Financial'),124 path: routes.platform_dmt5_financial,125 },126 {127 default: true,128 getTitle: () => localize('DMT5 Synthetic'),129 path: routes.platform_dmt5_synthetic,130 },131 {132 getTitle: () => localize('DTrader'),133 // path: routes.platform_dtrader,134 path: routes.explore,135 },136 {137 getTitle: () => localize('DBot'),138 // path: routes.platform_dbot,139 path: routes.explore,140 },141 {142 getTitle: () => localize('SmartTrader'),143 // path: routes.platform_smarttrader,144 path: routes.explore,145 },146 {147 getTitle: () => localize('Binary Bot'),148 // path: routes.platform_binarybot,149 path: routes.explore,150 },151 ],152 },153 {154 path: routes.trade_types,155 component: Dashboard,156 is_modal: true,157 icon_component: 'IcWalletTradeTypes',158 getTitle: () => localize('Trade Types'),159 routes: [160 {161 getTitle: () => localize('CFDs'),162 // path: routes.trade_types_cfds,163 path: routes.explore,164 },165 {166 getTitle: () => localize('Multipliers'),167 // path: routes.trade_types_multipliers,168 path: routes.explore,169 },170 {171 getTitle: () => localize('Options'),172 // path: routes.trade_types_options,173 path: routes.explore,174 },175 ],176 },177 {178 path: routes.markets,179 component: Dashboard,180 is_modal: true,181 icon_component: 'IcWalletMarkets',182 getTitle: () => localize('Markets'),183 routes: [184 {185 getTitle: () => localize('Forex'),186 // path: routes.markets_forex,187 path: routes.explore,188 },189 {190 getTitle: () => localize('Synthetic Indices'),191 // path: routes.markets_synthetic,192 path: routes.explore,193 },194 {195 getTitle: () => localize('Stock Indices'),196 // path: routes.markets_stock,197 path: routes.explore,198 },199 {200 getTitle: () => localize('Commodities'),201 // path: routes.markets_commodities,202 path: routes.explore,203 },204 ],205 },206 {207 path: routes.account_deactivated,208 component: Account,209 getTitle: () => localize('Account deactivated'),210 },211 {212 path: routes.account,213 component: Account,214 getTitle: () => localize('Account Settings'),215 icon_component: 'IcUserOutline',216 is_authenticated: true,217 // TODO: Revisit this workaround for subroutes [app-routing]218 routes: [219 {220 getTitle: () => localize('Profile'),221 icon: 'IcUserOutline',222 subroutes: [223 {224 path: routes.personal_details,225 component: Account,226 getTitle: () => localize('Personal details'),227 default: true,228 },229 {230 path: routes.financial_assessment,231 component: Account,232 getTitle: () => localize('Financial assessment'),233 },234 ],235 },236 {237 getTitle: () => localize('Verification'),238 icon: 'IcVerification',239 subroutes: [240 {241 path: routes.proof_of_identity,242 component: Account,243 getTitle: () => localize('Proof of identity'),244 },245 {246 path: routes.proof_of_address,247 component: Account,248 getTitle: () => localize('Proof of address'),249 },250 ],251 },252 {253 getTitle: () => localize('Security and safety'),254 icon: 'IcSecurity',255 subroutes: [256 {257 path: routes.passwords,258 component: Account,259 getTitle: () => localize('Passwords'),260 },261 {262 path: routes.self_exclusion,263 component: Account,264 getTitle: () => localize('Self exclusion'),265 },266 {267 path: routes.account_limits,268 component: Account,269 getTitle: () => localize('Account limits'),270 },271 {272 path: routes.login_history,273 component: Account,274 getTitle: () => localize('Login history'),275 },276 {277 path: routes.api_token,278 component: Account,279 getTitle: () => localize('API token'),280 },281 {282 path: routes.connected_apps,283 component: Account,284 getTitle: () => localize('Connected apps'),285 },286 {287 path: routes.two_factor_authentication,288 component: Account,289 getTitle: () => localize('Two-factor authentication'),290 },291 {292 path: routes.deactivate_account,293 component: Account,294 getTitle: () => localize('Deactivate account'),295 },296 ],297 },298 ],299 },300 {301 path: routes.cashier,302 component: Cashier,303 is_modal: true,304 is_authenticated: true,305 getTitle: () => localize('Cashier'),306 icon_component: 'IcCashier',307 routes: [308 {309 path: routes.cashier_deposit,310 component: Cashier,311 getTitle: () => localize('Deposit'),312 icon_component: 'IcCashierAdd',313 default: true,314 },315 {316 path: routes.cashier_withdrawal,317 component: Cashier,318 getTitle: () => localize('Withdrawal'),319 icon_component: 'IcCashierMinus',320 },321 {322 path: routes.cashier_pa,323 component: Cashier,324 getTitle: () => localize('Payment agents'),325 icon_component: 'IcPaymentAgent',326 },327 {328 path: routes.cashier_acc_transfer,329 component: Cashier,330 getTitle: () => localize('Transfer'),331 icon_component: 'IcAccountTransfer',332 },333 {334 path: routes.cashier_pa_transfer,335 component: Cashier,336 getTitle: () => localize('Transfer to client'),337 icon_component: 'IcAccountTransfer',338 },339 {340 path: routes.cashier_p2p,341 component: Cashier,342 getTitle: () => localize('DP2P'),343 icon_component: 'IcDp2p',344 },345 {346 path: routes.cashier_p2p_verification,347 component: Cashier,348 getTitle: () => localize('DP2P'),349 icon_component: 'IcDp2p',350 is_invisible: true,351 },352 {353 id: 'gtm-onramp-tab',354 path: routes.cashier_onramp,355 component: Cashier,356 getTitle: () => localize('Fiat onramp'),357 icon_component: 'IcCashierOnRamp',358 },359 {360 path: routes.cashier_crypto_transactions,361 component: Cashier,362 is_invisible: true,363 },364 ],365 },366 {367 ...(is_dashboard368 ? {369 path: routes.dashboard,370 component: Dashboard,371 getTitle: () => localize('Dashboard'),372 routes: [373 {374 path: routes.explore,375 component: Dashboard,376 getTitle: () => localize('Explore'),377 },378 {379 path: routes.about_us,380 component: Dashboard,381 getTitle: () => localize('About Us'),382 },383 {384 path: routes.resources,385 component: Dashboard,386 getTitle: () => localize('Resources'),387 },388 {389 path: routes.platform_dmt5_synthetic,390 component: Dashboard,391 getTitle: () => localize('DMT5 Synthetic'),392 },393 ],394 }395 : {396 path: routes.root,397 component: Trader,398 getTitle: () => localize('Trader'),399 routes: [400 {401 path: routes.dxtrade,402 component: Trader,403 getTitle: () => localize('Deriv X'),404 is_authenticated: false,405 },406 {407 path: routes.mt5,408 component: Trader,409 getTitle: () => localize('MT5'),410 is_authenticated: false,411 },412 {413 path: routes.reports,414 component: Trader,415 getTitle: () => localize('Reports'),416 icon_component: 'IcReports',417 is_authenticated: true,418 routes: [419 {420 path: routes.positions,421 component: Trader,422 getTitle: () => localize('Open positions'),423 icon_component: 'IcOpenPositions',424 default: true,425 },426 {427 path: routes.profit,428 component: Trader,429 getTitle: () => localize('Profit table'),430 icon_component: 'IcProfitTable',431 },432 {433 path: routes.statement,434 component: Trader,435 getTitle: () => localize('Statement'),436 icon_component: 'IcStatement',437 },438 ],439 },440 {441 path: routes.contract,442 component: Trader,443 getTitle: () => localize('Contract Details'),444 is_authenticated: true,445 },446 { path: routes.error404, component: Trader, getTitle: () => localize('Error 404') },447 ],448 }),449 },450 ];451 return modules;452};453const lazyLoadComplaintsPolicy = makeLazyLoader(454 () => import(/* webpackChunkName: "complaints-policy" */ 'Modules/ComplaintsPolicy'),455 () => <Loading />456);457// Order matters458// TODO: search tag: test-route-parent-info -> Enable test for getting route parent info when there are nested routes459const initRoutesConfig = ({ is_dashboard }) => [460 { path: routes.index, component: RouterRedirect, getTitle: () => '', to: routes.root },461 { path: routes.endpoint, component: Endpoint, getTitle: () => 'Endpoint' }, // doesn't need localization as it's for internal use462 { path: routes.redirect, component: Redirect, getTitle: () => localize('Redirect') },463 {464 path: routes.complaints_policy,465 component: lazyLoadComplaintsPolicy(),466 getTitle: () => localize('Complaints policy'),467 icon_component: 'IcComplaintsPolicy',468 is_authenticated: true,469 },470 ...getModules({ is_dashboard }),471];472let routesConfig;473// For default page route if page/path is not found, must be kept at the end of routes_config array474const route_default = { component: Page404, getTitle: () => localize('Error 404') };475// is_deriv_crypto = true as default to prevent route ui blinking476const getRoutesConfig = ({ is_dashboard = true }) => {477 if (!routesConfig) {478 routesConfig = initRoutesConfig({ is_dashboard });479 routesConfig.push(route_default);480 }481 return routesConfig;482};...

Full Screen

Full Screen

title.test.js

Source:title.test.js Github

copy

Full Screen

...13 sinon.restore();14 localSettingsCache = {};15 });16 it('should return meta_title if on data root', function () {17 const title = getTitle({18 meta_title: 'My test title'19 });20 title.should.equal('My test title');21 });22 describe('property: null', function () {23 it('has correct fallbacks for context: home', function () {24 localSettingsCache.title = 'My site title';25 localSettingsCache.meta_title = 'My site meta title';26 getTitle({}, {context: 'home'})27 .should.equal('My site meta title');28 localSettingsCache.meta_title = '';29 getTitle({}, {context: 'home'})30 .should.equal('My site title');31 });32 it('has correct fallbacks for context: post', function () {33 localSettingsCache.title = 'My site title';34 const post = {35 title: 'Post title',36 meta_title: 'Post meta title'37 };38 getTitle({post}, {context: 'post'})39 .should.equal('Post meta title');40 post.meta_title = '';41 getTitle({post}, {context: 'post'})42 .should.equal('Post title');43 post.title = '';44 getTitle({post}, {context: 'post'})45 .should.equal('');46 });47 it('has correct fallbacks for context: page', function () {48 localSettingsCache.title = 'My site title';49 const page = {50 title: 'Page title',51 meta_title: 'Page meta title'52 };53 getTitle({page}, {context: 'page'})54 .should.equal('Page meta title');55 page.meta_title = '';56 getTitle({page}, {context: 'page'})57 .should.equal('Page title');58 page.title = '';59 getTitle({page}, {context: 'page'})60 .should.equal('');61 });62 // NOTE: this is a legacy format and should be resolved with https://github.com/TryGhost/Ghost/issues/1004263 it('has correct fallbacks for context: page (legacy format)', function () {64 localSettingsCache.title = 'My site title';65 const post = {66 title: 'Page title',67 meta_title: 'Page meta title'68 };69 getTitle({post}, {context: 'page'})70 .should.equal('Page meta title');71 post.meta_title = '';72 getTitle({post}, {context: 'page'})73 .should.equal('Page title');74 post.title = '';75 getTitle({post}, {context: 'page'})76 .should.equal('');77 });78 it('has correct fallbacks for context: author', function () {79 localSettingsCache.title = 'Site title';80 localSettingsCache.meta_title = 'Site meta title';81 const author = {82 name: 'Author name'83 };84 getTitle({author}, {context: 'author'})85 .should.equal('Author name - Site title');86 });87 it('has correct fallbacks for context: author_paged', function () {88 localSettingsCache.title = 'Site title';89 localSettingsCache.meta_title = 'Site meta title';90 const author = {91 name: 'Author name'92 };93 getTitle({author}, {context: ['author', 'paged'], pagination: {total: 40, page: 3}})94 .should.equal('Author name - Site title (Page 3)');95 });96 it('has correct fallbacks for context: tag', function () {97 localSettingsCache.title = 'Site title';98 localSettingsCache.meta_title = 'Site meta title';99 const tag = {100 name: 'Tag name',101 meta_title: 'Tag meta title'102 };103 getTitle({tag}, {context: 'tag'})104 .should.equal('Tag meta title');105 tag.meta_title = '';106 getTitle({tag}, {context: 'tag'})107 .should.equal('Tag name - Site title');108 });109 it('has correct fallbacks for context: tag_paged', function () {110 localSettingsCache.title = 'Site title';111 localSettingsCache.meta_title = 'Site meta title';112 const tag = {113 name: 'Tag name',114 meta_title: 'Tag meta title'115 };116 getTitle({tag}, {context: ['tag', 'paged'], pagination: {total: 40, page: 3}})117 .should.equal('Tag meta title');118 tag.meta_title = '';119 getTitle({tag}, {context: ['tag', 'paged'], pagination: {total: 40, page: 3}})120 .should.equal('Tag name - Site title (Page 3)');121 });122 });123 describe('property: og', function () {124 it('has correct fallbacks for context: home', function () {125 localSettingsCache.title = 'My site title';126 localSettingsCache.meta_title = 'My site meta title';127 localSettingsCache.og_title = 'My site og title';128 getTitle({}, {context: 'home'}, {property: 'og'})129 .should.equal('My site og title');130 localSettingsCache.og_title = '';131 getTitle({}, {context: 'home'}, {property: 'og'})132 .should.equal('My site title');133 });134 it('has correct fallbacks for context: post', function () {135 const post = {136 title: 'Post title',137 meta_title: 'Post meta title',138 og_title: 'Post og title'139 };140 getTitle({post}, {context: 'post'}, {property: 'og'})141 .should.equal('Post og title');142 post.og_title = '';143 getTitle({post}, {context: 'post'}, {property: 'og'})144 .should.equal('Post meta title');145 post.meta_title = '';146 getTitle({post}, {context: 'post'}, {property: 'og'})147 .should.equal('Post title');148 });149 it('has correct fallbacks for context: page', function () {150 localSettingsCache.title = 'My site title';151 const page = {152 title: 'Page title',153 meta_title: 'Page meta title',154 og_title: 'Page og title'155 };156 getTitle({page}, {context: 'page'}, {property: 'og'})157 .should.equal('Page og title');158 page.og_title = '';159 getTitle({page}, {context: 'page'}, {property: 'og'})160 .should.equal('Page meta title');161 page.meta_title = '';162 getTitle({page}, {context: 'page'}, {property: 'og'})163 .should.equal('Page title');164 });165 // NOTE: this is a legacy format and should be resolved with https://github.com/TryGhost/Ghost/issues/10042166 it('has correct fallbacks for context: page (legacy format)', function () {167 localSettingsCache.title = 'My site title';168 const post = {169 title: 'Page title',170 meta_title: 'Page meta title',171 og_title: 'Page og title'172 };173 getTitle({post}, {context: 'page'}, {property: 'og'})174 .should.equal('Page og title');175 post.og_title = '';176 getTitle({post}, {context: 'page'}, {property: 'og'})177 .should.equal('Page meta title');178 post.meta_title = '';179 getTitle({post}, {context: 'page'}, {property: 'og'})180 .should.equal('Page title');181 });182 it('has correct fallbacks for context: author', function () {183 localSettingsCache.title = 'Site title';184 localSettingsCache.meta_title = 'Site meta title';185 const author = {186 name: 'Author name'187 };188 getTitle({author}, {context: 'author'}, {property: 'og'})189 .should.equal('Author name - Site title');190 });191 it('has correct fallbacks for context: author_paged', function () {192 localSettingsCache.title = 'Site title';193 localSettingsCache.meta_title = 'Site meta title';194 const author = {195 name: 'Author name'196 };197 getTitle({author}, {context: ['author', 'paged'], pagination: {total: 40, page: 3}}, {property: 'og'})198 .should.equal('Author name - Site title (Page 3)');199 });200 it('has correct fallbacks for context: tag', function () {201 localSettingsCache.title = 'Site title';202 localSettingsCache.meta_title = 'Site meta title';203 const tag = {204 name: 'Tag name',205 meta_title: 'Tag meta title'206 };207 getTitle({tag}, {context: 'tag'}, {property: 'og'})208 .should.equal('Tag meta title');209 tag.meta_title = '';210 getTitle({tag}, {context: 'tag'}, {property: 'og'})211 .should.equal('Tag name - Site title');212 });213 it('has correct fallbacks for context: tag_paged', function () {214 localSettingsCache.title = 'Site title';215 localSettingsCache.meta_title = 'Site meta title';216 const tag = {217 name: 'Tag name',218 meta_title: 'Tag meta title'219 };220 getTitle({tag}, {context: ['tag', 'paged'], pagination: {total: 40, page: 3}}, {property: 'og'})221 .should.equal('Tag meta title');222 tag.meta_title = '';223 getTitle({tag}, {context: ['tag', 'paged'], pagination: {total: 40, page: 3}}, {property: 'og'})224 .should.equal('Tag name - Site title (Page 3)');225 });226 });227 describe('property: twitter', function () {228 it('has correct fallbacks for context: home', function () {229 localSettingsCache.title = 'My site title';230 localSettingsCache.meta_title = 'My site meta title';231 localSettingsCache.twitter_title = 'My site twitter title';232 getTitle({}, {context: 'home'}, {property: 'twitter'})233 .should.equal('My site twitter title');234 localSettingsCache.twitter_title = '';235 getTitle({}, {context: 'home'}, {property: 'twitter'})236 .should.equal('My site title');237 });238 it('has correct fallbacks for context: post', function () {239 const post = {240 title: 'Post title',241 meta_title: 'Post meta title',242 twitter_title: 'Post twitter title'243 };244 getTitle({post}, {context: 'post'}, {property: 'twitter'})245 .should.equal('Post twitter title');246 post.twitter_title = '';247 getTitle({post}, {context: 'post'}, {property: 'twitter'})248 .should.equal('Post meta title');249 post.meta_title = '';250 getTitle({post}, {context: 'post'}, {property: 'twitter'})251 .should.equal('Post title');252 });253 it('has correct fallbacks for context: page', function () {254 localSettingsCache.title = 'My site title';255 const page = {256 title: 'Page title',257 meta_title: 'Page meta title',258 twitter_title: 'Page twitter title'259 };260 getTitle({page}, {context: 'page'}, {property: 'twitter'})261 .should.equal('Page twitter title');262 page.twitter_title = '';263 getTitle({page}, {context: 'page'}, {property: 'twitter'})264 .should.equal('Page meta title');265 page.meta_title = '';266 getTitle({page}, {context: 'page'}, {property: 'twitter'})267 .should.equal('Page title');268 });269 // NOTE: this is a legacy format and should be resolved with https://github.com/TryGhost/Ghost/issues/10042270 it('has correct fallbacks for context: page (legacy format)', function () {271 localSettingsCache.title = 'My site title';272 const post = {273 title: 'Page title',274 meta_title: 'Page meta title',275 twitter_title: 'Page twitter title'276 };277 getTitle({post}, {context: 'page'}, {property: 'twitter'})278 .should.equal('Page twitter title');279 post.twitter_title = '';280 getTitle({post}, {context: 'page'}, {property: 'twitter'})281 .should.equal('Page meta title');282 post.meta_title = '';283 getTitle({post}, {context: 'page'}, {property: 'twitter'})284 .should.equal('Page title');285 });286 it('has correct fallbacks for context: author', function () {287 localSettingsCache.title = 'Site title';288 localSettingsCache.meta_title = 'Site meta title';289 const author = {290 name: 'Author name'291 };292 getTitle({author}, {context: 'author'}, {property: 'twitter'})293 .should.equal('Author name - Site title');294 });295 it('has correct fallbacks for context: author_paged', function () {296 localSettingsCache.title = 'Site title';297 localSettingsCache.meta_title = 'Site meta title';298 const author = {299 name: 'Author name'300 };301 getTitle({author}, {context: ['author', 'paged'], pagination: {total: 40, page: 3}}, {property: 'twitter'})302 .should.equal('Author name - Site title (Page 3)');303 });304 it('has correct fallbacks for context: tag', function () {305 localSettingsCache.title = 'Site title';306 localSettingsCache.meta_title = 'Site meta title';307 const tag = {308 name: 'Tag name',309 meta_title: 'Tag meta title'310 };311 getTitle({tag}, {context: 'tag'}, {property: 'twitter'})312 .should.equal('Tag meta title');313 tag.meta_title = '';314 getTitle({tag}, {context: 'tag'}, {property: 'twitter'})315 .should.equal('Tag name - Site title');316 });317 it('has correct fallbacks for context: tag_paged', function () {318 localSettingsCache.title = 'Site title';319 localSettingsCache.meta_title = 'Site meta title';320 const tag = {321 name: 'Tag name',322 meta_title: 'Tag meta title'323 };324 getTitle({tag}, {context: ['tag', 'paged'], pagination: {total: 40, page: 3}}, {property: 'twitter'})325 .should.equal('Tag meta title');326 tag.meta_title = '';327 getTitle({tag}, {context: ['tag', 'paged'], pagination: {total: 40, page: 3}}, {property: 'twitter'})328 .should.equal('Tag name - Site title (Page 3)');329 });330 });331 it('should return site title with page if unknown type', function () {332 localSettingsCache.title = 'My site title 4';333 var title = getTitle({}, {334 context: ['paged'],335 pagination: {336 total: 40,337 page: 35338 }339 });340 title.should.equal('My site title 4 (Page 35)');341 });342 it('should not display "null" for an undefined site title', function () {343 localSettingsCache.title = null;344 var title = getTitle({345 tag: {346 name: 'My tag'347 }348 }, {349 context: ['tag']350 });351 title.should.equal('My tag');352 title = getTitle({353 tag: {354 name: 'My tag'355 }356 }, {357 context: ['tag', 'paged'],358 pagination: {359 total: 40,360 page: 35361 }362 });363 title.should.equal('My tag - (Page 35)');364 title = getTitle({365 author: {366 name: 'My name'367 }368 }, {369 context: ['author']370 });371 title.should.equal('My name');372 title = getTitle({373 author: {374 name: 'My name'375 }376 }, {377 context: ['author', 'paged'],378 pagination: {379 total: 40,380 page: 35381 }382 });383 title.should.equal('My name - (Page 35)');384 });...

Full Screen

Full Screen

title_spec.js

Source:title_spec.js Github

copy

Full Screen

...13 sinon.restore();14 localSettingsCache = {};15 });16 it('should return meta_title if on data root', function () {17 const title = getTitle({18 meta_title: 'My test title'19 });20 title.should.equal('My test title');21 });22 describe('property: null', function () {23 it('has correct fallbacks for context: home', function () {24 localSettingsCache.title = 'My site title';25 localSettingsCache.meta_title = 'My site meta title';26 getTitle({}, {context: 'home'})27 .should.equal('My site meta title');28 localSettingsCache.meta_title = '';29 getTitle({}, {context: 'home'})30 .should.equal('My site title');31 });32 it('has correct fallbacks for context: post', function () {33 localSettingsCache.title = 'My site title';34 const post = {35 title: 'Post title',36 meta_title: 'Post meta title'37 };38 getTitle({post}, {context: 'post'})39 .should.equal('Post meta title');40 post.meta_title = '';41 getTitle({post}, {context: 'post'})42 .should.equal('Post title');43 post.title = '';44 getTitle({post}, {context: 'post'})45 .should.equal('');46 });47 it('has correct fallbacks for context: page', function () {48 localSettingsCache.title = 'My site title';49 const page = {50 title: 'Page title',51 meta_title: 'Page meta title'52 };53 getTitle({page}, {context: 'page'})54 .should.equal('Page meta title');55 page.meta_title = '';56 getTitle({page}, {context: 'page'})57 .should.equal('Page title');58 page.title = '';59 getTitle({page}, {context: 'page'})60 .should.equal('');61 });62 // NOTE: this is a legacy format and should be resolved with https://github.com/TryGhost/Ghost/issues/1004263 it('has correct fallbacks for context: page (legacy format)', function () {64 localSettingsCache.title = 'My site title';65 const post = {66 title: 'Page title',67 meta_title: 'Page meta title'68 };69 getTitle({post}, {context: 'page'})70 .should.equal('Page meta title');71 post.meta_title = '';72 getTitle({post}, {context: 'page'})73 .should.equal('Page title');74 post.title = '';75 getTitle({post}, {context: 'page'})76 .should.equal('');77 });78 it('has correct fallbacks for context: author', function () {79 localSettingsCache.title = 'Site title';80 localSettingsCache.meta_title = 'Site meta title';81 const author = {82 name: 'Author name'83 };84 getTitle({author}, {context: 'author'})85 .should.equal('Author name - Site title');86 });87 it('has correct fallbacks for context: author_paged', function () {88 localSettingsCache.title = 'Site title';89 localSettingsCache.meta_title = 'Site meta title';90 const author = {91 name: 'Author name'92 };93 getTitle({author}, {context: ['author', 'paged'], pagination: {total: 40, page: 3}})94 .should.equal('Author name - Site title (Page 3)');95 });96 it('has correct fallbacks for context: tag', function () {97 localSettingsCache.title = 'Site title';98 localSettingsCache.meta_title = 'Site meta title';99 const tag = {100 name: 'Tag name',101 meta_title: 'Tag meta title'102 };103 getTitle({tag}, {context: 'tag'})104 .should.equal('Tag meta title');105 tag.meta_title = '';106 getTitle({tag}, {context: 'tag'})107 .should.equal('Tag name - Site title');108 });109 it('has correct fallbacks for context: tag_paged', function () {110 localSettingsCache.title = 'Site title';111 localSettingsCache.meta_title = 'Site meta title';112 const tag = {113 name: 'Tag name',114 meta_title: 'Tag meta title'115 };116 getTitle({tag}, {context: ['tag', 'paged'], pagination: {total: 40, page: 3}})117 .should.equal('Tag meta title');118 tag.meta_title = '';119 getTitle({tag}, {context: ['tag', 'paged'], pagination: {total: 40, page: 3}})120 .should.equal('Tag name - Site title (Page 3)');121 });122 });123 describe('property: og', function () {124 it('has correct fallbacks for context: home', function () {125 localSettingsCache.title = 'My site title';126 localSettingsCache.meta_title = 'My site meta title';127 localSettingsCache.og_title = 'My site og title';128 getTitle({}, {context: 'home'}, {property: 'og'})129 .should.equal('My site og title');130 localSettingsCache.og_title = '';131 getTitle({}, {context: 'home'}, {property: 'og'})132 .should.equal('My site title');133 });134 it('has correct fallbacks for context: post', function () {135 const post = {136 title: 'Post title',137 meta_title: 'Post meta title',138 og_title: 'Post og title'139 };140 getTitle({post}, {context: 'post'}, {property: 'og'})141 .should.equal('Post og title');142 post.og_title = '';143 getTitle({post}, {context: 'post'}, {property: 'og'})144 .should.equal('Post meta title');145 post.meta_title = '';146 getTitle({post}, {context: 'post'}, {property: 'og'})147 .should.equal('Post title');148 });149 it('has correct fallbacks for context: page', function () {150 localSettingsCache.title = 'My site title';151 const page = {152 title: 'Page title',153 meta_title: 'Page meta title',154 og_title: 'Page og title'155 };156 getTitle({page}, {context: 'page'}, {property: 'og'})157 .should.equal('Page og title');158 page.og_title = '';159 getTitle({page}, {context: 'page'}, {property: 'og'})160 .should.equal('Page meta title');161 page.meta_title = '';162 getTitle({page}, {context: 'page'}, {property: 'og'})163 .should.equal('Page title');164 });165 // NOTE: this is a legacy format and should be resolved with https://github.com/TryGhost/Ghost/issues/10042166 it('has correct fallbacks for context: page (legacy format)', function () {167 localSettingsCache.title = 'My site title';168 const post = {169 title: 'Page title',170 meta_title: 'Page meta title',171 og_title: 'Page og title'172 };173 getTitle({post}, {context: 'page'}, {property: 'og'})174 .should.equal('Page og title');175 post.og_title = '';176 getTitle({post}, {context: 'page'}, {property: 'og'})177 .should.equal('Page meta title');178 post.meta_title = '';179 getTitle({post}, {context: 'page'}, {property: 'og'})180 .should.equal('Page title');181 });182 it('has correct fallbacks for context: author', function () {183 localSettingsCache.title = 'Site title';184 localSettingsCache.meta_title = 'Site meta title';185 const author = {186 name: 'Author name'187 };188 getTitle({author}, {context: 'author'}, {property: 'og'})189 .should.equal('Author name - Site title');190 });191 it('has correct fallbacks for context: author_paged', function () {192 localSettingsCache.title = 'Site title';193 localSettingsCache.meta_title = 'Site meta title';194 const author = {195 name: 'Author name'196 };197 getTitle({author}, {context: ['author', 'paged'], pagination: {total: 40, page: 3}}, {property: 'og'})198 .should.equal('Author name - Site title (Page 3)');199 });200 it('has correct fallbacks for context: tag', function () {201 localSettingsCache.title = 'Site title';202 localSettingsCache.meta_title = 'Site meta title';203 const tag = {204 name: 'Tag name',205 meta_title: 'Tag meta title'206 };207 getTitle({tag}, {context: 'tag'}, {property: 'og'})208 .should.equal('Tag meta title');209 tag.meta_title = '';210 getTitle({tag}, {context: 'tag'}, {property: 'og'})211 .should.equal('Tag name - Site title');212 });213 it('has correct fallbacks for context: tag_paged', function () {214 localSettingsCache.title = 'Site title';215 localSettingsCache.meta_title = 'Site meta title';216 const tag = {217 name: 'Tag name',218 meta_title: 'Tag meta title'219 };220 getTitle({tag}, {context: ['tag', 'paged'], pagination: {total: 40, page: 3}}, {property: 'og'})221 .should.equal('Tag meta title');222 tag.meta_title = '';223 getTitle({tag}, {context: ['tag', 'paged'], pagination: {total: 40, page: 3}}, {property: 'og'})224 .should.equal('Tag name - Site title (Page 3)');225 });226 });227 describe('property: twitter', function () {228 it('has correct fallbacks for context: home', function () {229 localSettingsCache.title = 'My site title';230 localSettingsCache.meta_title = 'My site meta title';231 localSettingsCache.twitter_title = 'My site twitter title';232 getTitle({}, {context: 'home'}, {property: 'twitter'})233 .should.equal('My site twitter title');234 localSettingsCache.twitter_title = '';235 getTitle({}, {context: 'home'}, {property: 'twitter'})236 .should.equal('My site title');237 });238 it('has correct fallbacks for context: post', function () {239 const post = {240 title: 'Post title',241 meta_title: 'Post meta title',242 twitter_title: 'Post twitter title'243 };244 getTitle({post}, {context: 'post'}, {property: 'twitter'})245 .should.equal('Post twitter title');246 post.twitter_title = '';247 getTitle({post}, {context: 'post'}, {property: 'twitter'})248 .should.equal('Post meta title');249 post.meta_title = '';250 getTitle({post}, {context: 'post'}, {property: 'twitter'})251 .should.equal('Post title');252 });253 it('has correct fallbacks for context: page', function () {254 localSettingsCache.title = 'My site title';255 const page = {256 title: 'Page title',257 meta_title: 'Page meta title',258 twitter_title: 'Page twitter title'259 };260 getTitle({page}, {context: 'page'}, {property: 'twitter'})261 .should.equal('Page twitter title');262 page.twitter_title = '';263 getTitle({page}, {context: 'page'}, {property: 'twitter'})264 .should.equal('Page meta title');265 page.meta_title = '';266 getTitle({page}, {context: 'page'}, {property: 'twitter'})267 .should.equal('Page title');268 });269 // NOTE: this is a legacy format and should be resolved with https://github.com/TryGhost/Ghost/issues/10042270 it('has correct fallbacks for context: page (legacy format)', function () {271 localSettingsCache.title = 'My site title';272 const post = {273 title: 'Page title',274 meta_title: 'Page meta title',275 twitter_title: 'Page twitter title'276 };277 getTitle({post}, {context: 'page'}, {property: 'twitter'})278 .should.equal('Page twitter title');279 post.twitter_title = '';280 getTitle({post}, {context: 'page'}, {property: 'twitter'})281 .should.equal('Page meta title');282 post.meta_title = '';283 getTitle({post}, {context: 'page'}, {property: 'twitter'})284 .should.equal('Page title');285 });286 it('has correct fallbacks for context: author', function () {287 localSettingsCache.title = 'Site title';288 localSettingsCache.meta_title = 'Site meta title';289 const author = {290 name: 'Author name'291 };292 getTitle({author}, {context: 'author'}, {property: 'twitter'})293 .should.equal('Author name - Site title');294 });295 it('has correct fallbacks for context: author_paged', function () {296 localSettingsCache.title = 'Site title';297 localSettingsCache.meta_title = 'Site meta title';298 const author = {299 name: 'Author name'300 };301 getTitle({author}, {context: ['author', 'paged'], pagination: {total: 40, page: 3}}, {property: 'twitter'})302 .should.equal('Author name - Site title (Page 3)');303 });304 it('has correct fallbacks for context: tag', function () {305 localSettingsCache.title = 'Site title';306 localSettingsCache.meta_title = 'Site meta title';307 const tag = {308 name: 'Tag name',309 meta_title: 'Tag meta title'310 };311 getTitle({tag}, {context: 'tag'}, {property: 'twitter'})312 .should.equal('Tag meta title');313 tag.meta_title = '';314 getTitle({tag}, {context: 'tag'}, {property: 'twitter'})315 .should.equal('Tag name - Site title');316 });317 it('has correct fallbacks for context: tag_paged', function () {318 localSettingsCache.title = 'Site title';319 localSettingsCache.meta_title = 'Site meta title';320 const tag = {321 name: 'Tag name',322 meta_title: 'Tag meta title'323 };324 getTitle({tag}, {context: ['tag', 'paged'], pagination: {total: 40, page: 3}}, {property: 'twitter'})325 .should.equal('Tag meta title');326 tag.meta_title = '';327 getTitle({tag}, {context: ['tag', 'paged'], pagination: {total: 40, page: 3}}, {property: 'twitter'})328 .should.equal('Tag name - Site title (Page 3)');329 });330 });331 it('should return site title with page if unknown type', function () {332 localSettingsCache.title = 'My site title 4';333 var title = getTitle({}, {334 context: ['paged'],335 pagination: {336 total: 40,337 page: 35338 }339 });340 title.should.equal('My site title 4 (Page 35)');341 });...

Full Screen

Full Screen

locale.test.js

Source:locale.test.js Github

copy

Full Screen

...49 'Open',50 )51 expect(wrapper.find(FaHeadphonesIcon)).toHaveLength(1)52 wrapper.setProps({ mode: 'full' })53 expect(getTitle(wrapper, '.prev-audio')).toEqual('Previous track')54 expect(getTitle(wrapper, '.play-btn')).toEqual('Click to play')55 expect(getTitle(wrapper, '.next-audio')).toEqual('Next track')56 expect(getTitle(wrapper, '.reload-btn')).toEqual('Reload')57 expect(getTitle(wrapper, '.audio-download')).toEqual('Download')58 expect(getTitle(wrapper, 'audio')).toEqual('audioTitle')59 expect(getTitle(wrapper, '.theme-switch button')).toEqual('Dark/Light mode')60 expect(getTitle(wrapper, '.play-sounds')).toEqual('Volume')61 expect(getTitle(wrapper, '.loop-btn')).toEqual('Play in order')62 expect(getTitle(wrapper, '.lyric-btn')).toEqual('Toggle lyric')63 expect(getTitle(wrapper, '.audio-lists-btn')).toEqual('Playlists')64 expect(getTitle(wrapper, '.hide-panel')).toEqual('Minimize')65 expect(getTitle(wrapper, '.destroy-btn')).toEqual('Destroy')66 expect(wrapper.find('.music-player-lyric').text()).toContain('No lyric')67 expect(wrapper.find('.rc-switch-inner').text()).toContain('D')68 wrapper.find('.rc-switch').simulate('click')69 expect(wrapper.find('.rc-switch-inner').text()).toContain('L')70 // 打开播放列表71 wrapper.find('.audio-lists-btn').simulate('click')72 expect(wrapper.find('.audio-lists-panel-header-title').text()).toContain(73 'Playlists',74 )75 expect(getTitle(wrapper, '.audio-lists-panel-header-delete-btn')).toEqual(76 'Delete audio lists',77 )78 expect(getTitle(wrapper, '.audio-lists-panel-header-close-btn')).toEqual(79 'Close',80 )81 expect(getTitle(wrapper, '.audio-lists-panel .audio-item', 0)).toEqual(82 'Click to play',83 )84 expect(getTitle(wrapper, '.audio-lists-panel .player-delete', 0)).toEqual(85 'Click to delete audioName',86 )87 })88 it('should render locale with zh_CN detail', () => {89 const wrapper = mount(90 <ReactJkMusicPlayer91 showLyric92 showDestroy93 locale="zh_CN"94 audioLists={[95 {96 musicSrc: 'xx',97 name: 'audioName',98 singer: 'singerName',99 },100 ]}101 />,102 )103 wrapper.setState({ audioLyricVisible: true })104 expect(wrapper.find('.music-player-controller-setting').text()).toContain(105 '打开',106 )107 expect(wrapper.find(FaHeadphonesIcon)).toHaveLength(1)108 wrapper.setProps({ mode: 'full' })109 expect(getTitle(wrapper, '.prev-audio')).toEqual('上一首')110 expect(getTitle(wrapper, '.play-btn')).toEqual('点击播放')111 expect(getTitle(wrapper, '.next-audio')).toEqual('下一首')112 expect(getTitle(wrapper, '.reload-btn')).toEqual('重新播放')113 expect(getTitle(wrapper, '.audio-download')).toEqual('下载')114 expect(getTitle(wrapper, 'audio')).toEqual('audioName - singerName')115 expect(getTitle(wrapper, '.theme-switch button')).toEqual('暗黑/明亮 主题')116 expect(getTitle(wrapper, '.play-sounds')).toEqual('音量')117 expect(getTitle(wrapper, '.loop-btn')).toEqual('顺序播放')118 expect(getTitle(wrapper, '.lyric-btn')).toEqual('显示/隐藏 歌词')119 expect(getTitle(wrapper, '.audio-lists-btn')).toEqual('播放列表')120 expect(getTitle(wrapper, '.hide-panel')).toEqual('切换至迷你模式')121 expect(getTitle(wrapper, '.destroy-btn')).toEqual('移除播放器')122 expect(wrapper.find('.music-player-lyric').text()).toContain('暂无歌词')123 expect(wrapper.find('.rc-switch-inner').text()).toContain('暗')124 wrapper.find('.rc-switch').simulate('click')125 expect(wrapper.find('.rc-switch-inner').text()).toContain('亮')126 // 打开播放列表127 wrapper.find('.audio-lists-btn').simulate('click')128 expect(129 wrapper.find('.audio-lists-panel .audio-lists-panel-header-title').text(),130 ).toContain('播放列表 / 1')131 expect(getTitle(wrapper, '.audio-lists-panel-header-delete-btn')).toEqual(132 '清空播放列表',133 )134 expect(getTitle(wrapper, '.audio-lists-panel-header-close-btn')).toEqual(135 '关闭',136 )137 expect(getTitle(wrapper, '.audio-lists-panel .audio-item', 0)).toEqual(138 '点击播放',139 )140 expect(getTitle(wrapper, '.audio-lists-panel .player-delete', 0)).toEqual(141 '点击删除 audioName',142 )143 })144 it('should override locale', () => {145 const wrapper = mount(146 <ReactJkMusicPlayer147 locale={{148 openText: 'test',149 }}150 />,151 )152 expect(wrapper.find('.music-player-controller-setting').text()).toContain(153 'test',154 )155 })156 // https://github.com/lijinke666/react-music-player/issues/83157 it('should render locale with functional audioTitle', () => {158 const wrapper = mount(159 <ReactJkMusicPlayer160 className="text-class-name"161 showMiniProcessBar162 showLyric163 showDestroy164 locale={{165 audioTitle: ({ name }) => `test-${name}`,166 }}167 audioLists={[168 {169 musicSrc: 'xx',170 name: 'audioName',171 },172 ]}173 />,174 )175 expect(getTitle(wrapper, 'audio')).toEqual('test-audioName')176 })...

Full Screen

Full Screen

example.e2e.js

Source:example.e2e.js Github

copy

Full Screen

2const LoginPage = require('../pageobjects/landingPage');3describe('Drata Landing Page', () => {4 it('Drata landing page', async () => {5 await LoginPage.open();6 var pageTitle = await browser.getTitle();7 console.log(pageTitle);8 9 assert.strictEqual('Drata - Put SOC 2, ISO 27001, and HIPAA Compliance On Autopilot',pageTitle, 'Page does not open');10 11 });12}); 13describe('Drata Demo Screen', () => {14 15 it('Get Schedule Screen shall open correctly', async () => {16 await LoginPage.openDemo();17 18 var pageDemo = await browser.getTitle();19 console.log(pageDemo);20 21 assert.strictEqual('Drata - Request a Demo Today',pageDemo, 'Page does not open');22 23 }); 24}); 25describe('About Drata Screen', () => {26 27 it('About Screen shall open correctly', async () => {28 await LoginPage.openAbout();29 30 var pageAbout = await browser.getTitle();31 console.log(pageAbout);32 33 assert.strictEqual('Drata - About Us',pageAbout, 'Page does not open');34 35 }); 36});37describe('Drata Careers Screen', () => {38 39 it('About Screen shall open correctly', async () => {40 await LoginPage.openCareers();41 42 var pageCareers = await browser.getTitle();43 console.log(pageCareers);44 45 assert.strictEqual('Careers - Drata',pageCareers, 'Page does not open');46 47 }); 48});49describe('Drata Contact Us Screen', () => {50 51 it('Contact Us Screen shall open correctly', async () => {52 await LoginPage.openContact();53 54 var pageContactUs = await browser.getTitle();55 console.log(pageContactUs);56 57 assert.strictEqual('Contact Us - Drata',pageContactUs, 'Page does not open');58 59 }); 60});61describe('Drata Contact Us Screen', () => {62 63 it('Security Screen shall open correctly', async () => {64 await LoginPage.openSecurity();65 66 var pageSecurity = await browser.getTitle();67 console.log(pageSecurity);68 69 assert.strictEqual('Drata - Security at Drata',pageSecurity, 'Page does not open');70 71 }); 72});73describe('Product SOC 2 Screen', () => {74 75 it('Product SOC 2 Screen shall open correctly', async () => {76 await LoginPage.openSOC();77 78 var pageSOC = await browser.getTitle();79 console.log(pageSOC);80 81 assert.strictEqual('Drata - Put SOC 2 on Autopilot',pageSOC, 'Page does not open');82 83 }); 84});85describe('Product ISO-27001 Screen', () => {86 87 it('Product ISO-27001 Screen shall open correctly', async () => {88 await LoginPage.openISO();89 90 var pageISO = await browser.getTitle();91 console.log(pageISO);92 93 assert.strictEqual('Drata - Put ISO 27001 on Autopilot',pageISO, 'Page does not open');94 95 }); 96});97describe('Product HIPAA Screen', () => {98 99 it('Product HIPAA Screen shall open correctly', async () => {100 await LoginPage.openHIPAA();101 102 var pageHIPAA = await browser.getTitle();103 console.log(pageHIPAA);104 105 assert.strictEqual('Drata - Put HIPAA on Autopilot',pageHIPAA, 'Page does not open');106 107 }); 108});109describe('Product PCI-DSS Screen', () => {110 111 it('Product PCI-DSS Screen shall open correctly', async () => {112 await LoginPage.openPCI();113 114 var pagePCI = await browser.getTitle();115 console.log(pagePCI);116 117 assert.strictEqual('Drata - Put PCI on Autopilot',pagePCI, 'Page does not open');118 119 }); 120});121describe('Product Integrations Screen', () => {122 123 it('Product Integrations Screen shall open correctly', async () => {124 await LoginPage.openIntegrations();125 126 var pageInt = await browser.getTitle();127 console.log(pageInt);128 129 assert.strictEqual('Drata - More Integrations Means More Automation',pageInt, 'Page does not open');130 131 }); 132});133describe('Product Pricing Screen', () => {134 135 it('Product Pricing Screen shall open correctly', async () => {136 await LoginPage.openPricing();137 138 var pagePricing = await browser.getTitle();139 console.log(pagePricing);140 141 assert.strictEqual('Drata - Transparent Pricing',pagePricing, 'Page does not open');142 143 }); 144});145describe('Resources SOC 2 Prioritizing Screen', () => {146 147 it('Resources SOC 2 Prioritizing Screen shall open correctly', async () => {148 await LoginPage.openPrioSOC();149 150 var pagePrioSOC = await browser.getTitle();151 console.log(pagePrioSOC);152 153 assert.strictEqual('Drata - Case Study: Prioritizing Security while Growing Fast',pagePrioSOC, 'Page does not open');154 155 }); 156});157describe('Resources Get SOC 2 Screen', () => {158 159 it('Resources Get SOC 2 Screen shall open correctly', async () => {160 await LoginPage.openGetSOC();161 162 var pageGetSOC = await browser.getTitle();163 console.log(pageGetSOC);164 165 assert.strictEqual('Drata - Case Study: Getting SOC 2 Fast on a Deadline',pageGetSOC, 'Page does not open');166 167 }); 168});169describe('Resources Leveling SOC 2 Screen', () => {170 171 it('Resources Leveling SOC 2 Screen shall open correctly', async () => {172 await LoginPage.openLevSOC();173 174 var pageLevSOC = await browser.getTitle();175 console.log(pageLevSOC);176 177 assert.strictEqual('Drata - Case Study: Confidence In a Strong Security Program',pageLevSOC, 'Page does not open');178 179 }); 180});181describe('Resources All case Studies Screen', () => {182 183 it('Resources All case Studies Screen shall open correctly', async () => {184 await LoginPage.openLevSOC();185 186 var pageLevSOC = await browser.getTitle();187 console.log(pageLevSOC);188 189 assert.strictEqual('Drata - Case Study: Confidence In a Strong Security Program', pageLevSOC, 'Page does not open');190 191 }); 192});193describe('Customer Screen', () => {194 195 it('Customer Screen shall open correctly', async () => {196 await LoginPage.openCustomers();197 198 var pageCutomers = await browser.getTitle();199 console.log(pageCutomers);200 201 assert.strictEqual('Drata - Customers', pageCutomers, 'Page does not open');202 203 }); 204});205describe('Auditors Screen', () => {206 207 it('Auditors Screen shall open correctly', async () => {208 await LoginPage.openAuditors();209 210 var pageAuditors = await browser.getTitle();211 console.log(pageAuditors);212 213 assert.strictEqual('Auditors - Drata', pageAuditors, 'Page does not open');214 215 }); ...

Full Screen

Full Screen

common.js

Source:common.js Github

copy

Full Screen

...18 return _webview[id];19}20function webviewInit(webview) {21 webview.on("dom-ready", function() {22 console.log(this.getTitle(),this.getURL(),"dom-ready",arguments);23 });24 webview.on("did-start-loading", function() {25 console.log(this.getTitle(),this.getURL(),"did-start-loading",arguments);26 });27 webview.on("did-stop-loading", function() {28 console.log(this.getTitle(),this.getURL(),"did-stop-loading",arguments);29 });30 webview.on("load-commit", function() {31 console.log(this.getTitle(),this.getURL(),"load-commit",arguments);32 });33 webview.on("did-finish-load", function() {34 console.log(this.getTitle(),this.getURL(),"did-finish-load",arguments);35 });36 webview.on("did-fail-load", function() {37 console.log(this.getTitle(),this.getURL(),"did-fail-load",arguments);38 });39 webview.on("did-frame-finish-load", function() {40 // console.log(this.getTitle(),this.getURL(),"did-frame-finish-load",arguments);41 });42 webview.on("did-get-response-details", function() {43 // console.log(this.getTitle(),this.getURL(),"did-get-response-details",arguments);44 });45 webview.on("did-get-redirect-request", function() {46 console.log(this.getTitle(),this.getURL(),"did-get-redirect-request",arguments);47 });48 webview.on("page-title-updated", function() {49 // console.log(this.getTitle(),this.getURL(),"page-title-updated",arguments);50 });51 webview.on("page-favicon-updated", function() {52 // console.log(this.getTitle(),this.getURL(),"page-favicon-updated",arguments);53 });54 webview.on("enter-html-full-screen", function() {55 console.log(this.getTitle(),this.getURL(),"enter-html-full-screen",arguments);56 });57 webview.on("leave-html-full-screen", function() {58 console.log(this.getTitle(),this.getURL(),"leave-html-full-screen",arguments);59 });60 webview.on("found-in-page", function() {61 console.log(this.getTitle(),this.getURL(),"found-in-page",arguments);62 });63 webview.on("new-window", function(e) {64 console.log(this.getTitle(),this.getURL(),"new-window",arguments);65 window.open(e.originalEvent.url);66 });67 webview.on("will-navigate", function() {68 console.log(this.getTitle(),this.getURL(),"will-navigate",arguments);69 });70 webview.on("did-navigate", function() {71 console.log(this.getTitle(),this.getURL(),"did-navigate",arguments);72 });73 webview.on("did-navigate-in-page", function() {74 console.log(this.getTitle(),this.getURL(),"did-navigate-in-page",arguments);75 });76 webview.on("close", function() {77 console.log(this.getTitle(),this.getURL(),"close",arguments);78 });79 webview.on("ipc-message", function() {80 console.log(this.getTitle(),this.getURL(),"ipc-message",arguments);81 });82 webview.on("crashed", function() {83 console.log(this.getTitle(),this.getURL(),"crashed",arguments);84 });85 webview.on("gpu-crashed", function() {86 console.log(this.getTitle(),this.getURL(),"gpu-crashed",arguments);87 });88 webview.on("plugin-crashed", function() {89 console.log(this.getTitle(),this.getURL(),"plugin-crashed",arguments);90 });91 webview.on("destroyed", function() {92 console.log(this.getTitle(),this.getURL(),"destroyed",arguments);93 });94 webview.on("media-started-playing", function() {95 console.log(this.getTitle(),this.getURL(),"media-started-playing",arguments);96 });97 webview.on("media-paused", function() {98 console.log(this.getTitle(),this.getURL(),"media-paused",arguments);99 });100 webview.on("did-change-theme-color", function() {101 console.log(this.getTitle(),this.getURL(),"did-change-theme-color",arguments);102 });...

Full Screen

Full Screen

CreateDeskSchedule.gs

Source:CreateDeskSchedule.gs Github

copy

Full Screen

...10 case 0:11 var day = "Monday";12 for (var x=0; x<all_events[i].length; x++)13 {14 desk_schedule.getSheets()[0].getRange("A"+(x+4)).setValue(all_events[i][x].getTitle().split(' ')[1] + ' ' + all_events[i][x].getTitle().split(' ')[2]);15 }16 for (var x=0; x<all.length; x++){17 if (all[x].getA1Notation().indexOf("A")>=0)18 {19 all[x].setValue(all_events[i][randNum(0, (all_events[i].length - 1))].getTitle().split(' ')[1]);20 };21 }22 break;23 case 1:24 var day = "Teusday";25 for (var x=0; x<all_events[i].length; x++)26 {27 desk_schedule.getSheets()[0].getRange("B"+(x+4)).setValue(all_events[i][x].getTitle().split(' ')[1] + ' ' + all_events[i][x].getTitle().split(' ')[2]);28 }29 for (var x=0; x<all.length; x++){30 if (all[x].getA1Notation().indexOf("B")>=0)31 {32 all[x].setValue(all_events[i][randNum(0, (all_events[i].length - 1))].getTitle().split(' ')[1]);33 };34 }35 break;36 case 2:37 var day = "Wednesday";38 for (var x=0; x<all_events[i].length; x++)39 {40 desk_schedule.getSheets()[0].getRange("C"+(x+4)).setValue(all_events[i][x].getTitle().split(' ')[1] + ' ' + all_events[i][x].getTitle().split(' ')[2]);41 }42 for (var x=0; x<all.length; x++){43 if (all[x].getA1Notation().indexOf("C")>=0)44 {45 all[x].setValue(all_events[i][randNum(0, (all_events[i].length - 1))].getTitle().split(' ')[1]);46 };47 }48 break;49 case 3:50 var day = "Thursday";51 for (var x=0; x<all_events[i].length; x++)52 {53 desk_schedule.getSheets()[0].getRange("D"+(x+4)).setValue(all_events[i][x].getTitle().split(' ')[1] + ' ' + all_events[i][x].getTitle().split(' ')[2]);54 }55 for (var x=0; x<all.length; x++){56 if (all[x].getA1Notation().indexOf("D")>=0)57 {58 all[x].setValue(all_events[i][randNum(0, (all_events[i].length - 1))].getTitle().split(' ')[1]);59 };60 }61 break;62 case 4:63 var day = "Friday";64 for (var x=0; x<all_events[i].length; x++)65 {66 desk_schedule.getSheets()[0].getRange("E"+(x+4)).setValue(all_events[i][x].getTitle().split(' ')[1] + ' ' + all_events[i][x].getTitle().split(' ')[2]);67 }68 for (var x=0; x<all.length; x++){69 if (all[x].getA1Notation().indexOf("E")>=0)70 {71 all[x].setValue(all_events[i][randNum(0, (all_events[i].length - 1))].getTitle().split(' ')[1]);72 };73 }74 break;75 case 5:76 var day = "Saturday";77 for (var x=0; x<all_events[i].length; x++)78 {79 desk_schedule.getSheets()[0].getRange("F"+(x+4)).setValue(all_events[i][x].getTitle().split(' ')[1] + ' ' + all_events[i][x].getTitle().split(' ')[2]);80 }81 for (var x=0; x<all.length; x++){82 if (all[x].getA1Notation().indexOf("F")>=0)83 {84 all[x].setValue(all_events[i][randNum(0, (all_events[i].length - 1))].getTitle().split(' ')[1]);85 };86 }87 break;88 }89 }90 return desk_schedule;...

Full Screen

Full Screen

TabbedFilters.spec.js

Source:TabbedFilters.spec.js Github

copy

Full Screen

...23 tabs: []24 }25 }26 })27 expect(tabs.vm.getTitle({28 name: 'General Tab',29 type: 'null'30 })).toBe('General Tab')31 expect(tabs.vm.getTitle({32 type: 'date',33 name: 'Date'34 })).toBe('Date (All)')35 expect(tabs.vm.getTitle({36 type: 'date'37 })).toBe('Date (All)')38 expect(tabs.vm.getTitle({39 type: 'date',40 from: '12-12-1900',41 name: 'Dates'42 })).toBe('Dates (Since 12-12-1900)')43 expect(tabs.vm.getTitle({44 type: 'date',45 from: '12-12-1900'46 })).toBe('(Since 12-12-1900)')47 expect(tabs.vm.getTitle({48 type: 'date',49 to: '12-12-1900',50 name: 'Dates'51 })).toBe('Dates (Before 12-12-1900)')52 expect(tabs.vm.getTitle({53 type: 'date',54 to: '12-12-1900'55 })).toBe('(Before 12-12-1900)')56 expect(tabs.vm.getTitle({57 type: 'xx',58 from: '10',59 to: '20',60 name: 'xx'61 })).toBe('xx (10 to 20)')62 expect(tabs.vm.getTitle({63 from: '1',64 to: '10'65 })).toBe('From (1 to 10)')66 expect(tabs.vm.getTitle({67 name: 'aaa',68 from: '10',69 to: '100'70 })).toBe('aaa (10 to 100)')71 expect(tabs.vm.getTitle({72 name: 'aaadd',73 to: '100'74 })).toBe('Error')75 expect(tabs.vm.getTitle({76 name: 'aaad',77 from: '10'78 })).toBe('Error')79 expect(tabs.vm.getTitle({80 type: 'date',81 from: '10-12-1900',82 to: '12-12-1900',83 name: 'Date'84 })).toBe('Date (10-12-1900 to 12-12-1900)')85 expect(tabs.vm.getTitle({86 type: 'range'87 })).toBe('Range (All)')88 expect(tabs.vm.getTitle({89 type: 'range',90 name: 'Age'91 })).toBe('Age (All)')92 expect(tabs.vm.getTitle({93 type: 'range',94 from: 10,95 name: 'Age'96 })).toBe('Age (Above 10)')97 expect(tabs.vm.getTitle({98 type: 'range',99 from: 13100 })).toBe('(Above 13)')101 expect(tabs.vm.getTitle({102 type: 'range',103 to: 20,104 name: 'Ages'105 })).toBe('Ages (Below 20)')106 expect(tabs.vm.getTitle({107 type: 'range',108 to: 20109 })).toBe('(Below 20)')110 expect(tabs.vm.getTitle({111 type: 'range',112 from: 10,113 to: 20,114 name: 'Age'115 })).toBe('Age (10 to 20)')116 expect(tabs.vm.getTitle({117 name: 'Age',118 from: 2,119 to: 5120 })).toBe('Age (2 to 5)')121 expect(tabs.vm.getTitle({122 type: 'null',123 name: 'Name'124 })).toBe('Name')125 expect(tabs.vm.getTitle({126 type: 'null',127 name: 'Age'128 })).toBe('Age')129 })...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var options = {3 desiredCapabilities: {4 }5};6 .remote(options)7 .init()8 .getTitle().then(function(title) {9 console.log('Title was: ' + title);10 })11 .end();12var webdriverio = require('webdriverio');13var options = {14 desiredCapabilities: {15 }16};17 .remote(options)18 .init()19 .getTitle().then(function(title) {20 console.log('Title was: ' + title);21 })22 .end();23var webdriverio = require('webdriverio');24var options = {25 desiredCapabilities: {26 }27};28 .remote(options)29 .init()30 .getTitle().then(function(title) {31 console.log('Title was: ' + title);32 })33 .end();34var webdriverio = require('webdriverio');35var options = {36 desiredCapabilities: {37 }38};39 .remote(options)40 .init()41 .getTitle().then(function(title) {42 console.log('Title was: ' + title);

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var options = {3 desiredCapabilities: {4 }5};6 .remote(options)7 .init()8 .getTitle().then(function(title) {9 console.log('Title was: ' + title);10 })11 .end();

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var options = { desiredCapabilities: { browserName: 'chrome' } };3var client = webdriverio.remote(options);4 .init()5 .getTitle().then(function(title) {6 console.log('Title was: ' + title);7 })8 .end();9var webdriverio = require('webdriverio');10var options = { desiredCapabilities: { browserName: 'chrome' } };11var client = webdriverio.remote(options);12 .init()13 .getTitle().then(function(title) {14 console.log('Title was: ' + title);15 })16 .end();17var webdriverio = require('webdriverio');18var options = { desiredCapabilities: { browserName: 'chrome' } };19var client = webdriverio.remote(options);20 .init()21 .getTitle().then(function(title) {22 console.log('Title was: ' + title);23 })24 .end();25var webdriverio = require('webdriverio');26var options = { desiredCapabilities: { browserName: 'chrome' } };27var client = webdriverio.remote(options);28 .init()29 .getTitle().then(function(title) {30 console.log('Title was: ' + title);31 })32 .end();33var webdriverio = require('webdriverio');34var options = { desiredCapabilities: { browserName: 'chrome' } };35var client = webdriverio.remote(options);36 .init()37 .getTitle().then(function(title) {38 console.log('Title was: ' + title);39 })40 .end();41var webdriverio = require('webdriverio');42var options = { desiredCapabilities: { browserName: 'chrome' } };43var client = webdriverio.remote(options);

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var options = {3 desiredCapabilities: {4 }5};6var client = webdriverio.remote(options);7 .init()8 .getTitle().then(function(title) {9 console.log('Title was: ' + title);10 })11 .end();

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var options = { desiredCapabilities: { browserName: 'firefox' } };3var client = webdriverio.remote(options);4 .init()5 .getTitle().then(function(title) {6 console.log('Title was: ' + title);7 })8 .end();9client.getTitle().then(function(title) { console.log('Title was: ' + title); })10client.getTitle().then(function(title) { console.log('Title was: ' + title); })11client.getTitle().then(function(title) { console.log('Title was: ' + title); })12client.getTitle().then(function(title) { console.log('Title was: ' + title); })13client.getTitle().then(function(title) { console.log('Title was: ' + title); })14client.getTitle().then(function(title) { console.log('Title was: ' + title); })15client.getTitle().then

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var options = { desiredCapabilities: { browserName: 'chrome' } };3var client = webdriverio.remote(options);4 .init()5 .getTitle().then(function(title) {6 console.log('Title was: ' + title);7 })8 .end();

Full Screen

Using AI Code Generation

copy

Full Screen

1const webdriverio = require('webdriverio');2const options = {3 desiredCapabilities: {4 }5};6 .remote(options)7 .init()8 .getTitle().then(function(title) {9 console.log('Title was: ' + title);10 })11 .end();12const webdriverio = require('webdriverio');13const options = {14 desiredCapabilities: {15 }16};17async function getTitle() {18 const browser = await webdriverio.remote(options);19 await browser.init();20 const title = await browser.getTitle();21 console.log('Title was: ' + title);22 await browser.end();23}24getTitle();25Click()26const webdriverio = require('webdriverio');27const options = {28 desiredCapabilities: {29 }30};31async function click() {32 const browser = await webdriverio.remote(options);33 await browser.init();34 await browser.click('input[name="btnK"]');35 await browser.end();36}37click();38const webdriverio = require('webdriverio');39const options = {40 desiredCapabilities: {41 }42};43async function click() {44 const browser = await webdriverio.remote(options);45 await browser.init();46 await browser.click('input[name="btnK"]');47 await browser.end();48}49click();50Let’s see how to use the setValue() method in Web

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var options = { desiredCapabilities: { browserName: 'chrome' } };3var client = webdriverio.remote(options);4.init()5.getTitle().then(function(title) {6console.log('Title was: ' + title);7})8.end();9var webdriverio = require('webdriverio');10var options = { desiredCapabilities: { browserName: 'chrome' } };11var client = webdriverio.remote(options);12.init()13.getTitle().then(function(title) {14console.log('Title was: ' + title);15})16.click('#login > form > p:nth-child(3) > a')17.end();18var webdriverio = require('webdriverio');19var options = { desiredCapabilities: { browserName: 'chrome' } };20var client = webdriverio.remote(options);21.init()22.getTitle().then(function(title) {23console.log('Title was: ' + title);24})25.click('#login > form > p:nth-child(3) > a')26.click('#signup_button')27.end();28var webdriverio = require('webdriverio');29var options = { desiredCapabilities: { browserName: 'chrome' } };30var client = webdriverio.remote(options);31.init()32.getTitle().then(function(title) {33console.log('Title was: ' + title);34})35.click('#login > form > p:nth-child(3) > a')36.click('#signup_button')37.click('#user_email')38.end();

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Demo test', function() {2 it('Demo test', function() {3 var title = browser.getTitle();4 console.log('Title is: ' + title);5 });6});7describe('Demo test', function() {8 it('Demo test', function() {9 var title = browser.getTitle();10 console.log('Title is: ' + title);11 });12});13describe('Demo test', function() {14 it('Demo test', function() {15 var title = browser.getTitle();16 console.log('Title is: ' + title);17 });18});19describe('Demo test', function() {20 it('Demo test', function() {21 var title = browser.getTitle();22 console.log('Title is: ' + title);23 });24});25describe('Demo test', function() {26 it('Demo test', function() {27 var title = browser.getTitle();28 console.log('Title is: ' + title);29 });30});31describe('Demo test', function() {32 it('Demo test', function() {33 var title = browser.getTitle();34 console.log('Title is: ' + title);35 });36});37describe('Demo test', function() {38 it('Demo test', function() {39 var title = browser.getTitle();40 console.log('Title is: ' + title);41 });42});43describe('Demo test', function() {44 it('Demo test', function() {45 var title = browser.getTitle();46 console.log('Title is: ' + title);47 });48});49describe('Demo test', function() {50 it('Demo test', function() {

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('My First Test', function() {2it('Visit the webdriver.io', function() {3console.log(browser.getTitle());4});5});61 passing (2.0s)7The above test uses the console.log() method to log the title of the page to the console. The output of the above test is as follows:81 passing (2.0s)9The above test uses the before() method to open the webdriver.io website before the test and the after()

Full Screen

WebdriverIO Tutorial

Wondering what could be a next-gen browser and mobile test automation framework that is also simple and concise? Yes, that’s right, it's WebdriverIO. Since the setup is very easy to follow compared to Selenium testing configuration, you can configure the features manually thereby being the center of attraction for automation testing. Therefore the testers adopt WedriverIO to fulfill their needs of browser testing.

Learn to run automation testing with WebdriverIO tutorial. Go from a beginner to a professional automation test expert with LambdaTest WebdriverIO tutorial.

Chapters

  1. Running Your First Automation Script - Learn the steps involved to execute your first Test Automation Script using WebdriverIO since the setup is very easy to follow and the features can be configured manually.

  2. Selenium Automation With WebdriverIO - Read more about automation testing with WebdriverIO and how it supports both browsers and mobile devices.

  3. Browser Commands For Selenium Testing - Understand more about the barriers faced while working on your Selenium Automation Scripts in WebdriverIO, the ‘browser’ object and how to use them?

  4. Handling Alerts & Overlay In Selenium - Learn different types of alerts faced during automation, how to handle these alerts and pops and also overlay modal in WebdriverIO.

  5. How To Use Selenium Locators? - Understand how Webdriver uses selenium locators in a most unique way since having to choose web elements very carefully for script execution is very important to get stable test results.

  6. Deep Selectors In Selenium WebdriverIO - The most popular automation testing framework that is extensively adopted by all the testers at a global level is WebdriverIO. Learn how you can use Deep Selectors in Selenium WebdriverIO.

  7. Handling Dropdown In Selenium - Learn more about handling dropdowns and how it's important while performing automated browser testing.

  8. Automated Monkey Testing with Selenium & WebdriverIO - Understand how you can leverage the amazing quality of WebdriverIO along with selenium framework to automate monkey testing of your website or web applications.

  9. JavaScript Testing with Selenium and WebdriverIO - Speed up your Javascript testing with Selenium and WebdriverIO.

  10. Cross Browser Testing With WebdriverIO - Learn more with this step-by-step tutorial about WebdriverIO framework and how cross-browser testing is done with WebdriverIO.

Run Webdriverio automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful