-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix(#7552): Fix notebook snapshot image annotations #7555
Merged
Merged
Changes from 11 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
0e5b04e
fix: painterro import
ozyx 1d14905
test(snapshotAnnotation): add minimal e2e test
ozyx 81274df
chore: add e2e test annotation
ozyx f122e76
fix: notebook snapshot test
ozyx f649b4f
refactor: put `v-else` on template
ozyx 836da9a
small changes to the test and a visual one
unlikelyzero c61375b
additional a11y
unlikelyzero 1e2e3d6
fix: html structure
ozyx 2439450
test(e2e): fix notebook snapshot tests
ozyx e9f4324
Update documentation for file download and JSON testing
unlikelyzero 4401b9e
Update stubs and add jpg/png export
unlikelyzero 39f9020
refactor(TimelistComponent): tidy up
ozyx 24dbdf9
Merge branch 'master' into mct7552
ozyx dc4f97a
fix: a locator
ozyx 4c6b6db
Merge branch 'master' into mct7552
ozyx 3aa84a5
Merge branch 'master' into mct7552
ozyx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,41 +72,90 @@ test.describe('Snapshot Container tests', () => { | |
//Navigate to baseURL | ||
await page.goto('./', { waitUntil: 'domcontentloaded' }); | ||
|
||
// Create Notebook | ||
// const notebook = await createDomainObjectWithDefaults(page, { | ||
// type: 'Notebook', | ||
// name: "Test Notebook" | ||
// }); | ||
// // Create Overlay Plot | ||
// const snapShotObject = await createDomainObjectWithDefaults(page, { | ||
// type: 'Overlay Plot', | ||
// name: "Dropped Overlay Plot" | ||
// }); | ||
|
||
//Navigate to Snapshot Container | ||
await page.getByLabel('Take a Notebook Snapshot').click(); | ||
await page.getByRole('menuitem', { name: 'Save to Notebook Snapshots' }).click(); | ||
await page.getByLabel('Show Snapshots').click(); | ||
}); | ||
test('A snapshot can be Quick Viewed from Container with 3 dot action menu', async ({ page }) => { | ||
await page.locator('.c-snapshot.c-ne__embed').first().getByTitle('More actions').click(); | ||
await page.getByLabel('My Items Notebook Embed').getByLabel('More actions').click(); | ||
await page.getByRole('menuitem', { name: 'Quick View' }).click(); | ||
await expect(page.locator('.c-overlay__outer')).toBeVisible(); | ||
await expect(page.getByLabel('Modal Overlay')).toBeVisible(); | ||
await expect(page.getByLabel('Preview Container')).toBeVisible(); | ||
}); | ||
test('A snapshot can be Viewed, Annotated, display deleted, and saved from Container with 3 dot action menu', async ({ | ||
page | ||
}) => { | ||
test.info().annotations.push({ | ||
type: 'issue', | ||
description: 'https://github.com/nasa/openmct/issues/7552' | ||
}); | ||
//Open Snapshot Object View | ||
await page.getByLabel('My Items Notebook Embed').getByLabel('More actions').click(); | ||
await page.getByRole('menuitem', { name: 'View Snapshot' }).click(); | ||
await expect(page.getByRole('dialog', { name: 'Modal Overlay' })).toBeVisible(); | ||
await expect(page.locator('#snapshotDescriptor')).toHaveText( | ||
/SNAPSHOT \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/ | ||
); | ||
// Open Annotation Editor with Painterro | ||
await page.getByLabel('Annotate this snapshot').click(); | ||
await expect(page.locator('#snap-annotation-canvas')).toBeVisible(); | ||
ozyx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Clear the canvas | ||
await page.getByRole('button', { name: 'Put text [T]' }).click(); | ||
// Click in the Painterro canvas to add a text annotation | ||
await page.locator('.ptro-crp-el').click(); | ||
await page.locator('.ptro-text-tool-input').fill('...is there life on mars?'); | ||
// When working with Painterro, we need to check that the Apply button is hidden after clicking | ||
await page.getByTitle('Apply').click(); | ||
await expect(page.getByTitle('Apply')).toBeHidden(); | ||
|
||
// Save and exit annotation window | ||
await page.getByRole('button', { name: 'Save' }).click(); | ||
await page.getByRole('button', { name: 'Done' }).click(); | ||
|
||
// Open up annotation again | ||
await page.getByRole('img', { name: 'My Items thumbnail' }).click(); | ||
await expect(page.getByLabel('Modal Overlay').getByRole('img')).toBeVisible(); | ||
}); | ||
test('A snapshot can be Annotated and saved as a JPG and PNG', async ({ page }) => { | ||
//Open Snapshot Object View | ||
await page.getByLabel('My Items Notebook Embed').getByLabel('More actions').click(); | ||
await page.getByRole('menuitem', { name: 'View Snapshot' }).click(); | ||
await expect(page.getByRole('dialog', { name: 'Modal Overlay' })).toBeVisible(); | ||
|
||
// Open Annotation Editor with Painterro | ||
await page.getByLabel('Annotate this snapshot').click(); | ||
await expect(page.locator('#snap-annotation-canvas')).toBeVisible(); | ||
// Clear the canvas | ||
await page.getByRole('button', { name: 'Put text [T]' }).click(); | ||
// Click in the Painterro canvas to add a text annotation | ||
await page.locator('.ptro-crp-el').click(); | ||
await page.locator('.ptro-text-tool-input').fill('...is there life on mars?'); | ||
// When working with Painterro, we need to check that the Apply button is hidden after clicking | ||
await page.getByTitle('Apply').click(); | ||
await expect(page.getByTitle('Apply')).toBeHidden(); | ||
|
||
// Save and exit annotation window | ||
await page.getByRole('button', { name: 'Save' }).click(); | ||
await page.getByRole('button', { name: 'Done' }).click(); | ||
|
||
// Open up annotation again | ||
await page.getByRole('img', { name: 'My Items thumbnail' }).click(); | ||
await expect(page.getByLabel('Modal Overlay').getByRole('img')).toBeVisible(); | ||
|
||
// Save as JPG | ||
await Promise.all([ | ||
page.waitForEvent('download'), // Waits for the download event | ||
page.getByLabel('Export as JPG').click() // Triggers the download | ||
]); | ||
|
||
// Save as PNG | ||
await expect(page.getByLabel('Modal Overlay').getByRole('img')).toBeVisible(); | ||
await Promise.all([ | ||
page.waitForEvent('download'), // Waits for the download event | ||
page.getByLabel('Export as PNG').click() // Triggers the download | ||
]); | ||
Comment on lines
+144
to
+155
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. awesome! |
||
}); | ||
test.fixme( | ||
'A snapshot can be Viewed, Annotated, display deleted, and saved from Container with 3 dot action menu', | ||
async ({ page }) => { | ||
await page.locator('.c-snapshot.c-ne__embed').first().getByTitle('More actions').click(); | ||
await page.getByRole('menuitem', { name: ' View Snapshot' }).click(); | ||
await expect(page.locator('.c-overlay__outer')).toBeVisible(); | ||
await page.getByTitle('Annotate').click(); | ||
await expect(page.locator('#snap-annotation-canvas')).toBeVisible(); | ||
await page.getByRole('button', { name: '' }).click(); | ||
// await expect(page.locator('#snap-annotation-canvas')).not.toBeVisible(); | ||
await page.getByRole('button', { name: 'Save' }).click(); | ||
await page.getByRole('button', { name: 'Done' }).click(); | ||
//await expect(await page.locator) | ||
} | ||
); | ||
test.fixme('5 Snapshots can be added to a container', async ({ page }) => {}); | ||
test.fixme( | ||
'5 Snapshots can be added to a container and Deleted with Delete All action', | ||
|
@@ -116,10 +165,6 @@ test.describe('Snapshot Container tests', () => { | |
'A snapshot can be Deleted from Container with 3 dot action menu', | ||
async ({ page }) => {} | ||
); | ||
test.fixme( | ||
'A snapshot can be Navigated To from Container with 3 dot action menu', | ||
async ({ page }) => {} | ||
); | ||
test.fixme( | ||
'A snapshot can be Navigated To Item in Time from Container with 3 dot action menu', | ||
async ({ page }) => {} | ||
|
@@ -151,11 +196,4 @@ test.describe('Snapshot Container tests', () => { | |
//Snapshot removed from container? | ||
} | ||
); | ||
test.fixme( | ||
'Verify Embedded options for PNG, JPG, and Annotate work correctly', | ||
async ({ page }) => { | ||
//Add snapshot to container | ||
//Verify PNG, JPG, and Annotate buttons work correctly | ||
} | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,40 @@ | ||
<div class="c-notebook-snapshot"> | ||
<!-- parent container sets up this for flex column layout --> | ||
<div class="c-notebook-snapshot__header l-browse-bar"> | ||
<div class="l-browse-bar__start"> | ||
<div class="l-browse-bar__object-name--w"> | ||
<span class="c-object-label l-browse-bar__object-name"> | ||
<span class="c-object-label__type-icon" v-bind:class="cssClass"></span> | ||
<span class="c-object-label__type-icon" :class="cssClass"></span> | ||
<span class="c-object-label__name">{{ name }}</span> | ||
</span> | ||
</div> | ||
</div> | ||
|
||
<div id="snapshotDescriptor" class="l-browse-bar__snapshot-datetime"> | ||
SNAPSHOT {{ createdOn }} | ||
</div> | ||
<div class="c-button-set c-button-set--strip-h" role="toolbar"> | ||
<button class="c-button icon-download" aria-label="Export as PNG" @click="exportImage('png')"> | ||
<span class="c-button__label">PNG</span> | ||
</button> | ||
<button class="c-button icon-download" aria-label="Export as JPG" @click="exportImage('jpg')"> | ||
<span class="c-button__label">JPG</span> | ||
</button> | ||
</div> | ||
<div class="l-browse-bar__end"> | ||
<div class="l-browse-bar__snapshot-datetime">SNAPSHOT {{ createdOn }}</div> | ||
<span class="c-button-set c-button-set--strip-h"> | ||
<button | ||
class="c-button icon-download" | ||
title="Export This View's Data as PNG" | ||
@click="exportImage('png')" | ||
> | ||
<span class="c-button__label">PNG</span> | ||
</button> | ||
<button class="c-button" title="Export This View's Data as JPG" @click="exportImage('jpg')"> | ||
<span class="c-button__label">JPG</span> | ||
</button> | ||
</span> | ||
<a | ||
<button | ||
class="l-browse-bar__annotate-button c-button icon-pencil" | ||
title="Annotate" | ||
aria-label="Annotate this snapshot" | ||
@click="annotateSnapshot" | ||
> | ||
<span class="title-label">Annotate</span> | ||
</a> | ||
</button> | ||
</div> | ||
</div> | ||
|
||
<div | ||
ref="snapshot-image" | ||
class="c-notebook-snapshot__image" | ||
:style="{ backgroundImage: 'url(' + src + ')' }" | ||
role="img" | ||
alt="Annotatable Snapshot" | ||
></div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, although I'm worried that without something specific to our e2e testing framework we're just reproducing the Playwright docs here?