💚 (Hopefully) fix & re-enable E2E tests
We now wait for full app initialization (OctoPrint.coreui.startedUp & OctoPrint.loginui.startedUp) before trying to test against things. At least in local test runs that solved the flakiness.
This commit is contained in:
1 parent
6ef5b5001e
commit
01940bbb10
5 files changed
+84
-61
No files matched your search
+47
-47
@@ -90,52 +90,52 @@ jobs:
|
||||
run: |
|
||||
pip install dist/OctoPrint-*.tar.gz
|
||||
|
||||
#test-e2e:
|
||||
# name: 🧪 E2E tests
|
||||
# needs: build
|
||||
# runs-on: ubuntu-16.04
|
||||
# steps:
|
||||
# - name: ⬇ Checkout code
|
||||
# uses: actions/checkout@v2
|
||||
#
|
||||
# - name: ⬇ Download build result
|
||||
# uses: actions/download-artifact@v1
|
||||
# with:
|
||||
# name: dist
|
||||
# path: dist
|
||||
# - name: 🏗 Set up Python 3.7
|
||||
# uses: actions/setup-python@v1
|
||||
# with:
|
||||
# python-version: 3.7
|
||||
# - name: 🚀 Install wheel
|
||||
# run: |
|
||||
# pip install dist/OctoPrint-*-py2.py3-none-any.whl
|
||||
#
|
||||
# - name: 🏗 Create base config for test server
|
||||
# run: |
|
||||
# mkdir e2econfig
|
||||
# cp -r .github/fixtures/with_acl/* e2econfig
|
||||
#
|
||||
# - name: 🚀 Run Cypress
|
||||
# uses: cypress-io/github-action@v2
|
||||
# with:
|
||||
# working-directory: tests/cypress
|
||||
# browser: chrome
|
||||
# start: 'octoprint -b ${{ github.workspace }}/e2econfig serve --host 127.0.0.1 --port 5000'
|
||||
# wait-on: 'http://127.0.0.1:5000/online.txt'
|
||||
#
|
||||
# - name: ⬆ Upload screenshots
|
||||
# uses: actions/upload-artifact@v1
|
||||
# if: failure()
|
||||
# with:
|
||||
# name: cypress-screenshots
|
||||
# path: tests/cypress/screenshots
|
||||
# - name: ⬆ Upload videos
|
||||
# uses: actions/upload-artifact@v1
|
||||
# if: always()
|
||||
# with:
|
||||
# name: cypress-videos
|
||||
# path: tests/cypress/videos
|
||||
test-e2e:
|
||||
name: 🧪 E2E tests
|
||||
needs: build
|
||||
runs-on: ubuntu-16.04
|
||||
steps:
|
||||
- name: ⬇ Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: ⬇ Download build result
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: dist
|
||||
path: dist
|
||||
- name: 🏗 Set up Python 3.7
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.7
|
||||
- name: 🚀 Install wheel
|
||||
run: |
|
||||
pip install dist/OctoPrint-*-py2.py3-none-any.whl
|
||||
|
||||
- name: 🏗 Create base config for test server
|
||||
run: |
|
||||
mkdir e2econfig
|
||||
cp -r .github/fixtures/with_acl/* e2econfig
|
||||
|
||||
- name: 🚀 Run Cypress
|
||||
uses: cypress-io/github-action@v2
|
||||
with:
|
||||
working-directory: tests/cypress
|
||||
browser: chrome
|
||||
start: 'octoprint -b ${{ github.workspace }}/e2econfig serve --host 127.0.0.1 --port 5000'
|
||||
wait-on: 'http://127.0.0.1:5000/online.txt'
|
||||
|
||||
- name: ⬆ Upload screenshots
|
||||
uses: actions/upload-artifact@v1
|
||||
if: failure()
|
||||
with:
|
||||
name: cypress-screenshots
|
||||
path: tests/cypress/screenshots
|
||||
- name: ⬆ Upload videos
|
||||
uses: actions/upload-artifact@v1
|
||||
if: always()
|
||||
with:
|
||||
name: cypress-videos
|
||||
path: tests/cypress/videos
|
||||
|
||||
publish-on-testpypi:
|
||||
name: 📦 Publish on TestPyPI
|
||||
@@ -143,7 +143,7 @@ jobs:
|
||||
needs:
|
||||
- test-unit
|
||||
- test-install
|
||||
#- test-e2e
|
||||
- test-e2e
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: ⬇ Download build result
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
*/
|
||||
|
||||
$(function() {
|
||||
var OctoPrint = window.OctoPrint;
|
||||
|
||||
OctoPrint.loginui = {
|
||||
startedUp: false
|
||||
}
|
||||
|
||||
var overlayElement = $("#login-overlay");
|
||||
var errorElement = $("#login-error");
|
||||
var offlineElement = $("#login-offline");
|
||||
@@ -37,8 +43,6 @@ $(function() {
|
||||
return false;
|
||||
});
|
||||
|
||||
var OctoPrint = window.OctoPrint;
|
||||
|
||||
OctoPrint.options.baseurl = BASE_URL;
|
||||
|
||||
OctoPrint.socket.onConnected = function() {
|
||||
@@ -56,4 +60,5 @@ $(function() {
|
||||
});
|
||||
|
||||
OctoPrint.socket.connect();
|
||||
OctoPrint.loginui.startedUp = true;
|
||||
});
|
||||
@@ -39,7 +39,8 @@ $(function() {
|
||||
mobile: false,
|
||||
desktop: false
|
||||
},
|
||||
viewmodels: {}
|
||||
viewmodels: {},
|
||||
startedUp: false
|
||||
};
|
||||
|
||||
var browserVisibilityCallbacks = [];
|
||||
@@ -734,6 +735,8 @@ $(function() {
|
||||
|
||||
// Use bootstrap tabdrop for tabs and pills
|
||||
$('.nav-pills, .nav-tabs').tabdrop();
|
||||
|
||||
OctoPrint.coreui.startedUp = true;
|
||||
};
|
||||
|
||||
var fetchSettings = function() {
|
||||
|
||||
@@ -23,9 +23,8 @@ describe('Connection test against virtual printer', () => {
|
||||
});
|
||||
|
||||
cy.visit('/');
|
||||
|
||||
cy.get('#navbar', {timeout: 10000})
|
||||
.should('be.visible');
|
||||
cy.window({timeout: 10000})
|
||||
.should('have.nested.property', 'OctoPrint.coreui.startedUp', true);
|
||||
});
|
||||
|
||||
it('connect & disconnect', () => {
|
||||
|
||||
@@ -2,10 +2,13 @@ describe('Login tests', () => {
|
||||
const username = 'admin';
|
||||
const password = 'test';
|
||||
|
||||
describe.skip('Successful login', () => {
|
||||
describe('Successful login', () => {
|
||||
|
||||
it('logs in', () => {
|
||||
cy.visit('/');
|
||||
cy.window()
|
||||
.should('have.nested.property', 'OctoPrint.loginui.startedUp', true);
|
||||
|
||||
cy.get('#login-user')
|
||||
.type(username);
|
||||
cy.get('#login-password')
|
||||
@@ -13,9 +16,9 @@ describe('Login tests', () => {
|
||||
|
||||
cy.get('#login-button')
|
||||
.click();
|
||||
cy.window({timeout: 30000})
|
||||
.should('have.nested.property', 'OctoPrint.coreui.startedUp', true);
|
||||
|
||||
cy.get('#navbar', {timeout: 10000})
|
||||
.should('be.visible');
|
||||
cy.get('#navbar_login a.dropdown-toggle span')
|
||||
.should('contain', username);
|
||||
cy.getCookie('session_P5000')
|
||||
@@ -28,18 +31,21 @@ describe('Login tests', () => {
|
||||
|
||||
it('logs in with remember me', () => {
|
||||
cy.visit('/');
|
||||
cy.window()
|
||||
.should('have.nested.property', 'OctoPrint.loginui.startedUp', true);
|
||||
|
||||
cy.get('#login-user')
|
||||
.type(username);
|
||||
cy.get('#login-password')
|
||||
.type(password);
|
||||
|
||||
cy.get('#login-remember')
|
||||
.click();
|
||||
|
||||
cy.get('#login-button')
|
||||
.click();
|
||||
cy.window({timeout: 30000})
|
||||
.should('have.nested.property', 'OctoPrint.coreui.startedUp', true);
|
||||
|
||||
cy.get('#navbar', {timeout: 10000})
|
||||
.should('be.visible');
|
||||
cy.get('#navbar_login a.dropdown-toggle span')
|
||||
.should('contain', username);
|
||||
cy.getCookie('session_P5000')
|
||||
@@ -55,6 +61,9 @@ describe('Login tests', () => {
|
||||
|
||||
it('logs in and logs out again', () => {
|
||||
cy.visit('/');
|
||||
cy.window()
|
||||
.should('have.nested.property', 'OctoPrint.loginui.startedUp', true);
|
||||
|
||||
cy.get('#login-user')
|
||||
.type(username);
|
||||
cy.get('#login-password')
|
||||
@@ -63,14 +72,17 @@ describe('Login tests', () => {
|
||||
cy.get('#login-button')
|
||||
.click();
|
||||
|
||||
cy.get('#navbar', {timeout: 10000})
|
||||
.should('be.visible');
|
||||
cy.window({timeout: 30000})
|
||||
.should('have.nested.property', 'OctoPrint.coreui.startedUp', true);
|
||||
|
||||
cy.get('#navbar_login a.dropdown-toggle')
|
||||
.click();
|
||||
cy.get('#logout_button')
|
||||
.click();
|
||||
|
||||
cy.window({timeout: 30000})
|
||||
.should('have.nested.property', 'OctoPrint.loginui.startedUp', true);
|
||||
|
||||
cy.get('h2.form-signin-heading')
|
||||
.should('be.visible')
|
||||
.should('contain', 'Please log in');
|
||||
@@ -80,6 +92,8 @@ describe('Login tests', () => {
|
||||
context('Unauthorized login attempts', () => {
|
||||
it('uses wrong user name', () => {
|
||||
cy.visit('/');
|
||||
cy.window()
|
||||
.should('have.nested.property', 'OctoPrint.loginui.startedUp', true);
|
||||
|
||||
cy.get('#login-user')
|
||||
.type('idonotexist');
|
||||
@@ -91,6 +105,8 @@ describe('Login tests', () => {
|
||||
|
||||
it('uses wrong password', () => {
|
||||
cy.visit('/');
|
||||
cy.window()
|
||||
.should('have.nested.property', 'OctoPrint.loginui.startedUp', true);
|
||||
|
||||
cy.get('#login-user')
|
||||
.type('admin');
|
||||
|
||||
Reference in new issue
Block a user