Skip to content

Commit

Permalink
Added VR tests to declarative chart (#104)
Browse files Browse the repository at this point in the history
* added VR tests

* updated snapshots

* updated snapshots

* removed unwanted chnages

* updated snashots
  • Loading branch information
v-baambati authored Dec 27, 2024
1 parent 0946368 commit 7f9bf9c
Show file tree
Hide file tree
Showing 89 changed files with 2,365 additions and 2,102 deletions.
142 changes: 83 additions & 59 deletions apps/plotly_examples/package-lock.json

Large diffs are not rendered by default.

28 changes: 15 additions & 13 deletions apps/plotly_examples/src/components/DeclarativeChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,21 @@ export class DeclarativeChartBasicExample extends React.Component<{}, IDeclarati
>
Download
</button>
<br />
<br />
<h2>{this.state.selectedChoice}. {selectedSchema.layout.title}</h2>
<br />
<br />
<ErrorBoundary>
<DeclarativeChart
key={uniqueKey}
chartSchema={inputSchema}
onSchemaChange={this._handleChartSchemaChanged}
componentRef={this._declarativeChartRef}
/>
</ErrorBoundary>
<div data-testid="chart-container" >
<br />
<br />
<h2>{this.state.selectedChoice}. {selectedSchema.layout.title}</h2>
<br />
<br />
<ErrorBoundary>
<DeclarativeChart
key={uniqueKey}
chartSchema={inputSchema}
onSchemaChange={this._handleChartSchemaChanged}
componentRef={this._declarativeChartRef}
/>
</ErrorBoundary>
</div>
<br />
<TextField
label="Current Legend selection"
Expand Down
4 changes: 4 additions & 0 deletions apps/plotly_examples/test-results/.last-run.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"status": "failed",
"failedTests": []
}
5 changes: 5 additions & 0 deletions apps/plotly_examples/tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
23 changes: 23 additions & 0 deletions apps/plotly_examples/tests/e2e/DeclarativeChart.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { test, expect } from '@playwright/test';

test('Declarative Chart', async ({ page }) => {
await page.goto('http://localhost:3000/');

await expect(page.getByText('Data Visualization')).toBeVisible();
const combobox = page.getByRole('combobox');
await expect(combobox).toHaveCount(1);
await combobox.click();
const listbox = page.locator('.ms-Callout-main');
await expect(listbox).toHaveCount(1);
const listitems = listbox.getByRole('option');
const lisItemsCount = await listitems.count();
for (let i = 0; i < lisItemsCount; i++) {
if (i != 33) {
await listitems.nth(i).scrollIntoViewIfNeeded();
await listitems.nth(i).click();
const chart = page.getByTestId('chart-container');
await expect(chart).toHaveScreenshot();
await combobox.click();
}
}
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
84 changes: 84 additions & 0 deletions apps/plotly_examples/tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions apps/plotly_examples/tests/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "tests",
"version": "1.0.0",
"main": "index.js",
"dependencies": {
"playwright": "^1.49.1",
"playwright-core": "^1.49.1",
"undici-types": "^6.20.0"
},
"devDependencies": {
"@playwright/test": "^1.49.1",
"@types/node": "^22.10.2"
},
"scripts": {},
"keywords": [],
"author": "",
"license": "ISC",
"description": ""
}
80 changes: 80 additions & 0 deletions apps/plotly_examples/tests/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { defineConfig, devices } from '@playwright/test';

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// import dotenv from 'dotenv';
// import path from 'path';
// dotenv.config({ path: path.resolve(__dirname, '.env') });

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './e2e',
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
timeout: 180000,
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},

/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},

// {
// name: 'firefox',
// use: { ...devices['Desktop Firefox'] },
// },

// {
// name: 'webkit',
// use: { ...devices['Desktop Safari'] },
// },

/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },

/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// },
],

/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
// url: 'http://127.0.0.1:3000',
// reuseExistingServer: !process.env.CI,
// },
});
Loading

0 comments on commit 7f9bf9c

Please sign in to comment.