Skip to content

Commit 27f8d01

Browse files
authored
Merge pull request #1237 from mito-ds/toolbar-top-tests
Add toolbar top tests
2 parents fa5f667 + 93fb24c commit 27f8d01

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import { expect, test } from '@playwright/test';
2+
import { clickButtonAndAwaitResponse, getMitoFrameWithTestCSV } from '../utils';
3+
4+
test.describe('Top of Toolbar', () => {
5+
test('Undo', async ({ page }) => {
6+
const mito = await getMitoFrameWithTestCSV(page);
7+
await expect(mito.getByText('Import Files')).not.toBeVisible();
8+
9+
await mito.getByTitle(/Undo the most recent edit./).click();
10+
await expect(mito.getByText('Import Files')).toBeVisible();
11+
});
12+
13+
test('Redo', async ({ page }) => {
14+
const mito = await getMitoFrameWithTestCSV(page);
15+
await expect(mito.getByText('Import Files')).not.toBeVisible();
16+
17+
await mito.getByTitle(/Undo the most recent edit./).click();
18+
await expect(mito.getByText('Import Files')).toBeVisible();
19+
20+
await mito.getByTitle(/Reapplies the last step that you undid, as long as you haven't made any edits since the undo./).click();
21+
await expect(mito.getByText('Import Files')).not.toBeVisible();
22+
});
23+
24+
test('Clear', async ({ page }) => {
25+
const mito = await getMitoFrameWithTestCSV(page);
26+
27+
// Insert a new column
28+
await mito.locator('.mito-toolbar-button', { hasText: 'Insert' }).click();
29+
await expect(mito.locator('.endo-column-header-final-text', { hasText: /new-column/ })).toBeVisible();
30+
31+
// Clear the analysis
32+
await mito.getByTitle('Removes all of the transformations you\'ve made to imported dataframes.').click();
33+
await expect(mito.getByText('Clear your current analysis?')).toBeVisible();
34+
await mito.getByText('Clear', { exact: true }).click();
35+
36+
// Expect that the column does not exist
37+
await expect(mito.locator('.endo-column-header-final-text', { hasText: /new-column/ })).not.toBeVisible();
38+
});
39+
40+
test('Steps', async ({ page }) => {
41+
const mito = await getMitoFrameWithTestCSV(page);
42+
43+
await mito.locator('.mito-toolbar-button', { hasText: 'Insert' }).click();
44+
await expect(mito.locator('.endo-column-header-final-text', { hasText: /new-column/ })).toBeVisible();
45+
46+
await mito.getByTitle('View a list of all the edits you\'ve made to your data.').click();
47+
await expect(mito.getByText('Step History')).toBeVisible();
48+
await expect(mito.getByText('Imported', { exact: true })).toBeVisible();
49+
await expect(mito.getByText('Added column', { exact: true })).toBeVisible();
50+
51+
// Click on a step and check that the column is removed
52+
await mito.getByText('Imported', { exact: true }).click();
53+
await expect(mito.locator('.endo-column-header-final-text', { hasText: /new-column/ })).not.toBeVisible();
54+
await expect(mito.getByText('You are viewing a previous step, and cannot make any edits.')).toBeVisible();
55+
56+
// Check that you can catch up to the latest step
57+
await mito.getByText('Catch up').click();
58+
await expect(mito.locator('.endo-column-header-final-text', { hasText: /new-column/ })).toBeVisible();
59+
})
60+
61+
test('Help button', async ({ page }) => {
62+
const mito = await getMitoFrameWithTestCSV(page);
63+
64+
const popupPromise = page.waitForEvent('popup');
65+
await mito.getByText('Help').click();
66+
const popup = await popupPromise;
67+
await expect(popup.url()).toBe('https://discord.com/invite/XdJSZyejJU');
68+
});
69+
70+
test('Search button', async ({ page }) => {
71+
const mito = await getMitoFrameWithTestCSV(page);
72+
73+
await mito.getByRole('button', { name: /Search for a value in your data./ }).click();
74+
await expect(mito.getByPlaceholder('Find...')).toBeVisible();
75+
});
76+
});

0 commit comments

Comments
 (0)