Skip to content

Instantly share code, notes, and snippets.

@javajon
Created March 29, 2021 00:51
Show Gist options
  • Save javajon/bd058768c3fea01ac24c47a4500e77e7 to your computer and use it in GitHub Desktop.
Save javajon/bd058768c3fea01ac24c47a4500e77e7 to your computer and use it in GitHub Desktop.
const {
openBrowser,
goto,
text,
click,
closeBrowser
} = require('taiko');
const headless = process.env.headless_chrome.toLowerCase() === 'true';
beforeSuite(async () => {
await openBrowser({headless: headless})
});
afterSuite(async () => {
await closeBrowser();
});
step("Start javajon scenario <scenario>", async function (scenario) {
try {
await goto("https://katacoda.com/javajon/courses/" + scenario);
} catch (error) {
console.log(error);
}
});
step("Check intro", async function () {
try {
await text("Difficulty:").exists();
await text("Introduction").exists();
await text('10 minutes').exists();
await text('Jonathan Johnson').exists();
await click('START SCENARIO');
} catch (error) {
console.log(error);
}
});
step("Check step 1", async function () {
try {
await text("helm version --short").exists();
await click(text("helm version --short"));
await text("v3.1.2+").exists();
await click(text("kubectl version --short"));
await text("controlplane Ready").exists();
await text("node01 Ready").exists();
await text("Server Version: v1.18.0").exists();
await click(text("token.sh"));
await text("Copy and paste this token for dashboard access").exists();
await click("CONTINUE");
} catch (error) {
console.log(error);
}
});
step("Check step 2", async function () {
try {
await click(text("kubectl version"));
await text("/Server.*Info.*v1.18.0/").exists();
await click("kubectl run nginx-one --image=nginx");
} catch (error) {
console.log(error);
}
});
function row(command, result) {
console.log(command, result)
};
step("Show table <table>", async function(table) {
table.rows.forEach(function (row) {
row(row.cells[0], row.cells[1])
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment