Skip to content

Commit

Permalink
E2E: CI Improvements (#2918)
Browse files Browse the repository at this point in the history
  • Loading branch information
yasserfaraazkhan authored Dec 13, 2023
1 parent 45b08df commit 675ec6d
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 44 deletions.
38 changes: 27 additions & 11 deletions .github/workflows/e2e-functional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ env:
BRANCH: ${{ github.ref }}
BUILD_SUFFIX: 'desktop-pr'
JIRA_PROJECT_KEY: 'MM'
MM_TEST_SERVER_URL: "https://mattermost-pr-23996.test.mattermost.cloud/"
MM_TEST_SERVER_URL: ${{ secrets.MM_DESKTOP_E2E_SERVER_URL }}
MM_TEST_USER_NAME: ${{ secrets.MM_DESKTOP_E2E_USER_NAME }}
MM_TEST_PASSWORD: ${{ secrets.MM_DESKTOP_E2E_USER_CREDENTIALS }}
PULL_REQUEST_BASE_URL: "https://github.com/mattermost/desktop/pull/"
TYPE: ${{ github.event_name == 'pull_request' && 'PR' || '' }}
ZEPHYR_ENVIRONMENT_NAME: 'Desktop app'
ZEPHYR_FOLDER_ID: "3256491"
TEST_CYCLE_LINK_PREFIX: ${{ secrets.MM_DESKTOP_E2E_TEST_CYCLE_LINK_PREFIX }}
AWS_ACCESS_KEY_ID: ${{ secrets.MM_DESKTOP_E2E_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.MM_DESKTOP_E2E_AWS_SECRET_ACCESS_KEY }}
AWS_REGION: "us-east-1"
WEBHOOK_URL: ${{ secrets.MM_DESKTOP_E2E_WEBHOOK_URL }}
ZEPHYR_API_KEY: ${{ secrets.MM_DESKTOP_E2E_ZEPHYR_API_KEY }}

Expand Down Expand Up @@ -76,17 +79,10 @@ jobs:
Xvfb $DISPLAY -screen 0 1024x768x24 > /dev/null 2>&1 &
npm run test:e2e || true # making job pass even if the tests fail due to flakyness
npm run test:e2e:send-report
- name: Remove "Run Desktop E2E Tests" label
if: always()
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: |
Run Desktop E2E Tests
e2e-macos:
if: ${{ github.event.label.name == 'Run Desktop E2E Tests' }}
runs-on: macos-12
runs-on: macos-13
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
Expand All @@ -102,13 +98,21 @@ jobs:
with:
go-version: '1.20'

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x

- name: ci/install-dependencies
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
brew install yq
jq '.mac.target=["zip"]' electron-builder.json | jq '.mac.gatekeeperAssess=false' > /tmp/electron-builder.json && cp /tmp/electron-builder.json .
npm ci
npm install -g node-gyp
npm i robotjs
npm i -D electron-rebuild
npx electron-rebuild -f -t prod,optional,dev -w robotjs
- name: Set Environment Variables
run: |
Expand Down Expand Up @@ -138,7 +142,7 @@ jobs:
e2e-windows:
if: ${{ github.event.label.name == 'Run Desktop E2E Tests' }}
runs-on: windows-latest
runs-on: windows-2022
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
Expand Down Expand Up @@ -171,6 +175,7 @@ jobs:
node-gyp install --devdir="C:\Users\runneradmin\.electron-gyp" --target=$(jq -r .devDependencies.electron package.json) --dist-url="https://electronjs.org/headers"
node-gyp install --devdir="C:\Users\runneradmin\.electron-gyp" --target=$(jq -r .devDependencies.electron package.json) --dist-url="https://electronjs.org/headers" --arch arm64
node-gyp install --devdir="C:\Users\runneradmin\.electron-gyp" --target=$(jq -r .devDependencies.electron package.json) --dist-url="https://electronjs.org/headers" --arch ia32
npm ci --openssl_fips=''
- name: Set Environment Variables
shell: bash
Expand Down Expand Up @@ -199,3 +204,14 @@ jobs:
npm run test:e2e || true
npm run test:e2e:send-report
shell: bash

e2e-remove-label:
needs: [e2e-linux, e2e-macos, e2e-windows]
if: ${{ github.event.label.name == 'Run Desktop E2E Tests' }} && ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Remove "Run Desktop E2E Tests" label
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: |
Run Desktop E2E Tests
4 changes: 2 additions & 2 deletions e2e/modules/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ module.exports = {
await window.waitForSelector('#input_password-input');
await window.waitForSelector('#saveSetting');

await window.type('#input_loginId', 'sysadmin');
await window.type('#input_password-input', 'Sys@dmin123');
await window.type('#input_loginId', process.env.MM_TEST_USER_NAME);
await window.type('#input_password-input', process.env.MM_TEST_PASSWORD);
await window.click('#saveSetting');
},

Expand Down
6 changes: 1 addition & 5 deletions e2e/specs/downloads/downloads_manager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,7 @@ describe('downloads/downloads_manager', function desc() {
});

it('MM-22239 should open downloads dropdown when a download starts', async () => {
await firstServer.locator('#file-attachment-link', {hasText: filename}).click();
await asyncSleep(1000);
await Promise.all([
firstServer.locator(`div[role="dialog"] a[download="${filename}"]`).click(), // Triggers the download.
]);
await firstServer.locator(`a[download="${filename}"]`).click();
await asyncSleep(1000);
(await env.downloadsDropdownIsOpen(this.app)).should.equal(true);
});
Expand Down
10 changes: 4 additions & 6 deletions e2e/specs/menu_bar/history_menu.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,14 @@ describe('history_menu', function desc() {
await loadingScreen.waitForSelector('.LoadingScreen', {state: 'hidden'});
const firstServer = this.serverMap[`${config.teams[0].name}___TAB_MESSAGING`].win;
await env.loginToMattermost(firstServer);
await firstServer.waitForSelector('#sidebarItem_suscipit-4');

// click on sint channel
await firstServer.click('#sidebarItem_suscipit-4');

await firstServer.waitForSelector('#sidebarItem_off-topic');
// click on Off topic channel
await firstServer.click('#sidebarItem_off-topic');
// click on town square channel
await firstServer.click('#sidebarItem_town-square');
await firstServer.locator('[aria-label="Back"]').click();
let channelHeaderText = await firstServer.$eval('#channelHeaderTitle', (el) => el.firstChild.innerHTML);
channelHeaderText.should.equal('sint');
channelHeaderText.should.equal('Off-Topic');
await firstServer.locator('[aria-label="Forward"]').click();
channelHeaderText = await firstServer.$eval('#channelHeaderTitle', (el) => el.firstChild.innerHTML);
channelHeaderText.should.equal('Town Square');
Expand Down
41 changes: 22 additions & 19 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
"node-jq": "2.3.4",
"node-loader": "2.0.0",
"npm-run-all": "4.1.5",
"playwright": "1.28.1",
"playwright": "1.40.0",
"pretty-bytes": "6.0.0",
"ps-node": "^0.1.6",
"react": "16.14.0",
Expand Down

0 comments on commit 675ec6d

Please sign in to comment.