Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(async () => {
try {
await openBrowserAndStartScreencast(
path.join('captures', 'frames', 'frames.gif'),
);
await goto('http://localhost:3000/nested_frames');
expect(
await text('MIDDLE').exists(),
'expected "MIDDLE" to exist on page',
).to.be.true;
// taiko does not need to be told about frames, it automagically figures it out.
//TODO: tinyMCE example
} catch (e) {
console.error(e);
process.exitCode = 1;
} finally {
await closeBrowserAndStopScreencast();
}
})();
(async () => {
try {
// example 1
await openBrowserAndStartScreencast(
path.join('captures', 'dynamic-pages', 'dynamic-pages.gif'),
);
await goto('http://localhost:3000/dynamic_loading');
await click('Example 1:');
await click('Start');
// no waits, taiko implicitly listens and waits for the right state.
expect(await text('Hello World').exists()).to.be.true;
// example 2
await goto('http://localhost:3000/dynamic_loading');
await click('Example 2:');
await click('Start');
expect(await text('Hello World').exists()).to.be.true;
} catch (e) {
console.error(e);
process.exitCode = 1;
} finally {
await closeBrowserAndStopScreencast();
}
})();
(async () => {
try {
await openBrowserAndStartScreencast(
path.join('captures', 'file-upload', 'file-upload.gif'),
);
await goto('http://localhost:3000/upload');
await attach(
path.join(__dirname, 'data', 'foo.txt'),
fileField(above(button('Upload'))),
);
await click('Upload');
var exists = await text('file uploaded!').exists();
expect(exists).to.be.true;
} catch (e) {
console.error(e);
process.exitCode = 1;
} finally {
await closeBrowserAndStopScreencast();
}
})();
(async () => {
try {
await openBrowserAndStartScreencast(
path.join('captures', 'basic-auth', 'basic-auth.gif'),
);
await goto('http://admin:admin@localhost:3000/basic_auth');
expect(
await text(
'Congratulations! You must have the proper credentials.',
).exists(),
).to.be.true;
} catch (e) {
console.error(e);
process.exitCode = 1;
} finally {
await closeBrowserAndStopScreencast();
}
})();
(async () => {
try {
const url = 'http://localhost:3000/windows';
await openBrowserAndStartScreencast(
path.join('captures', 'windows', 'windows.gif'),
);
await goto(url);
await click('click here');
expect(await title()).to.eq('The Internet Express');
await closeTab();
expect(await currentURL()).to.eq(url);
expect(await text('Opening a new Window').exists()).to.be.true;
} catch (e) {
console.error(e);
process.exitCode = 1;
} finally {
await closeBrowserAndStopScreencast();
}
})();