mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: cleanup
This commit is contained in:
21
apps/ui/e2e/suites/css/styles/styles-page.ts
Normal file
21
apps/ui/e2e/suites/css/styles/styles-page.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { AppiumDriver, logInfo } from "nativescript-dev-appium";
|
||||
|
||||
import { PageObjectBaseModel } from "../../../page-object-base-model";
|
||||
|
||||
export class StylesPage extends PageObjectBaseModel {
|
||||
|
||||
private readonly app = "app";
|
||||
|
||||
constructor(_driver: AppiumDriver) {
|
||||
super(_driver, ["css", "styles"]);
|
||||
}
|
||||
|
||||
async btnApp() {
|
||||
return this._driver.waitForElement(this.app);
|
||||
}
|
||||
|
||||
async tapAppBtn() {
|
||||
await (await this.btnApp()).click();
|
||||
logInfo(`Tap on '${this.app}' button.`);
|
||||
}
|
||||
}
|
||||
41
apps/ui/e2e/suites/css/styles/styles.e2e-spec.ts
Normal file
41
apps/ui/e2e/suites/css/styles/styles.e2e-spec.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { assert } from "chai";
|
||||
import { AppiumDriver, createDriver, nsCapabilities } from "nativescript-dev-appium";
|
||||
|
||||
import { setImageName } from "../../../helpers/image-helper";
|
||||
import { StylesPage } from "./styles-page";
|
||||
|
||||
const suite = "css";
|
||||
const spec = "styles";
|
||||
|
||||
describe(`${suite}-${spec}-suite`, () => {
|
||||
let driver: AppiumDriver;
|
||||
let stylesPage: StylesPage;
|
||||
|
||||
before(async function () {
|
||||
nsCapabilities.testReporter.context = this;
|
||||
driver = await createDriver();
|
||||
await driver.restartApp();
|
||||
stylesPage = new StylesPage(driver);
|
||||
await stylesPage.initSuite();
|
||||
});
|
||||
|
||||
after(async function () {
|
||||
await stylesPage.endSuite();
|
||||
});
|
||||
|
||||
beforeEach(async function () {
|
||||
driver.imageHelper.testName = setImageName(suite, spec, this.currentTest.title);
|
||||
});
|
||||
|
||||
afterEach(async function () {
|
||||
if (this.currentTest.state === "failed") {
|
||||
await driver.logTestArtifacts(this.currentTest.title);
|
||||
}
|
||||
});
|
||||
|
||||
it(`${suite}-${spec}-apply`, async function () {
|
||||
await stylesPage.tapAppBtn();
|
||||
await driver.imageHelper.compareScreen();
|
||||
assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user