Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

October 1 package updates #12226

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions Specs/e2e/CesiumPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,4 @@ export class CesiumPage {
: `window.CESIUM_BASE_URL = "../../Build/CesiumUnminified/";`,
});
}

/**
* Updates the system time by 1 second. Useful for testing animations or other time-based actions.
*/
async tick() {
await this.page.evaluate(() => window.__clock.tickAsync(1000));
}
}
7 changes: 6 additions & 1 deletion Specs/e2e/models.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ test("loads animated model", async ({ cesiumPage }) => {

viewer.trackedEntity = entity;
});
await cesiumPage.page.clock.pauseAt(new Date("2023-12-25T14:00:00"));
await cesiumPage.page.waitForLoadState("networkidle");

await cesiumPage.page.clock.runFor(1000);
await cesiumPage.page.clock.runFor(1000);
await cesiumPage.page.clock.runFor(1000);

await cesiumPage.tick();
await expect(cesiumPage.page).toHaveScreenshot();
});

Expand Down
4 changes: 2 additions & 2 deletions Specs/e2e/picking.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ test("Shows cartographic position on mouse over", async ({ cesiumPage }) => {
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
});

await cesiumPage.tick();
await cesiumPage.page.clock.runFor(1000);
await cesiumPage.page.waitForLoadState("networkidle");

const { width, height } = cesiumPage.page.viewportSize();
await cesiumPage.page.mouse.move(width / 2, height / 2);

await cesiumPage.tick();
await cesiumPage.page.clock.runFor(1000);

await expect(cesiumPage.page).toHaveScreenshot();
});
9 changes: 5 additions & 4 deletions Specs/e2e/sandcastle.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ for (const example of gallery) {

await page.goto(example);

await page.clock.pauseAt(new Date("2023-12-25T14:00:00"));

await page.waitForLoadState("networkidle");

await page.evaluate(() => window.__clock.tickAsync(1000));
await page.evaluate(() => window.__clock.tickAsync(1000));
await page.evaluate(() => window.__clock.tickAsync(1000));
await page.evaluate(() => window.__clock.tickAsync(1000));
await page.clock.runFor(1000);
await page.clock.runFor(1000);
await page.clock.runFor(1000);

await expect(page).toHaveScreenshot({
timeout: 20000,
Expand Down
14 changes: 1 addition & 13 deletions Specs/e2e/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,7 @@ import { CesiumPage } from "./CesiumPage.js";

export const test = baseTest.extend({
page: async ({ page }, use) => {
// Mock the current system time - Always use the exact same time
await page.addInitScript({
path: "node_modules/sinon/pkg/sinon.js",
});
await page.addInitScript(() => {
/* global sinon */
window.__clock = sinon.useFakeTimers({
now: 1703530800000, // 2023-12-25 14:00:00
shouldAdvanceTime: false,
toFake: ["Date", "hrtime", "performance"],
});
});

await page.clock.setFixedTime(new Date("2023-12-25T14:00:00"));
await use(page);
},

Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@
},
"devDependencies": {
"@playwright/test": "^1.41.1",
"chokidar": "^3.5.3",
"chokidar": "^4.0.1",
"cloc": "^2.2.0-cloc",
"compression": "^1.7.4",
"esbuild": "^0.23.0",
"esbuild": "^0.24.0",
"eslint": "^9.1.1",
"eslint-config-cesium": "^11.0.1",
"eslint-plugin-html": "^8.1.1",
Expand Down Expand Up @@ -90,7 +90,7 @@
"karma-safari-launcher": "^1.0.0",
"karma-sourcemap-loader": "^0.4.0",
"karma-spec-reporter": "^0.0.36",
"markdownlint-cli": "^0.41.0",
"markdownlint-cli": "^0.42.0",
"merge-stream": "^2.0.0",
"mkdirp": "^3.0.1",
"node-fetch": "^3.2.10",
Expand All @@ -99,7 +99,6 @@
"prismjs": "^1.28.0",
"request": "^2.79.0",
"rimraf": "^5.0.0",
"sinon": "^18.0.0",
"tsd-jsdoc": "^2.5.0",
"typescript": "^5.3.2",
"yargs": "^17.0.1"
Expand Down