You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importReactfrom'react';import{testasbase,expect}from'@playwright/experimental-ct-react';import{Locator,Page}from'@playwright/test';interfaceBaseTestTryoutOption{author: string;}exportclassTodoPage{privatereadonlyinputBox: Locator;privatereadonlytodoItems: Locator;constructor(publicreadonlypage: Page){this.inputBox=this.page.locator('input.new-todo');this.todoItems=this.page.getByTestId('todo-item');}}exporttypeTryoutFixture={todoPage: TodoPage;};// typescript does not let me export the test objectexportconsttest=base.extend<BaseTestTryoutOption&TryoutFixture>({author: undefined,todoPage: async({ author, page, mount },use)=>{console.log(author);consttodo=newTodoPage(page);awaituse(todo);},});test('basic test',async({ page, mount })=>{constcomp=awaitmount(<divdata-testid={'tryout'}>helloworld</div>);
awaitexpect(page.getByTestId('tryout')).toHaveText('hello world');});
Expected behavior
i would expect to export the test object from the file and reuse in other test files. Check out the code reproduction code above for more details.
Actual behavior
as soon as i add the export to the test object i receive the following error:
The text was updated successfully, but these errors were encountered:
Thomas-Haider
changed the title
[Bug]: Can export extended test object (@playwright/experimental-ct-react)
[Bug]: Can't export extended test object (@playwright/experimental-ct-react)
May 7, 2024
Closing as part of the triage process since it seemed stale. Please create a new issue with a detailed reproducible or feature request if you still face issues.
Version
1.43.1
Steps to reproduce
create a test and past following code:
Expected behavior
i would expect to export the test object from the file and reuse in other test files. Check out the code reproduction code above for more details.
Actual behavior
as soon as i add the export to the test object i receive the following error:
Additional context
No response
Environment
The text was updated successfully, but these errors were encountered: