mirror of
https://github.com/HangarMC/Hangar.git
synced 2024-11-27 06:01:08 +08:00
test(e2e): report better to bstack, try to play with timeouts to make stuff more reliable
This commit is contained in:
parent
f515192330
commit
63dac08373
@ -8,7 +8,7 @@ const BROWSERSTACK_ACCESS_KEY = process.env.BROWSERSTACK_ACCESS_KEY;
|
||||
const DEBUG = process.env.BROWSERSTACK_DEBUG === "true";
|
||||
const DEV = process.env.BROWSERSTACK_DEV === "true";
|
||||
const LOCAL = process.env.BROWSERSTACK_LOCAL === "true";
|
||||
const BUILD_NAME = process.env.BROWSERSTACK_BUILD_NAME || "browserstack-build-1" + (LOCAL ? "-local" : "");
|
||||
const BUILD_NAME = process.env.BROWSERSTACK_BUILD_NAME || "browserstack-build-" + new Date().getTime() + (LOCAL ? "-local" : "");
|
||||
|
||||
console.table({
|
||||
DEBUG,
|
||||
@ -41,6 +41,7 @@ exports.config = {
|
||||
key: DEV ? undefined : BROWSERSTACK_ACCESS_KEY,
|
||||
browser: "Edge",
|
||||
windowSize,
|
||||
waitForTimeout: 15000,
|
||||
capabilities: {
|
||||
...defaultCapabilities,
|
||||
os: "Windows",
|
||||
@ -115,5 +116,12 @@ exports.config = {
|
||||
screenshotOnFail: {
|
||||
enabled: true,
|
||||
},
|
||||
BrowserstackHelper: {
|
||||
require: "codeceptjs-bshelper",
|
||||
user: process.env.BROWSERSTACK_USERNAME,
|
||||
key: process.env.BROWSERSTACK_ACCESS_KEY,
|
||||
shortUrl: false,
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
} as CodeceptJS.MainConfig;
|
||||
|
@ -19,5 +19,8 @@
|
||||
"totp-generator": "1.0.0",
|
||||
"ts-node": "10.9.2",
|
||||
"webdriverio": "^7.36.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"codeceptjs-bshelper": "3.1.2"
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -6,5 +6,5 @@ Scenario("Test Author List", async ({ I, util, IndexPage }) => {
|
||||
I.dontSee("No authors found");
|
||||
|
||||
I.fillField("input[type='text']", "Some Value That doesnt Exist");
|
||||
I.waitForText("No authors found", 5);
|
||||
I.waitForText("No authors found");
|
||||
});
|
||||
|
@ -20,8 +20,6 @@ Scenario("Test Project List", async ({ I, util, IndexPage }) => {
|
||||
I.click(IndexPage.mostDownloadsButton);
|
||||
I.waitInUrl("sort=-downloads");
|
||||
I.waitToHide("//*[contains(text(),'There are no projects.')]");
|
||||
|
||||
await util.browserStackStatus(true, "Test passed");
|
||||
});
|
||||
|
||||
Scenario("Test Project List Query", async ({ I, util, IndexPage }) => {
|
||||
@ -33,6 +31,4 @@ Scenario("Test Project List Query", async ({ I, util, IndexPage }) => {
|
||||
I.seeElement(locate("button.bg-gradient-to-r").withText("Most Downloads"));
|
||||
// TODO test minecraft version (maybe selecting a sub version should open the tree too?)
|
||||
I.seeElement(locate("input").withAttr({ type: "checkbox", value: "admin_tools", checked: "" }));
|
||||
|
||||
await util.browserStackStatus(true, "Test passed");
|
||||
});
|
||||
|
@ -6,5 +6,5 @@ Scenario("Test Staff List", async ({ I, util, IndexPage }) => {
|
||||
I.dontSee("No staff found");
|
||||
|
||||
I.fillField("input[type='text']", "Some Value That doesnt Exist");
|
||||
I.waitForText("No staff found", 5);
|
||||
I.waitForText("No staff found");
|
||||
});
|
||||
|
@ -8,7 +8,7 @@ module.exports = new (class {
|
||||
|
||||
public openHangarPage(path: string) {
|
||||
I.amOnPage(this.url + path);
|
||||
I.waitForFunction(() => window["hangarLoaded"], 10);
|
||||
I.waitForFunction(() => window["hangarLoaded"]);
|
||||
}
|
||||
|
||||
public async browserStackStatus(passed: boolean, reason: string) {
|
||||
@ -23,12 +23,12 @@ module.exports = new (class {
|
||||
I.fillField("input[name='username']", admin ? "e2e_admin" : "e2e_user");
|
||||
I.fillField("input[name='password']", process.env.E2E_PASSWORD);
|
||||
I.click(locate("button").withText("Login"));
|
||||
I.waitForText("Use totp", 10);
|
||||
I.waitForText("Use totp");
|
||||
const totp = TOTP.generate(process.env.E2E_TOTP_SECRET);
|
||||
I.fillField("input", totp.otp);
|
||||
I.click("Use totp");
|
||||
I.waitInUrl("/?done");
|
||||
I.waitForText("FIND YOUR", 5);
|
||||
I.waitForText("FIND YOUR");
|
||||
}
|
||||
|
||||
public async getJwt() {
|
||||
|
@ -18,7 +18,7 @@ if (process.client) {
|
||||
document.documentElement.classList.remove("light", "dark");
|
||||
document.documentElement.classList.add(settingsStore.darkMode ? "dark" : "light");
|
||||
|
||||
window.hangarLoaded = true;
|
||||
nextTick(() => (window.hangarLoaded = true));
|
||||
}
|
||||
|
||||
useHead({
|
||||
|
Loading…
Reference in New Issue
Block a user