Skip to content
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

Playwright Initial Setup #3

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
a726963
feat: first playwright config
panoramix360 Feb 8, 2024
ebf53dc
feat: adding utils files
panoramix360 Feb 8, 2024
e433aa0
feat: change the export way
panoramix360 Feb 12, 2024
dc16baa
adds config to the RunContainer function
panoramix360 Feb 21, 2024
08db487
feat: configuring the node-fetch package
panoramix360 Feb 22, 2024
fb1149a
feat: externalizing PluginConfig
panoramix360 Mar 5, 2024
90336a0
feat: adding external plugin configuration
panoramix360 Mar 14, 2024
eefcd4c
feat: adding an example-test-folder
panoramix360 Mar 14, 2024
63bba59
chore: removes the console log
panoramix360 Mar 14, 2024
d91e7f7
feat: moving the constructor to the top and changing the name of the …
panoramix360 Mar 14, 2024
730844d
feat: enhancing the readfile for loop
panoramix360 Mar 22, 2024
814cdef
feat: configuring eslint and formatting
panoramix360 Mar 22, 2024
12c2372
chore: removes unecessary imports
panoramix360 Mar 22, 2024
4905419
feat: removing the `no-process-env` and `no-undefined` to not complai…
panoramix360 Mar 22, 2024
a1afbb6
feat: creating the concept of the MattermostPlugin
panoramix360 Mar 26, 2024
9f05ee9
fix: eslint problem on the promises of the plugins to install
panoramix360 Mar 26, 2024
c4d5ab0
refactor to make it simpler to use an external plugin
panoramix360 Mar 26, 2024
c29ee4d
chore: fix babel old version
panoramix360 Apr 2, 2024
8fea238
chore: setting the nvm version
panoramix360 Apr 2, 2024
d3814c9
chore: actions on save
panoramix360 Apr 2, 2024
1ad4c91
chore: removing eslint n
panoramix360 Apr 2, 2024
49fa826
chore: fixing babel es lint parser
panoramix360 Apr 2, 2024
0a94b3f
newline in the end of file
panoramix360 Apr 3, 2024
e4a5a52
chore: renaming
panoramix360 Apr 3, 2024
833594b
chore: rename pluginid
panoramix360 Apr 3, 2024
d89e03a
feat: changing how the client types the configs for the plugin
panoramix360 Apr 3, 2024
f47d8d6
feat: adding demo plugin as a constant
panoramix360 Apr 3, 2024
7dc7fb2
chore: changing the default node version and the settings
panoramix360 Apr 22, 2024
359360a
feat: increasing the timeout and creating a dialog test
panoramix360 Apr 30, 2024
97aedfe
feat: adding the env
panoramix360 Apr 30, 2024
a5ba3aa
feat: adding a force boolean on the install commands
panoramix360 Apr 30, 2024
743d259
feat: testing github actions
panoramix360 May 2, 2024
4fb61e2
feat: change workflow action
panoramix360 May 2, 2024
5c66bb1
ci: moving the playwright workflow
panoramix360 May 2, 2024
ace8f8f
ci: test another command
panoramix360 May 2, 2024
19c8eb3
ci: adding a working dir
panoramix360 May 2, 2024
1867c0d
ci: playwright report path
panoramix360 May 2, 2024
462be25
chore: public var
panoramix360 May 13, 2024
e4e4aea
feat: changing node version to equal to nvmrc
panoramix360 May 13, 2024
f073874
chore: renaming folder
panoramix360 May 13, 2024
b5a874b
feat: adding the dist files
panoramix360 Sep 25, 2024
2369d27
feat: updates package json
panoramix360 Sep 25, 2024
40010ef
fix: issue when it's a local binary, the path was not being filled
panoramix360 Sep 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
541 changes: 541 additions & 0 deletions .eslintrc.json

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.eslintcache
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.20
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"eslint.validate": ["javascript"],
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
}
27 changes: 27 additions & 0 deletions example_plugin_tests/.github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Playwright Tests
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
5 changes: 5 additions & 0 deletions example_plugin_tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
118 changes: 118 additions & 0 deletions example_plugin_tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions example_plugin_tests/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "example_plugin_tests",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "playwright test",
"ui": "playwright test --ui"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"mattermost-plugin-e2e-test-utils": "file:..",
"@playwright/test": "^1.42.1",
"@types/node": "^20.11.24"
}
}
84 changes: 84 additions & 0 deletions example_plugin_tests/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import {defineConfig, devices} from '@playwright/test';

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './tests',

/* Run tests in files in parallel */
fullyParallel: true,

/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: Boolean(process.env.CI),

/* Retry on CI only */
retries: process.env.CI ? 2 : 0,

/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,

/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',

/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {

/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},

/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: {...devices['Desktop Chrome']},
},

{
name: 'firefox',
use: {...devices['Desktop Firefox']},
},

{
name: 'webkit',
use: {...devices['Desktop Safari']},
},

/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },

/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// },
],

/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
// url: 'http://127.0.0.1:3000',
// reuseExistingServer: !process.env.CI,
// },
});
43 changes: 43 additions & 0 deletions example_plugin_tests/tests/example.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import {test, expect} from '@playwright/test';
import {
MattermostContainer,
MattermostPlugin,
login,
logout,
} from 'mattermost-plugin-e2e-test-utils';

type DemoPluginConfig = {
clientId: string
}

const DEMO_PLUGIN_EXTERNAL_URL = 'https://github.com/mattermost/mattermost-plugin-demo/releases/download/v0.10.0/com.mattermost.demo-plugin-0.10.0.tar.gz';

let mattermost: MattermostContainer;
let demoPluginInstance: MattermostPlugin<DemoPluginConfig>;

test.beforeAll(async () => {
demoPluginInstance = new MattermostPlugin<DemoPluginConfig>({
pluginId: 'com.mattermost.demo-plugin',
pluginConfig: {
clientId: 'client-id',
},
}).
withExternalURL(DEMO_PLUGIN_EXTERNAL_URL);

mattermost = await new MattermostContainer().
withPlugin(demoPluginInstance).
startWithUserSetup();
panoramix360 marked this conversation as resolved.
Show resolved Hide resolved
});

test.afterAll(async () => {
await mattermost.stop();
});

test.describe('example test', () => {
test('check if the town square and plublic channel are created', async ({page}) => {
const url = mattermost.url();
await login(page, url, 'regularuser', 'regularuser');
await expect(page.getByLabel('town square public channel')).toBeVisible();
await logout(page);
});
});
Loading