Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit684a07e

Browse files
committed
Added environment file, fixtures and first test
1 parent629e981 commit684a07e

File tree

9 files changed

+128
-90
lines changed

9 files changed

+128
-90
lines changed

‎playwright/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
# Change the URL to your running lowcoder instance
12
LOWCODER_BASE_URL=http://lowcoder.internal:3000

‎playwright/data/local/test-data.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"users": {
3+
"admin": {
4+
"credentials": {
5+
"username":"admin1@admin.com",
6+
"password":"admin1234"
7+
}
8+
}
9+
}
10+
}

‎playwright/fixtures.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

‎playwright/pages/login-page.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export class LoginPage {
1010
privatereadonlysignUpLink:Locator;
1111

1212
constructor(publicreadonlypage:Page){
13+
this.page=page;
1314
this.emailInput=this.page.getByPlaceholder(/^Pleaseenteryouremail$/);
1415
this.passwordInput=this.page.getByPlaceholder(/^Pleaseenteryourpassword$/);
1516
this.confirmPasswordInput=this.page.getByPlaceholder(/^PleaseConfirmPassword$/);
@@ -19,6 +20,27 @@ export class LoginPage {
1920
this.signUpLink=this.page.getByRole('link',{name:'Sign Up'});
2021
}
2122

23+
24+
/*
25+
26+
test('test', async ({ page }) => {
27+
await page.goto('http://localhost:3000/');
28+
await page.goto('http://localhost:3000/apps');
29+
await page.goto('http://localhost:3000/user/auth/login');
30+
await page.getByPlaceholder('Please enter your email').click();
31+
await page.getByPlaceholder('Please enter your email').fill('admin@admin.com');
32+
await page.getByRole('button', { name: 'Continue' }).click();
33+
await page.getByPlaceholder('Please enter your password').click();
34+
await page.getByPlaceholder('Please enter your password').fill('admin1234');
35+
await page.getByRole('button', { name: 'Sign In' }).click();
36+
await page.getByTitle('admin@admin.com', { exact: true }).click();
37+
await page.getByText('admin@admin.com', { exact: true }).click();
38+
await page.getByText('My Profile').click();
39+
});
40+
41+
*/
42+
43+
2244
asyncloadPage(){
2345
awaitthis.page.goto('/user/auth/login');
2446
}

‎playwright/pages/signup-page.ts

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import{typePage,typeLocator,expect}from'@playwright/test';
2+
3+
exportclassSignUpPage{
4+
privatetxtEmail:Locator;
5+
privatetxtPassword:Locator;
6+
privatetxtConfirmPassword:Locator;
7+
privatebtnSignUp:Locator;
8+
9+
constructor(publicpage:Page){
10+
this.page=page;
11+
this.txtEmail=this.page.getByPlaceholder(/^Pleaseenteryouremail$/);
12+
this.txtPassword=this.page.getByPlaceholder(/^PleaseEnterPassword$/);
13+
this.txtConfirmPassword=this.page.getByPlaceholder(/^PleaseConfirmPassword$/);
14+
this.btnSignUp=this.page.getByRole('button',{name:'Sign Up'});
15+
}
16+
17+
asyncLoad(){
18+
awaitthis.page.goto('/user/auth/register');
19+
}
20+
21+
asyncSignUp(username:string,password:string,repeatPassword:string){
22+
/** Check that input descriptions are present and visible */
23+
awaitexpect(this.page.locator('div').filter({hasText:/^SignUp$/}),'page header "Sign Up" is displayed').toBeVisible();
24+
awaitexpect(this.page.getByText('Email:'),'"email" text input is displayed').toBeVisible();
25+
awaitexpect(this.page.getByText('Password',{exact:true}),'"password" text input is displayed').toBeVisible();
26+
awaitexpect(this.page.getByText('Confirm Password'),'"confirm password" text input is displayed').toBeVisible();
27+
awaitexpect(this.page.getByText('I Have Read and Agree to the'),'agree to ToS checkbox is displayed').toBeVisible();
28+
29+
// TODO: uncomment and add testId once it's added in frontend
30+
// await expect(this.page.getByTestId(''), 'agree to ToS checkbox is checked').toBeChecked();
31+
32+
/** Fill inputs and clicn sign up */
33+
awaitthis.txtEmail.click();
34+
awaitthis.txtEmail.fill(username);
35+
awaitthis.txtPassword.click();
36+
awaitthis.txtPassword.fill(password);
37+
awaitthis.txtConfirmPassword.click();
38+
awaitthis.txtConfirmPassword.fill(repeatPassword);
39+
awaitthis.btnSignUp.click();
40+
}
41+
42+
asyncAssertWorkspaceCreated(){
43+
/** Acceptance criteria:
44+
* - new workspace opens walkthrough demo
45+
* - new workspace has no applications created yet
46+
*/
47+
awaitexpect(this.page.getByText('Create App'),'walkthrough demo title is displayed').toBeVisible();
48+
awaitexpect(this.page.getByText('Welcome! Click \'App\' and'),'walkthrough demo description is displayed').toBeVisible();
49+
awaitexpect(this.page.getByLabel('Skip'),'walkthrough demo "Skip" option is displayed').toBeVisible();
50+
awaitexpect(this.page.getByText('You don\'t have any apps yet.'),'workspace information about no apps is displayed').toBeVisible();
51+
52+
/**
53+
* Acceptance criteria:
54+
* - 'Query Library' link in left side menu is visible
55+
* - 'Data Sources' link in left side menu is visible
56+
* - 'Settings' link in left side menu is visible
57+
* - 'Trash' link in left side menu is visible
58+
*/
59+
awaitexpect(this.page.getByText('Query Library'),'Left menu "Query Library" is displayed').toBeVisible();
60+
awaitexpect(this.page.getByText('Data Sources'),'Left menu "Data Sources" is displayed').toBeVisible();
61+
awaitexpect(this.page.getByText('Settings'),'Left menu "Settings" is displayed').toBeVisible();
62+
awaitexpect(this.page.getByText('Trash'),'Left menu "Thrash" is displayed').toBeVisible();
63+
}
64+
65+
}

‎playwright/playwright.config.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,23 @@ export default defineConfig({
3737

3838
/* Configure projects for major browsers */
3939
projects:[
40+
/**
4041
{
4142
name: 'chromium',
4243
use: { ...devices['Desktop Chrome'] },
4344
},
4445
46+
**/
4547
{
4648
name:'firefox',
4749
use:{ ...devices['Desktop Firefox']},
4850
},
49-
51+
/**
5052
{
5153
name: 'webkit',
5254
use: { ...devices['Desktop Safari'] },
5355
},
54-
56+
**/
5557
/* Test against mobile viewports. */
5658
// {
5759
// name: 'Mobile Chrome',

‎playwright/tests/01-signup-login-logout.spec.ts

Lines changed: 0 additions & 80 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import{test,expect}from'../utils/fixtures';
2+
importtestDatafrom'../data/local/test-data.json';
3+
4+
test('TC01 - Sign up ( Admin )',async({ signUpPage, page})=>{
5+
awaitsignUpPage.SignUp(testData.users.admin.credentials.username,testData.users.admin.credentials.password,testData.users.admin.credentials.password);
6+
awaitsignUpPage.AssertWorkspaceCreated();
7+
});

‎playwright/utils/fixtures.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import{testasbase}from'@playwright/test';
2+
import{SignUpPage}from'../pages/signup-page';
3+
4+
typeLowcoderFixtures={
5+
signUpPage:SignUpPage;
6+
};
7+
8+
exportconsttest=base.extend<LowcoderFixtures>({
9+
signUpPage:async({ page},use)=>{
10+
11+
// Set up the fixture.
12+
constsignUpPage=newSignUpPage(page);
13+
awaitsignUpPage.Load();
14+
15+
// Use the fixture value in the test.
16+
awaituse(signUpPage);
17+
},
18+
});
19+
export{expect}from'@playwright/test';

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp