test: test case is added to open tab

This commit is contained in:
tzhangchi
2022-12-25 20:44:09 +08:00
parent 2cb0b6ba73
commit 5c7ea2990f
+25 -3
View File
@@ -3,8 +3,8 @@ import { loadPage } from './libs/load-page';
loadPage();
test.describe('Local first new page', () => {
test('Click btn new page', async ({ page }) => {
test.describe('local first new page', () => {
test('click btn new page', async ({ page }) => {
const originPageUrl = page.url();
await page.getByText('New Page').click();
const newPageUrl = page.url();
@@ -12,7 +12,7 @@ test.describe('Local first new page', () => {
expect(newPageUrl.length).toBe(originPageUrl.length);
});
test('Click btn bew page and find it in all pages', async ({ page }) => {
test('click btn bew page and find it in all pages', async ({ page }) => {
await page.getByText('New Page').click();
await page.getByPlaceholder('Title').click();
await page.getByPlaceholder('Title').fill('this is a new page');
@@ -20,4 +20,26 @@ test.describe('Local first new page', () => {
const cell = page.getByRole('cell', { name: 'this is a new page' });
expect(cell).not.toBeUndefined();
});
test('click btn bew page and open in tab', async ({ page }) => {
await page.getByText('New Page').click();
await page.getByPlaceholder('Title').click();
await page.getByPlaceholder('Title').fill('this is a new page');
const newPageUrl = page.url();
const newPageId = page.url().split('/').reverse()[0];
await page.getByRole('link', { name: 'All pages' }).click();
await page
.getByTestId('more-actions-' + newPageId)
.getByRole('button')
.first()
.click();
const [newTabPage] = await Promise.all([
page.waitForEvent('popup'),
page.getByRole('button', { name: 'Open in new tab' }).click(),
]);
expect(newTabPage.url()).toBe(newPageUrl);
});
});