From 92a6f71fd3ceb8a940eff92d7ad8ff0645eab535 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Tue, 21 May 2019 17:44:30 +0800 Subject: [PATCH] DEV: Update smoke test to test editing of a post. --- test/smoke_test.js | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/test/smoke_test.js b/test/smoke_test.js index 31f61ab530..e85db97de2 100644 --- a/test/smoke_test.js +++ b/test/smoke_test.js @@ -270,6 +270,55 @@ const path = require("path"); return output === 2; } ); + + await page.waitFor(1000); + + await exec("open composer to edit first post", () => { + return page.click(".post-controls:first-of-type .edit"); + }); + + await exec("update post raw in composer", () => { + let promise = page.waitForSelector("#reply-control .d-editor-input", { + visible: true + }); + + promise = promise.then(() => page.waitFor(1000)); + + promise = promise.then(() => { + const post = `I edited this post`; + return page.type("#reply-control .d-editor-input", post); + }); + + return promise; + }); + + await exec("submit the edit", () => { + return page.click("#reply-control .create"); + }); + + await assert( + "reply is created", + () => { + let promise = page.waitForSelector("#reply-control.closed", { + visible: false + }); + + promise = promise.then(() => { + return page.waitForSelector("#post_1", { visible: true }); + }); + + promise = promise.then(() => { + return page.evaluate(() => { + return document.querySelector("#post_1 .cooked").textContent; + }); + }); + + return promise; + }, + output => { + return output.includes(`I edited this post`); + } + ); } await exec("close browser", () => {